Skip to content

Commit cdd5e35

Browse files
committed
🐳 chore: Upgrade V8 to v13.2.152.16
1 parent a07765f commit cdd5e35

20 files changed

+62
-25
lines changed

.github/workflows/android_v8_build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
workflow_dispatch:
99

1010
env:
11-
JAVET_V8_VERSION: 13.1.201.8
11+
JAVET_V8_VERSION: 13.2.152.16
1212
JAVET_VERSION: 4.1.1
1313
ROOT: /home/runner/work/Javet
1414

.github/workflows/linux_build_artifact.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ env:
1818
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
1919
DOCKERHUB_REPO_JAVET: ${{ secrets.DOCKERHUB_REPO_JAVET }}
2020
JAVET_NODE_VERSION: 22.12.0
21-
JAVET_V8_VERSION: 13.1.201.8
21+
JAVET_V8_VERSION: 13.2.152.16
2222
JAVET_VERSION: 4.1.1
2323

2424
jobs:

.github/workflows/linux_build_node_v8_image.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ env:
2222
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
2323
DOCKERHUB_REPO_JAVET: ${{ secrets.DOCKERHUB_REPO_JAVET }}
2424
JAVET_NODE_VERSION: 22.12.0
25-
JAVET_V8_VERSION: 13.1.201.8
25+
JAVET_V8_VERSION: 13.2.152.16
2626
JAVET_VERSION: 4.1.1
2727

2828
# if we skip a job using a job level `if` condition, then any dependent jobs also don't run.

.github/workflows/linux_x86_64_build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88

99
env:
1010
JAVET_NODE_VERSION: 22.12.0
11-
JAVET_V8_VERSION: 13.1.201.8
11+
JAVET_V8_VERSION: 13.2.152.16
1212
JAVET_VERSION: 4.1.1
1313
ROOT: /home/runner/work/Javet
1414

.github/workflows/macos_arm64_build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88

99
env:
1010
JAVET_NODE_VERSION: 22.12.0
11-
JAVET_V8_VERSION: 13.1.201.8
11+
JAVET_V8_VERSION: 13.2.152.16
1212
JAVET_VERSION: 4.1.1
1313
ROOT: /Users/runner/work/Javet
1414

.github/workflows/macos_x86_64_build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88

99
env:
1010
JAVET_NODE_VERSION: 22.12.0
11-
JAVET_V8_VERSION: 13.1.201.8
11+
JAVET_V8_VERSION: 13.2.152.16
1212
JAVET_VERSION: 4.1.1
1313
ROOT: /Users/runner/work/Javet
1414

.github/workflows/windows_x86_64_build.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88

99
env:
1010
JAVET_NODE_VERSION: 22.12.0
11-
JAVET_V8_VERSION: 13.1.201.8
11+
JAVET_V8_VERSION: 13.2.152.16
1212
JAVET_VERSION: 4.1.1
1313
ROOT: D:\a\Javet
1414

@@ -93,6 +93,8 @@ jobs:
9393
run: |
9494
cd ../google/v8
9595
sed -i '/static_assert(alignof(Type) <= alignof(decltype(/d' src/objects/tagged-field.h
96+
sed -i 's/__attribute__((tls_model(V8_TLS_MODEL)))/ /g' src/execution/isolate.h
97+
sed -i 's/__attribute__((tls_model(V8_TLS_MODEL)))/ /g' src/heap/local-heap.h
9698
9799
- name: Build Javet JNI
98100
run: |

README.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ arm ✔️ ❌ ❌ ❌
5050
arm64 ✔️ ✔️ ✔️ ❌
5151
=========== ======= ======= ======= =======
5252

53-
* Node.js ``v22.12.0`` + V8 ``v13.1.201.8``
53+
* Node.js ``v22.12.0`` + V8 ``v13.2.152.16``
5454
* i18n and non-i18n
5555
* Dynamic switch between Node.js and V8 mode
5656
* Polyfill V8 mode with `Javenode <https://github.com/caoccao/Javenode>`_

cpp/jni/javet_jni_function.cpp

