Skip to content

Commit

Permalink
⛲ Javet v3.1.3 (#352)
Browse files Browse the repository at this point in the history
* Upgraded Node.js to `v20.14.0` [(2024-05-28)](https://github.com/nodejs/node/blob/main/doc/changelogs/CHANGELOG_V20.md#20.14.0)
* Upgraded V8 to `v12.6.228.13` (2024-06-06)
* Upgraded Visual Studio 2022 to [v17.10.1](https://learn.microsoft.com/en-us/visualstudio/releases/2022/release-notes-v17.10)
* Rewrote `toString()` for `V8ValueBigInteger`, `V8ValueInteger`, `V8ValueLong` and `V8ValueDouble`
* Added `getPrototypeOf()` to support `instanceof` for proxy converter
* Added `getPrototypeOf()`, `setPrototypeOf()`, `create()`, `seal()` to `V8ValueBuiltInObject`
* Added `JavetProxyPrototypeStore`
* Added `getPrototypeOf()` to `IJavetDirectProxyHandler` and `JavetDirectProxyObjectHandler`
* Added `getGuard()` to `V8Runtime`
* Added `isSealed()`, `isFrozen()` to `V8ValueObject`
* Added `sealedEnabled` to `JavetConverterConfig`
* Updated `JavetObjectConverter` to convert sealed array to `Object[]` instead of `List<Object>`
* Replaced `JavetEngineGuard` with `V8Guard`
* Removed `executorService`, `engineGuardCheckIntervalMillis` from `JavetEngineConfig`
* Patched V8 [Check failed: !IsFreeSpaceOrFillerMap(map)](https://groups.google.com/g/v8-dev/c/TCGnZKjYFEI/m/uDOciJsHAQAJ)
  • Loading branch information
caoccao authored Jun 9, 2024
1 parent ac31ce0 commit 6ddb22f
Show file tree
Hide file tree
Showing 562 changed files with 5,649 additions and 3,796 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/android_node_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ on:
workflow_dispatch:

env:
JAVET_NODE_VERSION: 20.13.1
JAVET_VERSION: 3.1.2
JAVET_NODE_VERSION: 20.14.0
JAVET_VERSION: 3.1.3
ROOT: /home/runner/work/Javet

jobs:
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/android_v8_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ on:
workflow_dispatch:

env:
JAVET_V8_VERSION: 12.5.227.6
JAVET_VERSION: 3.1.2
JAVET_V8_VERSION: 12.6.228.13
JAVET_VERSION: 3.1.3
ROOT: /home/runner/work/Javet

jobs:
Expand Down Expand Up @@ -80,6 +80,7 @@ jobs:
gclient sync -D
cd v8
python3 tools/dev/v8gen.py ${{ matrix.v8_release }}.release -- 'target_os="android"' 'target_cpu="${{ matrix.v8_arch }}"' 'v8_target_cpu="${{ matrix.v8_arch }}"' v8_monolithic=true v8_use_external_startup_data=false is_component_build=false v8_enable_i18n_support=false v8_enable_pointer_compression=false v8_static_library=true symbol_level=0 use_custom_libcxx=false v8_enable_sandbox=false
sed -i '/CHECK(!IsFreeSpaceOrFillerMap(map));/d' src/heap/concurrent-marking.cc
ninja -C out.gn/${{ matrix.v8_release }}.release v8_monolith || python3 ${{ env.ROOT }}/Javet/scripts/python/patch_v8_build.py -p ./
ninja -C out.gn/${{ matrix.v8_release }}.release v8_monolith
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/linux_build_artifact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ on:
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_REPO_JAVET: ${{ secrets.DOCKERHUB_REPO_JAVET }}
JAVET_NODE_VERSION: 20.13.1
JAVET_V8_VERSION: 12.5.227.6
JAVET_VERSION: 3.1.2
JAVET_NODE_VERSION: 20.14.0
JAVET_V8_VERSION: 12.6.228.13
JAVET_VERSION: 3.1.3

jobs:
javet_linux_x86_64:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/linux_build_node_v8_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ on:
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_REPO_JAVET: ${{ secrets.DOCKERHUB_REPO_JAVET }}
JAVET_NODE_VERSION: 20.13.1
JAVET_V8_VERSION: 12.5.227.6
JAVET_VERSION: 3.1.2
JAVET_NODE_VERSION: 20.14.0
JAVET_V8_VERSION: 12.6.228.13
JAVET_VERSION: 3.1.3

# if we skip a job using a job level `if` condition, then any dependent jobs also don't run.
# we can skip a step of the job, using a step level `if` condition.
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/linux_x86_64_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ on:
workflow_dispatch:

env:
JAVET_NODE_VERSION: 20.13.1
JAVET_V8_VERSION: 12.5.227.6
JAVET_VERSION: 3.1.2
JAVET_NODE_VERSION: 20.14.0
JAVET_V8_VERSION: 12.6.228.13
JAVET_VERSION: 3.1.3
ROOT: /home/runner/work/Javet

jobs:
Expand Down Expand Up @@ -52,6 +52,7 @@ jobs:
gclient sync -D
cd v8
python3 tools/dev/v8gen.py x64.release -- v8_monolithic=true v8_use_external_startup_data=false is_component_build=false v8_enable_i18n_support=false v8_enable_pointer_compression=false v8_static_library=true symbol_level=0 use_custom_libcxx=false v8_enable_sandbox=false
sed -i '/CHECK(!IsFreeSpaceOrFillerMap(map));/d' src/heap/concurrent-marking.cc
sed -i '/#include "src\/libplatform\//a #include <cstdlib>' src/libplatform/default-thread-isolated-allocator.cc
sed -i '/bool KernelHasPkruFix()/a const char* env = std::getenv("JAVET_DISABLE_PKU"); if (env && std::strlen(env) > 0) { return false; }' src/libplatform/default-thread-isolated-allocator.cc
ninja -C out.gn/x64.release v8_monolith || python3 ${{ env.ROOT }}/Javet/scripts/python/patch_v8_build.py -p ./
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/macos_arm64_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ on:
workflow_dispatch:

env:
JAVET_NODE_VERSION: 20.13.1
JAVET_V8_VERSION: 12.5.227.6
JAVET_VERSION: 3.1.2
JAVET_NODE_VERSION: 20.14.0
JAVET_V8_VERSION: 12.6.228.13
JAVET_VERSION: 3.1.3
ROOT: /Users/runner/work/Javet

jobs:
Expand Down Expand Up @@ -52,6 +52,7 @@ jobs:
gclient sync -D
cd v8
python3 tools/dev/v8gen.py arm64.release -- v8_monolithic=true 'target_cpu="arm64"' v8_use_external_startup_data=false is_component_build=false v8_enable_i18n_support=false v8_enable_pointer_compression=false v8_static_library=true symbol_level=0 use_custom_libcxx=false v8_enable_sandbox=false
sed -i '' -e '/CHECK(!IsFreeSpaceOrFillerMap(map));/d' src/heap/concurrent-marking.cc
gn gen out.gn/arm64.release
ninja -C out.gn/arm64.release v8_monolith || python3 ${{ env.ROOT }}/Javet/scripts/python/patch_v8_build.py -p ./
ninja -C out.gn/arm64.release v8_monolith
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/macos_x86_64_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ on:
workflow_dispatch:

env:
JAVET_NODE_VERSION: 20.13.1
JAVET_V8_VERSION: 12.5.227.6
JAVET_VERSION: 3.1.2
JAVET_NODE_VERSION: 20.14.0
JAVET_V8_VERSION: 12.6.228.13
JAVET_VERSION: 3.1.3
ROOT: /Users/runner/work/Javet

jobs:
Expand Down Expand Up @@ -52,6 +52,7 @@ jobs:
gclient sync -D
cd v8
python3 tools/dev/v8gen.py x64.release -- v8_monolithic=true v8_use_external_startup_data=false is_component_build=false v8_enable_i18n_support=false v8_enable_pointer_compression=false v8_static_library=true symbol_level=0 use_custom_libcxx=false v8_enable_sandbox=false
sed -i '' -e '/CHECK(!IsFreeSpaceOrFillerMap(map));/d' src/heap/concurrent-marking.cc
gn gen out.gn/x64.release
ninja -C out.gn/x64.release v8_monolith || python3 ${{ env.ROOT }}/Javet/scripts/python/patch_v8_build.py -p ./
ninja -C out.gn/x64.release v8_monolith
Expand Down
28 changes: 14 additions & 14 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ arm ✔️ ❌ ❌ ❌
arm64 ✔️ ✔️ ✔️ ❌
=========== ======= ======= ======= =======

* Node.js ``v20.13.1`` + V8 ``v12.5.227.6``
* Node.js ``v20.14.0`` + V8 ``v12.6.228.13``
* Dynamic switch between Node.js and V8 mode (`Which mode do you prefer? <https://github.com/caoccao/Javet/discussions/92>`_)
* Polyfill V8 mode with `Javenode <https://github.com/caoccao/Javenode>`_
* V8 API exposure in JVM
Expand Down Expand Up @@ -75,44 +75,44 @@ Maven
<dependency>
<groupId>com.caoccao.javet</groupId>
<artifactId>javet</artifactId>
<version>3.1.2</version>
<version>3.1.3</version>
</dependency>
<!-- Linux (arm64) -->
<dependency>
<groupId>com.caoccao.javet</groupId>
<artifactId>javet-linux-arm64</artifactId>
<version>3.1.2</version>
<version>3.1.3</version>
</dependency>
<!-- Mac OS (x86_64 and arm64) -->
<dependency>
<groupId>com.caoccao.javet</groupId>
<artifactId>javet-macos</artifactId>
<version>3.1.2</version>
<version>3.1.3</version>
</dependency>
Gradle Kotlin DSL
^^^^^^^^^^^^^^^^^

.. code-block:: kotlin
implementation("com.caoccao.javet:javet:3.1.2") // Linux and Windows (x86_64)
implementation("com.caoccao.javet:javet-linux-arm64:3.1.2") // Linux (arm64)
implementation("com.caoccao.javet:javet-macos:3.1.2") // Mac OS (x86_64 and arm64)
implementation("com.caoccao.javet:javet-android-node:3.1.2") // Android Node (arm, arm64, x86 and x86_64)
implementation("com.caoccao.javet:javet-android-v8:3.1.2") // Android V8 (arm, arm64, x86 and x86_64)
implementation("com.caoccao.javet:javet:3.1.3") // Linux and Windows (x86_64)
implementation("com.caoccao.javet:javet-linux-arm64:3.1.3") // Linux (arm64)
implementation("com.caoccao.javet:javet-macos:3.1.3") // Mac OS (x86_64 and arm64)
implementation("com.caoccao.javet:javet-android-node:3.1.3") // Android Node (arm, arm64, x86 and x86_64)
implementation("com.caoccao.javet:javet-android-v8:3.1.3") // Android V8 (arm, arm64, x86 and x86_64)
Gradle Groovy DSL
^^^^^^^^^^^^^^^^^

.. code-block:: groovy
implementation 'com.caoccao.javet:javet:3.1.2' // Linux and Windows (x86_64)
implementation 'com.caoccao.javet:javet-linux-arm64:3.1.2' // Linux (arm64)
implementation 'com.caoccao.javet:javet-macos:3.1.2' // Mac OS (x86_64 and arm64)
implementation 'com.caoccao.javet:javet-android-node:3.1.2' // Android Node (arm, arm64, x86 and x86_64)
implementation 'com.caoccao.javet:javet-android-v8:3.1.2' // Android V8 (arm, arm64, x86 and x86_64)
implementation 'com.caoccao.javet:javet:3.1.3' // Linux and Windows (x86_64)
implementation 'com.caoccao.javet:javet-linux-arm64:3.1.3' // Linux (arm64)
implementation 'com.caoccao.javet:javet-macos:3.1.3' // Mac OS (x86_64 and arm64)
implementation 'com.caoccao.javet:javet-android-node:3.1.3' // Android Node (arm, arm64, x86 and x86_64)
implementation 'com.caoccao.javet:javet-android-v8:3.1.3' // Android V8 (arm, arm64, x86 and x86_64)
Hello Javet
-----------
Expand Down
2 changes: 1 addition & 1 deletion android/javet-android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ object Config {
const val ANDROIDX_TEST = "1.1.5"
const val APPCOMPAT = "1.3.1"
const val DESUGAR_JDK_LIBS = "2.0.4"
const val JAVET = "3.1.2"
const val JAVET = "3.1.3"
const val JUNIT = "5.10.1"
}
}
Expand Down
2 changes: 1 addition & 1 deletion android/javet-android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="1"
android:versionName="3.1.2"
android:versionName="3.1.3"
>

</manifest>
4 changes: 2 additions & 2 deletions android/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<groupId>com.caoccao.javet</groupId>
<artifactId>javet-android</artifactId>
<version>3.1.2</version>
<version>3.1.3</version>
<name>javet</name>
<packaging>aar</packaging>
<description>Javet is Java + V8 (JAVa + V + EighT). It is an awesome way of embedding V8 in Java.</description>
Expand All @@ -29,7 +29,7 @@
<connection>scm:git:git://github.com/caoccao/Javet.git</connection>
<developerConnection>scm:git:git@github.com:caoccao/caoccao.git</developerConnection>
<url>https://github.com/caoccao/Javet</url>
<tag>3.1.2</tag>
<tag>3.1.3</tag>
</scm>

<properties>
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ object Config {
const val BYTE_BUDDY = "1.14.10"
const val JACKSON_DATABIND = "2.16.0"
const val JAVA_VERSION = "1.8"
const val JAVET = "3.1.2"
const val JAVET = "3.1.3"
const val JETTY_WEBSOCKET = "9.4.53.v20231009"
const val JUNIT = "5.10.1"
}
Expand Down
2 changes: 1 addition & 1 deletion cpp/build-android.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Usage for V8: sh build-android.sh -DV8_DIR=${HOME}/v8 -DCMAKE_ANDROID_NDK=${HOME}/android -DCMAKE_ANDROID_ARCH=arm64
# Usage for Node: sh build-android.sh -DNODE_DIR=${HOME}/node -DCMAKE_ANDROID_NDK=${HOME}/android -DCMAKE_ANDROID_ARCH=arm64
JAVET_VERSION=3.1.2
JAVET_VERSION=3.1.3
rm -rf build_android
mkdir build_android
cd build_android
Expand Down
2 changes: 1 addition & 1 deletion cpp/build-linux-arm64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Usage for V8: sh build-linux-arm64.sh -DV8_DIR=${HOME}/v8
# Usage for Node: sh build-linux-arm64.sh -DNODE_DIR=${HOME}/node
JAVET_VERSION=3.1.2
JAVET_VERSION=3.1.3
rm -rf build_linux_arm64
mkdir build_linux_arm64
cd build_linux_arm64
Expand Down
2 changes: 1 addition & 1 deletion cpp/build-linux-x86_64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Usage for V8: sh build-linux-x86_64.sh -DV8_DIR=${HOME}/v8
# Usage for Node: sh build-linux-x86_64.sh -DNODE_DIR=${HOME}/node
JAVET_VERSION=3.1.2
JAVET_VERSION=3.1.3
rm -rf build_linux_x86_64
mkdir build_linux_x86_64
cd build_linux_x86_64
Expand Down
2 changes: 1 addition & 1 deletion cpp/build-macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Usage for V8: sh build-macos.sh -DV8_DIR=${HOME}/v8
# Usage for Node: sh build-macos.sh -DNODE_DIR=${HOME}/node
JAVET_VERSION=3.1.2
JAVET_VERSION=3.1.3
rm -rf build_macos
mkdir build_macos
cd build_macos
Expand Down
2 changes: 1 addition & 1 deletion cpp/build-windows.cmd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@echo off
REM Usage for V8: build -DV8_DIR=C:\v8
REM Usage for Node: build -DNODE_DIR=C:\node
SET JAVET_VERSION=3.1.2
SET JAVET_VERSION=3.1.3
rd /s/q build_windows
mkdir build_windows
cd build_windows
Expand Down
16 changes: 16 additions & 0 deletions cpp/jni/com_caoccao_javet_interop_V8Native.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions cpp/jni/javet_converter.h
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,15 @@ namespace Javet {
#endif
}

static inline V8InternalJSObject ToV8InternalJSObject(
const V8LocalValue& v8LocalValue) noexcept {
#ifdef ENABLE_NODE
return V8InternalJSObject::cast(*v8::Utils::OpenHandle(*v8LocalValue));
#else
return *V8InternalJSObject::cast(*v8::Utils::OpenHandle(*v8LocalValue));
#endif
}

static inline V8InternalModule ToV8InternalModule(
const V8LocalModule& v8LocalModule) noexcept {
#ifdef ENABLE_NODE
Expand Down
30 changes: 30 additions & 0 deletions cpp/jni/javet_jni_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,36 @@ JNIEXPORT jobject JNICALL Java_com_caoccao_javet_interop_V8Native_objectInvoke
return Javet::Converter::ToExternalV8ValueUndefined(jniEnv, v8Runtime);
}

JNIEXPORT jboolean JNICALL Java_com_caoccao_javet_interop_V8Native_objectIsFrozen
(JNIEnv* jniEnv, jobject caller, jlong v8RuntimeHandle, jlong v8ValueHandle) {
RUNTIME_AND_VALUE_HANDLES_TO_OBJECTS_WITH_SCOPE(v8RuntimeHandle, v8ValueHandle);
if (v8LocalValue->IsObject()) {
auto v8InternalJSObject = Javet::Converter::ToV8InternalJSObject(v8LocalValue);
#ifdef ENABLE_NODE
auto elementKind = V8InternalJSObject::cast(v8InternalJSObject).GetElementsKind();
#else
auto elementKind = V8InternalJSObject::cast(v8InternalJSObject)->GetElementsKind();
#endif
return v8::internal::IsFrozenElementsKind(elementKind);
}
return false;
}

JNIEXPORT jboolean JNICALL Java_com_caoccao_javet_interop_V8Native_objectIsSealed
(JNIEnv* jniEnv, jobject caller, jlong v8RuntimeHandle, jlong v8ValueHandle) {
RUNTIME_AND_VALUE_HANDLES_TO_OBJECTS_WITH_SCOPE(v8RuntimeHandle, v8ValueHandle);
if (v8LocalValue->IsObject()) {
auto v8InternalJSObject = Javet::Converter::ToV8InternalJSObject(v8LocalValue);
#ifdef ENABLE_NODE
auto elementKind = V8InternalJSObject::cast(v8InternalJSObject).GetElementsKind();
#else
auto elementKind = V8InternalJSObject::cast(v8InternalJSObject)->GetElementsKind();
#endif
return v8::internal::IsSealedElementsKind(elementKind);
}
return false;
}

JNIEXPORT jboolean JNICALL Java_com_caoccao_javet_interop_V8Native_objectSet
(JNIEnv* jniEnv, jobject caller, jlong v8RuntimeHandle, jlong v8ValueHandle, jint v8ValueType, jobjectArray keysAndValues) {
RUNTIME_AND_VALUE_HANDLES_TO_OBJECTS_WITH_SCOPE(v8RuntimeHandle, v8ValueHandle);
Expand Down
12 changes: 6 additions & 6 deletions cpp/jni/javet_resource_node.rc
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,1,2,0
PRODUCTVERSION 3,1,2,0
FILEVERSION 3,1,3,0
PRODUCTVERSION 3,1,3,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -79,12 +79,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "caoccao.com"
VALUE "FileDescription", "caoccao.com"
VALUE "FileVersion", "3.1.2.0"
VALUE "InternalName", "libjavet-node-windows-x86_64.v.3.1.2.dll"
VALUE "FileVersion", "3.1.3.0"
VALUE "InternalName", "libjavet-node-windows-x86_64.v.3.1.3.dll"
VALUE "LegalCopyright", "Copyright (c) 2021-2024."
VALUE "OriginalFilename", "libjavet-node-windows-x86_64.v.3.1.2.dll"
VALUE "OriginalFilename", "libjavet-node-windows-x86_64.v.3.1.3.dll"
VALUE "ProductName", "Javet Windows"
VALUE "ProductVersion", "3.1.2.0"
VALUE "ProductVersion", "3.1.3.0"
END
END
BLOCK "VarFileInfo"
Expand Down
Loading

0 comments on commit 6ddb22f

Please sign in to comment.