+33-3
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,6 @@ JNIEXPORT jobjectArray JNICALL Java_com_caoccao_javet_interop_V8Native_functionG
216216
auto v8InternalIsolate = reinterpret_cast<V8InternalIsolate*>(v8Context->GetIsolate());
217217
#ifdef ENABLE_NODE
218218
auto v8InternalScript = V8InternalScript::cast(v8InternalShared->script());
219-
#else
220-
auto v8InternalScript = v8::internal::Cast<V8InternalScript>(v8InternalShared->script());
221-
#endif
222219
auto wrappedArguments = *v8InternalScript->wrapped_arguments();
223220
auto length = wrappedArguments.length();
224221
if (length > 0) {
@@ -231,6 +228,21 @@ JNIEXPORT jobjectArray JNICALL Java_com_caoccao_javet_interop_V8Native_functionG
231228
}
232229
return arguments;
233230
}
231+
#else
232+
auto v8InternalScript = v8::internal::Cast<V8InternalScript>(v8InternalShared->script());
233+
auto wrappedArguments = v8InternalScript->wrapped_arguments();
234+
auto length = wrappedArguments->length();
235+
if (length > 0) {
236+
jobjectArray arguments = jniEnv->NewObjectArray(length, Javet::Converter::jclassString, nullptr);
237+
for (int i = 0; i < length; ++i) {
238+
auto v8InternalObjectHandle = v8::internal::handle(wrappedArguments->get(i), v8InternalIsolate);
239+
auto v8LocalString = v8::Utils::ToLocal(v8InternalObjectHandle).As<v8::String>();
240+
jstring argument = Javet::Converter::ToJavaString(jniEnv, v8Context, v8LocalString);
241+
jniEnv->SetObjectArrayElement(arguments, i, argument);
242+
}
243+
return arguments;
244+
}
245+
#endif
234246
}
235247
}
236248
return nullptr;
@@ -383,9 +395,13 @@ JNIEXPORT jobject JNICALL Java_com_caoccao_javet_interop_V8Native_functionGetScr
383395
const int startPosition = v8InternalShared->StartPosition();
384396
const int endPosition = v8InternalShared->EndPosition();
385397
const int sourceLength = v8InternalSource->length();
398+
#ifdef ENABLE_NODE
386399
auto sourceCode = v8InternalSource->ToCString(
387400
V8InternalAllowNullsFlag::DISALLOW_NULLS, V8InternalRobustnessFlag::ROBUST_STRING_TRAVERSAL,
388401
0, sourceLength);
402+
#else
403+
auto sourceCode = v8InternalSource->ToCString(0, sourceLength);
404+
#endif
389405
return jniEnv->NewObject(
390406
Javet::Converter::jclassIV8ValueFunctionScriptSource,
391407
Javet::Converter::jmethodIDIV8ValueFunctionScriptSourceConstructor,
@@ -413,9 +429,13 @@ JNIEXPORT jstring JNICALL Java_com_caoccao_javet_interop_V8Native_functionGetSou
413429
#endif
414430
const int startPosition = v8InternalShared->StartPosition();
415431
const int endPosition = v8InternalShared->EndPosition();
432+
#ifdef ENABLE_NODE
416433
auto sourceCode = v8InternalSource->ToCString(
417434
V8InternalAllowNullsFlag::DISALLOW_NULLS, V8InternalRobustnessFlag::ROBUST_STRING_TRAVERSAL,
418435
startPosition, endPosition - startPosition);
436+
#else
437+
auto sourceCode = v8InternalSource->ToCString(startPosition, endPosition - startPosition);
438+
#endif
419439
return Javet::Converter::ToJavaString(jniEnv, sourceCode.get());
420440
}
421441
}
@@ -542,10 +562,15 @@ JNIEXPORT jboolean JNICALL Java_com_caoccao_javet_interop_V8Native_functionSetSo
542562

543563
V8LocalString newSourceCode;
544564
if (startPosition > 0) {
565+
#ifdef ENABLE_NODE
545566
int utf8Length = 0;
546567
auto stdStringHeader(v8InternalSource->ToCString(
547568
V8InternalAllowNullsFlag::DISALLOW_NULLS, V8InternalRobustnessFlag::ROBUST_STRING_TRAVERSAL,
548569
0, startPosition, &utf8Length));
570+
#else
571+
uint32_t utf8Length = 0;
572+
auto stdStringHeader(v8InternalSource->ToCString(0, startPosition, &utf8Length));
573+
#endif
549574
auto v8MaybeLocalStringHeader = v8::String::NewFromUtf8(
550575
v8Context->GetIsolate(), stdStringHeader.get(), v8::NewStringType::kNormal, utf8Length);
551576
if (v8MaybeLocalStringHeader.IsEmpty()) {
@@ -562,10 +587,15 @@ JNIEXPORT jboolean JNICALL Java_com_caoccao_javet_interop_V8Native_functionSetSo
562587
newSourceCode = v8::String::Concat(v8Context->GetIsolate(), newSourceCode, umSourceCode);
563588
}
564589
if (endPosition < sourceLength) {
590+
#ifdef ENABLE_NODE
565591
int utf8Length = 0;
566592
auto stdStringFooter(v8InternalSource->ToCString(
567593
V8InternalAllowNullsFlag::DISALLOW_NULLS, V8InternalRobustnessFlag::ROBUST_STRING_TRAVERSAL,
568594
endPosition, sourceLength - endPosition, &utf8Length));
595+
#else
596+
uint32_t utf8Length = 0;
597+
auto stdStringFooter(v8InternalSource->ToCString(endPosition, sourceLength - endPosition, &utf8Length));
598+
#endif
569599
auto v8MaybeLocalStringFooter = v8::String::NewFromUtf8(
570600
v8Context->GetIsolate(), stdStringFooter.get(), v8::NewStringType::kNormal, utf8Length);
571601
if (v8MaybeLocalStringFooter.IsEmpty()) {

cpp/jni/javet_v8_internal.h

+4
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@
5757
#pragma warning(default: 4819)
5858
#pragma warning(default: 4996)
5959

60+
#ifdef ENABLE_NODE
6061
using V8InternalAllowNullsFlag = v8::internal::AllowNullsFlag;
62+
#endif
6163
using V8internalBlockingBehavior = v8::internal::BlockingBehavior;
6264
using V8InternalBuiltin = v8::internal::Builtin;
6365
using V8InternalDisallowCompilation = v8::internal::DisallowCompilation;
@@ -71,7 +73,9 @@ using V8InternalJSObject = v8::internal::JSObject;
7173
using V8InternalModule = v8::internal::Module;
7274
using V8InternalNativeContext = v8::internal::NativeContext;
7375
using V8InternalObject = v8::internal::Object;
76+
#ifdef ENABLE_NODE
7477
using V8InternalRobustnessFlag = v8::internal::RobustnessFlag;
78+
#endif
7579
using V8InternalScopeInfo = v8::internal::ScopeInfo;
7680
using V8InternalScopeIterator = v8::internal::ScopeIterator;
7781
using V8InternalScopeType = v8::internal::ScopeType;

docker/android/base.Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
# Usage: docker build -t sjtucaocao/javet-android:4.1.1 -f docker/android/base.Dockerfile .
1717

18-
ARG JAVET_V8_VERSION=13.1.201.8
18+
ARG JAVET_V8_VERSION=13.2.152.16
1919

2020
FROM ubuntu:20.04
2121
WORKDIR /

docker/linux-arm64/base_all_in_one.Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# Usage: docker build -t sjtucaocao/javet-arm64:4.1.1 -f docker/linux-arm64/base_all_in_one.Dockerfile .
1717

1818
ARG JAVET_NODE_VERSION=18.15.0
19-
ARG JAVET_V8_VERSION=13.1.201.8
19+
ARG JAVET_V8_VERSION=13.2.152.16
2020

2121
FROM ubuntu:20.04
2222
WORKDIR /

docker/linux-arm64/base_v8.Dockerfile

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414
# limitations under the License.
1515

1616
# Usage: docker build \
17-
# -t sjtucaocao/javet:arm64-base-v8_13.1.201.8 \
17+
# -t sjtucaocao/javet:arm64-base-v8_13.2.152.16 \
1818
# --build-arg JAVET_REPO=sjtucaocao/javet \
19-
# --build-arg JAVET_V8_VERSION=13.1.201.8 \
19+
# --build-arg JAVET_V8_VERSION=13.2.152.16 \
2020
# -f docker/linux-arm64/base_v8.Dockerfile .
2121

2222
ARG JAVET_REPO=sjtucaocao/javet
23-
ARG JAVET_V8_VERSION=13.1.201.8
23+
ARG JAVET_V8_VERSION=13.2.152.16
2424

2525
FROM ${JAVET_REPO}:arm64-base-jvm
2626

docker/linux-x86_64/base_all_in_one.Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ FROM ubuntu:20.04
1919
WORKDIR /
2020

2121
ARG JAVET_NODE_VERSION=22.12.0
22-
ARG JAVET_V8_VERSION=13.1.201.8
22+
ARG JAVET_V8_VERSION=13.2.152.16
2323

2424
# Update Ubuntu
2525
ENV DEBIAN_FRONTEND=noninteractive

docker/linux-x86_64/base_v8.Dockerfile

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414
# limitations under the License.
1515

1616
# Usage: docker build \
17-
# -t sjtucaocao/javet:x86_64-base-v8_13.1.201.8 \
17+
# -t sjtucaocao/javet:x86_64-base-v8_13.2.152.16 \
1818
# --build-arg JAVET_REPO=sjtucaocao/javet \
19-
# --build-arg JAVET_V8_VERSION=13.1.201.8 \
19+
# --build-arg JAVET_V8_VERSION=13.2.152.16 \
2020
# -f docker/linux-x86_64/base_v8.Dockerfile .
2121

2222
ARG JAVET_REPO=sjtucaocao/javet
23-
ARG JAVET_V8_VERSION=13.1.201.8
23+
ARG JAVET_V8_VERSION=13.2.152.16
2424

2525
FROM ${JAVET_REPO}:x86_64-base-jvm
2626

docker/linux-x86_64/build.env

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
JAVET_REPO=sjtucaocao/javet
22
JAVET_VERSION=4.1.1
3-
JAVET_V8_VERSION=13.1.201.8
3+
JAVET_V8_VERSION=13.2.152.16
44
JAVET_NODE_VERSION=22.12.0

docker/windows-x86_64/base.Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
# Usage: docker build -t sjtucaocao/javet-windows:4.1.1 -m 4G -f docker/windows-x86_64/base.Dockerfile .
3333

3434
ARG JAVET_NODE_VERSION=22.12.0
35-
ARG JAVET_V8_VERSION=13.1.201.8
35+
ARG JAVET_V8_VERSION=13.2.152.16
3636

3737
# https://hub.docker.com/_/microsoft-windows
3838
FROM mcr.microsoft.com/windows:20H2-amd64

docs/release_notes/release_notes_4_0.rst

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Release Notes 4.0.x - 4.1.x
66
-----
77

88
* Upgraded Node.js to ``v22.12.0`` `(2024-12-03) <https://github.com/nodejs/node/blob/main/doc/changelogs/CHANGELOG_V22.md#22.12.0>`_
9+
* Upgraded V8 to ``v13.2.152.16`` (2024-12-05)
910
* Upgraded Visual Studio 2022 to `v17.12.3 <https://learn.microsoft.com/en-us/visualstudio/releases/2022/release-notes-v17.12>`_
1011
* Added ``getAbsoluteResourceName()`` to ``IV8ModuleResolver``
1112
* Fixed memory leaks in function callback in edge cases

scripts/python/change_node_v8_version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def update(self) -> None:
172172
def main():
173173
change_node_version = ChangeNodeVersion('22.12.0')
174174
change_node_version.update()
175-
change_v8_version = ChangeV8Version('13.1.201.8')
175+
change_v8_version = ChangeV8Version('13.2.152.16')
176176
change_v8_version.update()
177177
return 0
178178

src/main/java/com/caoccao/javet/enums/JSRuntimeType.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public enum JSRuntimeType {
6060
V8(
6161
"v8",
6262
false,
63-
"13.1.201.8",
63+
"13.2.152.16",
6464
V8RuntimeOptions::new,
6565
o -> o instanceof V8RuntimeOptions),
6666
/**
@@ -71,7 +71,7 @@ public enum JSRuntimeType {
7171
V8I18n(
7272
"v8",
7373
true,
74-
"13.1.201.8",
74+
"13.2.152.16",
7575
V8RuntimeOptions::new,
7676
o -> o instanceof V8RuntimeOptions);
7777

0 commit comments

Comments
 (0)