@yao-pkg/pkg-fetch 3.5.33 → 3.5.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -14
- package/lib-es5/build.js +4 -7
- package/lib-es5/expected-shas.json +31 -21
- package/lib-es5/verify.js +17 -2
- package/package.json +3 -2
- package/patches/{node.v22.22.2.cpp.patch → node.v22.22.3.cpp.patch} +6 -6
- package/patches/{node.v24.14.1.cpp.patch → node.v24.15.0.cpp.patch} +15 -15
- package/patches/node.v26.2.0.cpp.patch +809 -0
- package/patches/patches.json +3 -2
package/README.md
CHANGED
|
@@ -1,20 +1,26 @@
|
|
|
1
|
+
# pkg-fetch
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@yao-pkg/pkg-fetch)
|
|
4
|
+
[](https://www.npmjs.com/package/@yao-pkg/pkg-fetch)
|
|
5
|
+
[](https://github.com/yao-pkg/pkg-fetch/blob/main/LICENSE)
|
|
6
|
+
|
|
1
7
|
A utility to fetch or build patched Node binaries used by [pkg](https://github.com/yao-pkg/pkg) to generate executables. This repo hosts prebuilt binaries in [Releases](https://github.com/yao-pkg/pkg-fetch/releases).
|
|
2
8
|
|
|
3
9
|
## Binary Compatibility
|
|
4
10
|
|
|
5
|
-
| Node
|
|
6
|
-
|
|
|
7
|
-
| 8<sup>[1](#fn1)</sup>, 10<sup>[1](#fn1)</sup>, 12<sup>[1](#fn1)</sup>, 14<sup>[1](#fn1)</sup>, 16<sup>[1](#fn1)</sup>, 18, 20, 22 | alpine | x64, arm64 | 3.7.3, other distros with musl libc >= 1.1.18 |
|
|
8
|
-
| 8<sup>[1](#fn1)</sup>, 10<sup>[1](#fn1)</sup>, 12<sup>[1](#fn1)</sup>, 14<sup>[1](#fn1)</sup>, 16<sup>[1](#fn1)</sup>
|
|
9
|
-
| 18, 20, 22 | linux | x64 | Enterprise Linux 8, Ubuntu 20.04, Debian buster, other distros with glibc >= 2.28 |
|
|
10
|
-
| 8<sup>[1](#fn1)</sup>, 10<sup>[1](#fn1)</sup>, 12<sup>[1](#fn1)</sup>, 14<sup>[1](#fn1)</sup>, 16<sup>[1](#fn1)</sup>
|
|
11
|
-
| 18, 20, 22 | linux | arm64 | Enterprise Linux 9, Ubuntu 22.04, Debian bookworm, other distros with glibc >= 2.35 |
|
|
12
|
-
| 8<sup>[1](#fn1)</sup>, 10<sup>[1](#fn1)</sup>, 12<sup>[1](#fn1)</sup>, 14<sup>[1](#fn1)</sup>, 16<sup>[1](#fn1)</sup>, 18, 20, 22 | linuxstatic | x64, arm64 | Any distro with Linux Kernel >= 2.6.32 (>= 3.10 strongly recommended) |
|
|
13
|
-
| 16<sup>[1](#fn1)</sup>, 18, 20, 22
|
|
14
|
-
| 8<sup>[1](#fn1)</sup>, 10<sup>[1](#fn1)</sup>, 12<sup>[1](#fn1)</sup>, 14<sup>[1](#fn1)</sup>, 16<sup>[1](#fn1)</sup>, 18, 20, 22 | macos | x64 | 10.13 |
|
|
15
|
-
| 14<sup>[1](#fn1)</sup>, 16<sup>[1](#fn1)</sup>, 18, 20, 22 | macos | arm64<sup>[3](#fn3)</sup> | 11.0 |
|
|
16
|
-
| 8<sup>[1](#fn1)</sup>, 10<sup>[1](#fn1)</sup>, 12<sup>[1](#fn1)</sup>, 14<sup>[1](#fn1)</sup>, 16<sup>[1](#fn1)</sup>, 18, 20, 22 | win | x64 | 8.1 |
|
|
17
|
-
| 14<sup>[1](#fn1)</sup>, 16<sup>[1](#fn1)</sup>, 18, 20, 22 | win | arm64 | 10 |
|
|
11
|
+
| Node | Platform | Architectures | Minimum OS version |
|
|
12
|
+
| ------------------------------------------------------------------------------------------------------------------------------------- | ----------- | ------------------------- | ----------------------------------------------------------------------------------- |
|
|
13
|
+
| 8<sup>[1](#fn1)</sup>, 10<sup>[1](#fn1)</sup>, 12<sup>[1](#fn1)</sup>, 14<sup>[1](#fn1)</sup>, 16<sup>[1](#fn1)</sup>, 18, 20, 22, 24 | alpine | x64, arm64 | 3.7.3, other distros with musl libc >= 1.1.18 |
|
|
14
|
+
| 8<sup>[1](#fn1)</sup>, 10<sup>[1](#fn1)</sup>, 12<sup>[1](#fn1)</sup>, 14<sup>[1](#fn1)</sup>, 16<sup>[1](#fn1)</sup> | linux | x64 | Enterprise Linux 7, Ubuntu 14.04, Debian jessie, other distros with glibc >= 2.17 |
|
|
15
|
+
| 18, 20, 22, 24 | linux | x64 | Enterprise Linux 8, Ubuntu 20.04, Debian buster, other distros with glibc >= 2.28 |
|
|
16
|
+
| 8<sup>[1](#fn1)</sup>, 10<sup>[1](#fn1)</sup>, 12<sup>[1](#fn1)</sup>, 14<sup>[1](#fn1)</sup>, 16<sup>[1](#fn1)</sup> | linux | arm64 | Enterprise Linux 8, Ubuntu 18.04, Debian buster, other distros with glibc >= 2.27 |
|
|
17
|
+
| 18, 20, 22, 24 | linux | arm64 | Enterprise Linux 9, Ubuntu 22.04, Debian bookworm, other distros with glibc >= 2.35 |
|
|
18
|
+
| 8<sup>[1](#fn1)</sup>, 10<sup>[1](#fn1)</sup>, 12<sup>[1](#fn1)</sup>, 14<sup>[1](#fn1)</sup>, 16<sup>[1](#fn1)</sup>, 18, 20, 22, 24 | linuxstatic | x64, arm64 | Any distro with Linux Kernel >= 2.6.32 (>= 3.10 strongly recommended) |
|
|
19
|
+
| 16<sup>[1](#fn1)</sup>, 18, 20, 22 | linuxstatic | armv7<sup>[2](#fn2)</sup> | Any distro with Linux Kernel >= 2.6.32 (>= 3.10 strongly recommended) |
|
|
20
|
+
| 8<sup>[1](#fn1)</sup>, 10<sup>[1](#fn1)</sup>, 12<sup>[1](#fn1)</sup>, 14<sup>[1](#fn1)</sup>, 16<sup>[1](#fn1)</sup>, 18, 20, 22, 24 | macos | x64 | 10.13 |
|
|
21
|
+
| 14<sup>[1](#fn1)</sup>, 16<sup>[1](#fn1)</sup>, 18, 20, 22, 24 | macos | arm64<sup>[3](#fn3)</sup> | 11.0 |
|
|
22
|
+
| 8<sup>[1](#fn1)</sup>, 10<sup>[1](#fn1)</sup>, 12<sup>[1](#fn1)</sup>, 14<sup>[1](#fn1)</sup>, 16<sup>[1](#fn1)</sup>, 18, 20, 22, 24 | win | x64 | 8.1 |
|
|
23
|
+
| 14<sup>[1](#fn1)</sup>, 16<sup>[1](#fn1)</sup>, 18, 20, 22, 24 | win | arm64 | 10 |
|
|
18
24
|
|
|
19
25
|
<em id="fn1">[1]</em>: end-of-life, may be removed in the next major release.
|
|
20
26
|
|
|
@@ -82,7 +88,7 @@ tag you want a patch for (e.g. v18.13.0 to use the previous example). Alongside
|
|
|
82
88
|
this, have the `.rej` file and go through each rejected hunk by hunk and use
|
|
83
89
|
your best judgement to determine how it should apply against the new tag.
|
|
84
90
|
|
|
85
|
-
Save
|
|
91
|
+
Save your results, and export the overall git diff with the commands from the
|
|
86
92
|
example above.
|
|
87
93
|
|
|
88
94
|
### Checking that patches apply cleanly
|
package/lib-es5/build.js
CHANGED
|
@@ -45,8 +45,11 @@ function getConfigureArgs(major, targetPlatform, targetArch) {
|
|
|
45
45
|
args.push('--fully-static');
|
|
46
46
|
}
|
|
47
47
|
// Link Time Optimization
|
|
48
|
+
// Skipped on macOS: LTO makes the link phase enormously slow and pushes the
|
|
49
|
+
// build past GitHub Actions' 6h job limit (worst on the Intel x64 runner).
|
|
50
|
+
// See yao-pkg/pkg-fetch#170.
|
|
48
51
|
if (major >= 12) {
|
|
49
|
-
if (system_1.hostPlatform !== 'win') {
|
|
52
|
+
if (system_1.hostPlatform !== 'win' && targetPlatform !== 'macos') {
|
|
50
53
|
args.push('--enable-lto');
|
|
51
54
|
}
|
|
52
55
|
}
|
|
@@ -165,12 +168,6 @@ async function compileOnWindows(nodeVersion, targetArch, targetPlatform) {
|
|
|
165
168
|
if (major >= 24) {
|
|
166
169
|
args.push('full-icu');
|
|
167
170
|
}
|
|
168
|
-
// Can't cross compile for arm64 with small-icu
|
|
169
|
-
if (major < 24 &&
|
|
170
|
-
system_1.hostArch !== targetArch &&
|
|
171
|
-
!config_flags.includes('--with-intl=full-icu')) {
|
|
172
|
-
config_flags.push('--without-intl');
|
|
173
|
-
}
|
|
174
171
|
await (0, utils_1.spawn)('cmd', args, {
|
|
175
172
|
cwd: nodePath,
|
|
176
173
|
env: { ...process.env, config_flags: config_flags.join(' ') },
|
|
@@ -43,25 +43,35 @@
|
|
|
43
43
|
"node-v20.20.2-macos-x64": "2276efd46dc3a30d5524ea60b8cb63afa5c8e45e0f17ad49065bcea7b59b7eeb",
|
|
44
44
|
"node-v20.20.2-win-arm64": "aebc71a3ebf4774adaac0cd891bfba54f9e5e4340c39b44492127de551a9b5a8",
|
|
45
45
|
"node-v20.20.2-win-x64": "f9b870a1b20c3bcf729a53112b6a72db65b050e4e6494d33ceab3413c507f01c",
|
|
46
|
-
"node-v22.22.
|
|
47
|
-
"node-v22.22.
|
|
48
|
-
"node-v22.22.
|
|
49
|
-
"node-v22.22.
|
|
50
|
-
"node-v22.22.
|
|
51
|
-
"node-v22.22.
|
|
52
|
-
"node-v22.22.
|
|
53
|
-
"node-v22.22.
|
|
54
|
-
"node-v22.22.
|
|
55
|
-
"node-v22.22.
|
|
56
|
-
"node-v22.22.
|
|
57
|
-
"node-v24.
|
|
58
|
-
"node-v24.
|
|
59
|
-
"node-v24.
|
|
60
|
-
"node-v24.
|
|
61
|
-
"node-v24.
|
|
62
|
-
"node-v24.
|
|
63
|
-
"node-v24.
|
|
64
|
-
"node-v24.
|
|
65
|
-
"node-v24.
|
|
66
|
-
"node-v24.
|
|
46
|
+
"node-v22.22.3-alpine-arm64": "29f747d6c56bcd5ccbd0dfd033df31f226ac30deedb67186ec72cdbbe96d15cc",
|
|
47
|
+
"node-v22.22.3-alpine-x64": "a5b8a56c4ddbf5b3bdeb46706f7fe71d53d8ebbb3d19a6eb55177dffbc69323d",
|
|
48
|
+
"node-v22.22.3-linux-arm64": "c5ef71c46aeae4859f5e2338aa35a73261cc319f7f1f11893b4fe13494d040d6",
|
|
49
|
+
"node-v22.22.3-linux-x64": "8ac32aa38e6ed30372c20e7cac2d92f5d7e12c9053deebe5db94cca4228b3755",
|
|
50
|
+
"node-v22.22.3-linuxstatic-arm64": "ecda1a1ed432c753560cb1496ed6cb4e70863fc825c6ba1fa1cace34c15374cf",
|
|
51
|
+
"node-v22.22.3-linuxstatic-armv7": "6a00d7ddef6ad117389725b13255da63467dee2515b9ff56584cd9c4eb0cc3bd",
|
|
52
|
+
"node-v22.22.3-linuxstatic-x64": "53308c1386f92e15ffc6b0ab78f28b9490bc497f35346bbe8773b05acfc9911e",
|
|
53
|
+
"node-v22.22.3-macos-arm64": "d6a4a2d3fcb353bfd1d91a34751d1fff83bd3a8b987b7c891d959bca70d24237",
|
|
54
|
+
"node-v22.22.3-macos-x64": "112619345641eb70d895fa8ef99365a6819a8c6b96aaf8b6273d2ebeae5427cf",
|
|
55
|
+
"node-v22.22.3-win-arm64": "f2ef0a30dc796d40fb5c00afdeed1e6363c00e7d694dbb7119ae1b392a5e31fc",
|
|
56
|
+
"node-v22.22.3-win-x64": "3abbf32d427ea9ffcce92f8c9727daa02ab7e967c5e475ed22854a1bea8cdebb",
|
|
57
|
+
"node-v24.15.0-alpine-arm64": "43203ae081353c43cd5db4fc1ec240c90a7daa28edf3716c35a39057334f0330",
|
|
58
|
+
"node-v24.15.0-alpine-x64": "b80d375c2df76eb1c3b8046540a8c356556b18706178a05056764f34a0c1e8fd",
|
|
59
|
+
"node-v24.15.0-linux-arm64": "5099a5c5527f35f68538054386b495d747d01a6e05bf3d3a22f16edaac9a7bcb",
|
|
60
|
+
"node-v24.15.0-linux-x64": "b081411ee7a4e351368e687d95d8beeea8e8c09b27f28114592d4efcda1d6e3d",
|
|
61
|
+
"node-v24.15.0-linuxstatic-arm64": "7add1c3195a602e6bd0376df91c09b2db941ab5dda44ca662cf961eb6b27bf63",
|
|
62
|
+
"node-v24.15.0-linuxstatic-x64": "b09eab65ac2ee0bfdb1a5a9cbdfd4e6b55a851fc42fa9ae92272dfcf0b6eb7d7",
|
|
63
|
+
"node-v24.15.0-macos-arm64": "11bd187bac035582dc9a93995d434da5b953ee97be273ea90744158b9117e32a",
|
|
64
|
+
"node-v24.15.0-macos-x64": "5efe094a0444c88c165191948ee7a4866e56c79cd87a970cfafd5b93ca5d8eb7",
|
|
65
|
+
"node-v24.15.0-win-arm64": "b10c37ff4c4dc587913e49c2bc5d89e15b2ec3a23d759419dd6e69984f589f04",
|
|
66
|
+
"node-v24.15.0-win-x64": "1181784028a3319206ff5a6c2af17f78009432f0bd69325f0d0bfc128de770a8",
|
|
67
|
+
"node-v26.2.0-alpine-arm64": "8e92f5dcbedfc1300ac6d7b0b552237252d47fb9943f785e33da3f635df002aa",
|
|
68
|
+
"node-v26.2.0-alpine-x64": "fb5783ab21827ec1068b49c208d74f8b6f4b82d6f3d85f93924144688b9ac705",
|
|
69
|
+
"node-v26.2.0-linux-arm64": "462785abfbcd498deb74945e6f9d0575db610dc279d193d02a13b9c9ee1c31bb",
|
|
70
|
+
"node-v26.2.0-linux-x64": "bfa38eb20a8fc14d62fb4a3cef942de9e4e4490049771b227373d300b137e5cc",
|
|
71
|
+
"node-v26.2.0-linuxstatic-arm64": "a379ab3777825e58aee2e7e16bcf3d020e5029084d99145c00f3b129dadcc7ac",
|
|
72
|
+
"node-v26.2.0-linuxstatic-x64": "84d4f7ddcf6c9e7342e9a83b35237149570c14c9dc6f4f269bcdbd5d1606ac32",
|
|
73
|
+
"node-v26.2.0-macos-arm64": "251c29beb47324ece17d7f48090ad086a0e5cc47865335ea944d665f40dae6f3",
|
|
74
|
+
"node-v26.2.0-macos-x64": "5533c4247ebf44dff1e1e4934f907e6f9a423091334c4fc457e4325cd6129402",
|
|
75
|
+
"node-v26.2.0-win-arm64": "7ce4055e72df18d61df8bafc19f4d40d81199ff1b6281bd5363e069690799445",
|
|
76
|
+
"node-v26.2.0-win-x64": "5d6f5055b1531c26884ffce4663e4ffac4468ee0e07a079c233887b63e975943"
|
|
67
77
|
}
|
package/lib-es5/verify.js
CHANGED
|
@@ -58,8 +58,17 @@ const script = `
|
|
|
58
58
|
} else
|
|
59
59
|
if (modules === 115) {
|
|
60
60
|
// no cpu features anymore
|
|
61
|
+
} else
|
|
62
|
+
if (modules === 127) {
|
|
63
|
+
// no cpu features anymore
|
|
64
|
+
} else
|
|
65
|
+
if (modules === 137) {
|
|
66
|
+
// no cpu features anymore
|
|
67
|
+
} else
|
|
68
|
+
if (modules === 147) {
|
|
69
|
+
// no cpu features anymore
|
|
61
70
|
} else {
|
|
62
|
-
assert(false, modules);
|
|
71
|
+
assert(false, 'unknown node modules version: ' + modules);
|
|
63
72
|
}
|
|
64
73
|
|
|
65
74
|
if (modules >= 46 && // no cpu_features field in 0.12
|
|
@@ -97,8 +106,14 @@ const script = `
|
|
|
97
106
|
if (modules === 111) {
|
|
98
107
|
} else
|
|
99
108
|
if (modules === 115) {
|
|
109
|
+
} else
|
|
110
|
+
if (modules === 127) {
|
|
111
|
+
} else
|
|
112
|
+
if (modules === 137) {
|
|
113
|
+
} else
|
|
114
|
+
if (modules === 147) {
|
|
100
115
|
} else {
|
|
101
|
-
assert(false, modules);
|
|
116
|
+
assert(false, 'unknown node modules version: ' + modules);
|
|
102
117
|
}
|
|
103
118
|
|
|
104
119
|
var s4 = new vm.Script(text, { filename: 's4', produceCachedData: true });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yao-pkg/pkg-fetch",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.34",
|
|
4
4
|
"description": "Compiles and stores base binaries for pkg",
|
|
5
5
|
"main": "lib-es5/index.js",
|
|
6
6
|
"license": "MIT",
|
|
@@ -72,7 +72,8 @@
|
|
|
72
72
|
"*.{js,css,md}": "prettier --write"
|
|
73
73
|
},
|
|
74
74
|
"publishConfig": {
|
|
75
|
-
"access": "public"
|
|
75
|
+
"access": "public",
|
|
76
|
+
"provenance": true
|
|
76
77
|
},
|
|
77
78
|
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
|
|
78
79
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
diff --git node/common.gypi node/common.gypi
|
|
2
|
-
index
|
|
2
|
+
index 0ffa5b1371..6f04eb354f 100644
|
|
3
3
|
--- node/common.gypi
|
|
4
4
|
+++ node/common.gypi
|
|
5
5
|
@@ -192,7 +192,7 @@
|
|
@@ -119,10 +119,10 @@ index 9048655363..ab81c326fc 100644
|
|
|
119
119
|
} else if (can_consume_code_cache) {
|
|
120
120
|
compile_timer.set_consuming_code_cache();
|
|
121
121
|
diff --git node/deps/v8/src/compiler/wasm-compiler.cc node/deps/v8/src/compiler/wasm-compiler.cc
|
|
122
|
-
index
|
|
122
|
+
index bd3dd3b27b..dab870e776 100644
|
|
123
123
|
--- node/deps/v8/src/compiler/wasm-compiler.cc
|
|
124
124
|
+++ node/deps/v8/src/compiler/wasm-compiler.cc
|
|
125
|
-
@@ -
|
|
125
|
+
@@ -8618,12 +8618,13 @@ wasm::WasmCompilationResult CompileWasmImportCallWrapper(
|
|
126
126
|
'-');
|
|
127
127
|
|
|
128
128
|
auto compile_with_turboshaft = [&]() {
|
|
@@ -141,7 +141,7 @@ index 16f1f1470b..4bfeca49e6 100644
|
|
|
141
141
|
};
|
|
142
142
|
auto compile_with_turbofan = [&]() {
|
|
143
143
|
//--------------------------------------------------------------------------
|
|
144
|
-
@@ -
|
|
144
|
+
@@ -8779,13 +8780,15 @@ MaybeHandle<Code> CompileWasmToJSWrapper(Isolate* isolate,
|
|
145
145
|
base::VectorOf(name_buffer.get(), kMaxNameLen) + kNamePrefixLen, sig);
|
|
146
146
|
|
|
147
147
|
auto compile_with_turboshaft = [&]() {
|
|
@@ -349,10 +349,10 @@ index 0000000000..a697294fdf
|
|
|
349
349
|
+ }());
|
|
350
350
|
+}());
|
|
351
351
|
diff --git node/lib/internal/modules/cjs/loader.js node/lib/internal/modules/cjs/loader.js
|
|
352
|
-
index
|
|
352
|
+
index e70b465db8..265197441d 100644
|
|
353
353
|
--- node/lib/internal/modules/cjs/loader.js
|
|
354
354
|
+++ node/lib/internal/modules/cjs/loader.js
|
|
355
|
-
@@ -
|
|
355
|
+
@@ -265,14 +265,18 @@ function stat(filename) {
|
|
356
356
|
// Guard against internal bugs where a non-string filename is passed in by mistake.
|
|
357
357
|
assert(typeof filename === 'string');
|
|
358
358
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
diff --git node/common.gypi node/common.gypi
|
|
2
|
-
index
|
|
2
|
+
index 576d5057d9..34e85ee423 100644
|
|
3
3
|
--- node/common.gypi
|
|
4
4
|
+++ node/common.gypi
|
|
5
5
|
@@ -192,7 +192,7 @@
|
|
@@ -486,7 +486,7 @@ index 0000000000..a697294fdf
|
|
|
486
486
|
+ }());
|
|
487
487
|
+}());
|
|
488
488
|
diff --git node/lib/internal/modules/cjs/loader.js node/lib/internal/modules/cjs/loader.js
|
|
489
|
-
index
|
|
489
|
+
index df656b8601..a49a1025a4 100644
|
|
490
490
|
--- node/lib/internal/modules/cjs/loader.js
|
|
491
491
|
+++ node/lib/internal/modules/cjs/loader.js
|
|
492
492
|
@@ -267,12 +267,15 @@ function stat(filename) {
|
|
@@ -543,7 +543,7 @@ index 968c3c5701..1c7b01a3f2 100644
|
|
|
543
543
|
__proto__: null,
|
|
544
544
|
...result.data,
|
|
545
545
|
diff --git node/lib/internal/process/pre_execution.js node/lib/internal/process/pre_execution.js
|
|
546
|
-
index
|
|
546
|
+
index e9ab2b2a89..6c74e7cc64 100644
|
|
547
547
|
--- node/lib/internal/process/pre_execution.js
|
|
548
548
|
+++ node/lib/internal/process/pre_execution.js
|
|
549
549
|
@@ -42,7 +42,11 @@ const {
|
|
@@ -558,7 +558,7 @@ index 8ed8802adc..8152188eb7 100644
|
|
|
558
558
|
return prepareExecution({
|
|
559
559
|
expandArgv1,
|
|
560
560
|
initializeModules,
|
|
561
|
-
@@ -
|
|
561
|
+
@@ -279,7 +283,8 @@ function patchProcessObject(expandArgv1) {
|
|
562
562
|
let mainEntry;
|
|
563
563
|
// If requested, update process.argv[1] to replace whatever the user provided with the resolved absolute file path of
|
|
564
564
|
// the entry point.
|
|
@@ -568,7 +568,7 @@ index 8ed8802adc..8152188eb7 100644
|
|
|
568
568
|
// Expand process.argv[1] into a full path.
|
|
569
569
|
const path = require('path');
|
|
570
570
|
try {
|
|
571
|
-
@@ -
|
|
571
|
+
@@ -703,6 +708,7 @@ function loadPreloadModules() {
|
|
572
572
|
// For user code, we preload modules if `-r` is passed
|
|
573
573
|
const preloadModules = getOptionValue('--require');
|
|
574
574
|
if (preloadModules && preloadModules.length > 0) {
|
|
@@ -643,18 +643,18 @@ index 0bc086ccd1..9a76ce03cc 100644
|
|
|
643
643
|
}
|
|
644
644
|
|
|
645
645
|
diff --git node/src/node_contextify.cc node/src/node_contextify.cc
|
|
646
|
-
index
|
|
646
|
+
index d3568da72a..e01d00067a 100644
|
|
647
647
|
--- node/src/node_contextify.cc
|
|
648
648
|
+++ node/src/node_contextify.cc
|
|
649
|
-
@@ -
|
|
650
|
-
using v8::
|
|
649
|
+
@@ -87,6 +87,7 @@ using v8::String;
|
|
650
|
+
using v8::Symbol;
|
|
651
651
|
using v8::UnboundScript;
|
|
652
652
|
using v8::Value;
|
|
653
653
|
+using v8::V8;
|
|
654
654
|
|
|
655
655
|
// The vm module executes code in a sandboxed environment with a different
|
|
656
656
|
// global object than the rest of the code. This is achieved by applying
|
|
657
|
-
@@ -
|
|
657
|
+
@@ -970,13 +971,13 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
|
|
658
658
|
Local<ArrayBufferView> cached_data_buf;
|
|
659
659
|
bool produce_cached_data = false;
|
|
660
660
|
Local<Context> parsing_context = context;
|
|
@@ -671,7 +671,7 @@ index 3c234205e8..5d2152be2e 100644
|
|
|
671
671
|
CHECK(args[2]->IsNumber());
|
|
672
672
|
line_offset = args[2].As<Int32>()->Value();
|
|
673
673
|
CHECK(args[3]->IsNumber());
|
|
674
|
-
@@ -
|
|
674
|
+
@@ -997,6 +998,11 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
|
|
675
675
|
}
|
|
676
676
|
CHECK(args[7]->IsSymbol());
|
|
677
677
|
id_symbol = args[7].As<Symbol>();
|
|
@@ -683,7 +683,7 @@ index 3c234205e8..5d2152be2e 100644
|
|
|
683
683
|
}
|
|
684
684
|
|
|
685
685
|
ContextifyScript* contextify_script = New(env, args.This());
|
|
686
|
-
@@ -
|
|
686
|
+
@@ -1043,6 +1049,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
|
|
687
687
|
ShouldNotAbortOnUncaughtScope no_abort_scope(env);
|
|
688
688
|
Context::Scope scope(parsing_context);
|
|
689
689
|
|
|
@@ -694,7 +694,7 @@ index 3c234205e8..5d2152be2e 100644
|
|
|
694
694
|
MaybeLocal<UnboundScript> maybe_v8_script =
|
|
695
695
|
ScriptCompiler::CompileUnboundScript(isolate, &source, compile_options);
|
|
696
696
|
|
|
697
|
-
@@ -
|
|
697
|
+
@@ -1057,6 +1067,12 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
|
|
698
698
|
return;
|
|
699
699
|
}
|
|
700
700
|
|
|
@@ -707,7 +707,7 @@ index 3c234205e8..5d2152be2e 100644
|
|
|
707
707
|
contextify_script->set_unbound_script(v8_script);
|
|
708
708
|
|
|
709
709
|
std::unique_ptr<ScriptCompiler::CachedData> new_cached_data;
|
|
710
|
-
@@ -
|
|
710
|
+
@@ -1069,7 +1085,7 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
|
|
711
711
|
if (contextify_script->object()
|
|
712
712
|
->SetPrivate(context, env->host_defined_option_symbol(), id_symbol)
|
|
713
713
|
.IsNothing()) {
|
|
@@ -716,7 +716,7 @@ index 3c234205e8..5d2152be2e 100644
|
|
|
716
716
|
}
|
|
717
717
|
if (StoreCodeCacheResult(env,
|
|
718
718
|
self,
|
|
719
|
-
@@ -
|
|
719
|
+
@@ -1080,6 +1096,9 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
|
|
720
720
|
.IsNothing()) {
|
|
721
721
|
return;
|
|
722
722
|
}
|
|
@@ -837,7 +837,7 @@ index 3295121b87..bfe838b8c1 100644
|
|
|
837
837
|
+ return adjacent(c, nargv);
|
|
838
838
|
+}
|
|
839
839
|
diff --git node/src/node_options.cc node/src/node_options.cc
|
|
840
|
-
index
|
|
840
|
+
index 79d7c8cac0..11e2a8a746 100644
|
|
841
841
|
--- node/src/node_options.cc
|
|
842
842
|
+++ node/src/node_options.cc
|
|
843
843
|
@@ -430,6 +430,7 @@ void Parse(
|
|
@@ -0,0 +1,809 @@
|
|
|
1
|
+
diff --git node/deps/v8/include/v8-initialization.h node/deps/v8/include/v8-initialization.h
|
|
2
|
+
index 406f1d0ba5..fb8eea420d 100644
|
|
3
|
+
--- node/deps/v8/include/v8-initialization.h
|
|
4
|
+
+++ node/deps/v8/include/v8-initialization.h
|
|
5
|
+
@@ -98,6 +98,10 @@ class V8_EXPORT V8 {
|
|
6
|
+
static void SetFlagsFromCommandLine(int* argc, char** argv,
|
|
7
|
+
bool remove_flags);
|
|
8
|
+
|
|
9
|
+
+ static void EnableCompilationForSourcelessUse();
|
|
10
|
+
+ static void DisableCompilationForSourcelessUse();
|
|
11
|
+
+ static void FixSourcelessScript(Isolate* v8_isolate, Local<UnboundScript> script);
|
|
12
|
+
+
|
|
13
|
+
/** Get the version string. */
|
|
14
|
+
static const char* GetVersion();
|
|
15
|
+
|
|
16
|
+
diff --git node/deps/v8/src/api/api.cc node/deps/v8/src/api/api.cc
|
|
17
|
+
index 9ef4e3b4a6..34cabe171c 100644
|
|
18
|
+
--- node/deps/v8/src/api/api.cc
|
|
19
|
+
+++ node/deps/v8/src/api/api.cc
|
|
20
|
+
@@ -469,6 +469,28 @@ void V8::SetFlagsFromCommandLine(int* argc, char** argv, bool remove_flags) {
|
|
21
|
+
HelpOptions(HelpOptions::kDontExit));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
+bool save_lazy;
|
|
25
|
+
+bool save_predictable;
|
|
26
|
+
+
|
|
27
|
+
+void V8::EnableCompilationForSourcelessUse() {
|
|
28
|
+
+ save_lazy = i::v8_flags.lazy;
|
|
29
|
+
+ i::v8_flags.lazy = false;
|
|
30
|
+
+ save_predictable = i::v8_flags.predictable;
|
|
31
|
+
+ i::v8_flags.predictable = true;
|
|
32
|
+
+}
|
|
33
|
+
+
|
|
34
|
+
+void V8::DisableCompilationForSourcelessUse() {
|
|
35
|
+
+ i::v8_flags.lazy = save_lazy;
|
|
36
|
+
+ i::v8_flags.predictable = save_predictable;
|
|
37
|
+
+}
|
|
38
|
+
+
|
|
39
|
+
+void V8::FixSourcelessScript(Isolate* v8_isolate, Local<UnboundScript> unbound_script) {
|
|
40
|
+
+ auto isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
|
|
41
|
+
+ auto function_info = i::Cast<i::SharedFunctionInfo>(Utils::OpenHandle(*unbound_script));
|
|
42
|
+
+ i::Handle<i::Script> script(i::Cast<i::Script>(function_info->script()), isolate);
|
|
43
|
+
+ script->SetSource(isolate, script, isolate->factory()->empty_string());
|
|
44
|
+
+}
|
|
45
|
+
+
|
|
46
|
+
RegisteredExtension* RegisteredExtension::first_extension_ = nullptr;
|
|
47
|
+
|
|
48
|
+
RegisteredExtension::RegisteredExtension(std::unique_ptr<Extension> extension)
|
|
49
|
+
diff --git node/deps/v8/src/codegen/compiler.cc node/deps/v8/src/codegen/compiler.cc
|
|
50
|
+
index 2dc782458e..0cddfbbbc4 100644
|
|
51
|
+
--- node/deps/v8/src/codegen/compiler.cc
|
|
52
|
+
+++ node/deps/v8/src/codegen/compiler.cc
|
|
53
|
+
@@ -3988,7 +3988,7 @@ MaybeDirectHandle<SharedFunctionInfo> GetSharedFunctionInfoForScriptImpl(
|
|
54
|
+
maybe_script = lookup_result.script();
|
|
55
|
+
maybe_result = lookup_result.toplevel_sfi();
|
|
56
|
+
is_compiled_scope = lookup_result.is_compiled_scope();
|
|
57
|
+
- if (!maybe_result.is_null()) {
|
|
58
|
+
+ if (!maybe_result.is_null() && source->length()) {
|
|
59
|
+
compile_timer.set_hit_isolate_cache();
|
|
60
|
+
} else if (can_consume_code_cache) {
|
|
61
|
+
compile_timer.set_consuming_code_cache();
|
|
62
|
+
diff --git node/deps/v8/src/compiler/wasm-compiler.cc node/deps/v8/src/compiler/wasm-compiler.cc
|
|
63
|
+
index 632d54de8c..cbf91f9d6c 100644
|
|
64
|
+
--- node/deps/v8/src/compiler/wasm-compiler.cc
|
|
65
|
+
+++ node/deps/v8/src/compiler/wasm-compiler.cc
|
|
66
|
+
@@ -1090,11 +1090,15 @@ wasm::WasmCompilationResult CompileWasmImportCallWrapper(
|
|
67
|
+
"wasm-to-js-%d-", static_cast<int>(kind));
|
|
68
|
+
PrintSignature(base::VectorOf(func_name, kMaxNameLen) + name_prefix_len, sig,
|
|
69
|
+
'-');
|
|
70
|
+
+ wasm::WrapperCompilationInfo info;
|
|
71
|
+
+ info.code_kind = CodeKind::WASM_TO_JS_FUNCTION;
|
|
72
|
+
+ info.import_kind = kind;
|
|
73
|
+
+ info.expected_arity = expected_arity;
|
|
74
|
+
+ info.suspend = suspend;
|
|
75
|
+
|
|
76
|
+
auto result = Pipeline::GenerateCodeForWasmNativeStubFromTurboshaft(
|
|
77
|
+
sig,
|
|
78
|
+
- wasm::WrapperCompilationInfo{CodeKind::WASM_TO_JS_FUNCTION, kind,
|
|
79
|
+
- expected_arity, suspend},
|
|
80
|
+
+ info,
|
|
81
|
+
func_name, WasmStubAssemblerOptions());
|
|
82
|
+
|
|
83
|
+
if (V8_UNLIKELY(v8_flags.trace_wasm_compilation_times)) {
|
|
84
|
+
diff --git node/deps/v8/src/heap/marking-visitor-inl.h node/deps/v8/src/heap/marking-visitor-inl.h
|
|
85
|
+
index 8ac9d6d49b..7a241f2de7 100644
|
|
86
|
+
--- node/deps/v8/src/heap/marking-visitor-inl.h
|
|
87
|
+
+++ node/deps/v8/src/heap/marking-visitor-inl.h
|
|
88
|
+
@@ -517,6 +517,13 @@ bool MarkingVisitorBase<ConcreteVisitor>::HasBytecodeArrayForFlushing(
|
|
89
|
+
template <typename ConcreteVisitor>
|
|
90
|
+
bool MarkingVisitorBase<ConcreteVisitor>::ShouldFlushCode(
|
|
91
|
+
Tagged<SharedFunctionInfo> sfi) const {
|
|
92
|
+
+ auto script_obj = sfi->script();
|
|
93
|
+
+ if (!IsUndefined(script_obj)) {
|
|
94
|
+
+ auto script = Cast<Script>(script_obj);
|
|
95
|
+
+ if (IsUndefined(script->source())) {
|
|
96
|
+
+ return false;
|
|
97
|
+
+ }
|
|
98
|
+
+ }
|
|
99
|
+
// This method is used both for flushing bytecode and baseline code.
|
|
100
|
+
// During last resort GCs and stress testing we consider all code old.
|
|
101
|
+
return IsOld(sfi) || V8_UNLIKELY(IsForceFlushingEnabled(code_flush_mode_));
|
|
102
|
+
diff --git node/deps/v8/src/objects/js-function.cc node/deps/v8/src/objects/js-function.cc
|
|
103
|
+
index a44e3fd6c0..e220a5bc0f 100644
|
|
104
|
+
--- node/deps/v8/src/objects/js-function.cc
|
|
105
|
+
+++ node/deps/v8/src/objects/js-function.cc
|
|
106
|
+
@@ -1417,6 +1417,9 @@ DirectHandle<String> JSFunction::ToString(Isolate* isolate,
|
|
107
|
+
DirectHandle<Object> maybe_class_positions = JSReceiver::GetDataProperty(
|
|
108
|
+
isolate, function, isolate->factory()->class_positions_symbol());
|
|
109
|
+
if (IsClassPositions(*maybe_class_positions)) {
|
|
110
|
+
+ if (IsUndefined(Cast<String>(Cast<Script>(shared_info->script())->source()))) {
|
|
111
|
+
+ return isolate->factory()->NewStringFromAsciiChecked("class {}");
|
|
112
|
+
+ }
|
|
113
|
+
Tagged<ClassPositions> class_positions =
|
|
114
|
+
Cast<ClassPositions>(*maybe_class_positions);
|
|
115
|
+
int start_position = class_positions->start();
|
|
116
|
+
diff --git node/deps/v8/src/objects/script.cc node/deps/v8/src/objects/script.cc
|
|
117
|
+
index a2078b538c..1468ece463 100644
|
|
118
|
+
--- node/deps/v8/src/objects/script.cc
|
|
119
|
+
+++ node/deps/v8/src/objects/script.cc
|
|
120
|
+
@@ -118,7 +118,11 @@ void Script::InitLineEndsInternal(IsolateT* isolate,
|
|
121
|
+
|
|
122
|
+
void Script::SetSource(Isolate* isolate, DirectHandle<Script> script,
|
|
123
|
+
DirectHandle<String> source) {
|
|
124
|
+
- script->set_source(*source);
|
|
125
|
+
+ if (source->length() > 0) {
|
|
126
|
+
+ script->set_source(*source);
|
|
127
|
+
+ } else {
|
|
128
|
+
+ script->set_source(*isolate->factory()->undefined_value());
|
|
129
|
+
+ }
|
|
130
|
+
if (isolate->NeedsSourcePositions()) {
|
|
131
|
+
InitLineEnds(isolate, script);
|
|
132
|
+
} else if (script->line_ends() ==
|
|
133
|
+
diff --git node/deps/v8/src/parsing/parsing.cc node/deps/v8/src/parsing/parsing.cc
|
|
134
|
+
index 31758fdfed..483192fc35 100644
|
|
135
|
+
--- node/deps/v8/src/parsing/parsing.cc
|
|
136
|
+
+++ node/deps/v8/src/parsing/parsing.cc
|
|
137
|
+
@@ -42,6 +42,7 @@ bool ParseProgram(ParseInfo* info, DirectHandle<Script> script,
|
|
138
|
+
DCHECK(info->flags().is_toplevel());
|
|
139
|
+
DCHECK_NULL(info->literal());
|
|
140
|
+
|
|
141
|
+
+ if (IsUndefined(Cast<String>(script->source()))) return false;
|
|
142
|
+
VMState<PARSER> state(isolate);
|
|
143
|
+
|
|
144
|
+
// Create a character stream for the parser.
|
|
145
|
+
@@ -75,6 +76,8 @@ bool ParseFunction(ParseInfo* info,
|
|
146
|
+
|
|
147
|
+
// Create a character stream for the parser.
|
|
148
|
+
DirectHandle<Script> script(Cast<Script>(shared_info->script()), isolate);
|
|
149
|
+
+ if (IsUndefined(Cast<String>(script->source()))) return false;
|
|
150
|
+
+
|
|
151
|
+
Handle<String> source(Cast<String>(script->source()), isolate);
|
|
152
|
+
uint32_t start_pos = shared_info->StartPosition();
|
|
153
|
+
uint32_t end_pos = shared_info->EndPosition();
|
|
154
|
+
diff --git node/deps/v8/src/snapshot/code-serializer.cc node/deps/v8/src/snapshot/code-serializer.cc
|
|
155
|
+
index 6149ee8f1d..133659e328 100644
|
|
156
|
+
--- node/deps/v8/src/snapshot/code-serializer.cc
|
|
157
|
+
+++ node/deps/v8/src/snapshot/code-serializer.cc
|
|
158
|
+
@@ -776,10 +776,6 @@ SerializedCodeSanityCheckResult SerializedCodeData::SanityCheck(
|
|
159
|
+
|
|
160
|
+
SerializedCodeSanityCheckResult SerializedCodeData::SanityCheckJustSource(
|
|
161
|
+
uint32_t expected_source_hash) const {
|
|
162
|
+
- uint32_t source_hash = GetHeaderValue(kSourceHashOffset);
|
|
163
|
+
- if (source_hash != expected_source_hash) {
|
|
164
|
+
- return SerializedCodeSanityCheckResult::kSourceMismatch;
|
|
165
|
+
- }
|
|
166
|
+
return SerializedCodeSanityCheckResult::kSuccess;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
@@ -796,13 +792,12 @@ SerializedCodeSanityCheckResult SerializedCodeData::SanityCheckWithoutSource(
|
|
170
|
+
if (version_hash != Version::Hash()) {
|
|
171
|
+
return SerializedCodeSanityCheckResult::kVersionMismatch;
|
|
172
|
+
}
|
|
173
|
+
- uint32_t flags_hash = GetHeaderValue(kFlagHashOffset);
|
|
174
|
+
- if (flags_hash != FlagList::Hash()) {
|
|
175
|
+
- return SerializedCodeSanityCheckResult::kFlagsMismatch;
|
|
176
|
+
- }
|
|
177
|
+
uint32_t ro_snapshot_checksum =
|
|
178
|
+
GetHeaderValue(kReadOnlySnapshotChecksumOffset);
|
|
179
|
+
if (ro_snapshot_checksum != expected_ro_snapshot_checksum) {
|
|
180
|
+
+ // for debugging snapshot checkum issues
|
|
181
|
+
+ // PrintF("[pkg] ReadOnlySnapshotChecksum mismatch: code=%08x built=%08x\n",
|
|
182
|
+
+ // ro_snapshot_checksum, expected_ro_snapshot_checksum);
|
|
183
|
+
return SerializedCodeSanityCheckResult::kReadOnlySnapshotChecksumMismatch;
|
|
184
|
+
}
|
|
185
|
+
uint32_t payload_length = GetHeaderValue(kPayloadLengthOffset);
|
|
186
|
+
diff --git node/deps/v8/src/snapshot/read-only-serializer.cc node/deps/v8/src/snapshot/read-only-serializer.cc
|
|
187
|
+
index 6732808e85..ebb7938f64 100644
|
|
188
|
+
--- node/deps/v8/src/snapshot/read-only-serializer.cc
|
|
189
|
+
+++ node/deps/v8/src/snapshot/read-only-serializer.cc
|
|
190
|
+
@@ -14,6 +14,9 @@
|
|
191
|
+
#include "src/objects/slots.h"
|
|
192
|
+
#include "src/snapshot/read-only-serializer-deserializer.h"
|
|
193
|
+
|
|
194
|
+
+// for debugging readonly heap serialization
|
|
195
|
+
+// #define PKG_TRACE_READONLY_HEAP 1
|
|
196
|
+
+
|
|
197
|
+
namespace v8 {
|
|
198
|
+
namespace internal {
|
|
199
|
+
|
|
200
|
+
@@ -226,6 +229,10 @@ ro::EncodedTagged Encode(Isolate* isolate, Tagged<HeapObject> o) {
|
|
201
|
+
uint32_t offset = static_cast<int>(chunk->Offset(o_address));
|
|
202
|
+
DCHECK(IsAligned(offset, kTaggedSize));
|
|
203
|
+
|
|
204
|
+
+ #ifdef PKG_TRACE_READONLY_HEAP
|
|
205
|
+
+ PrintF(" [PKGTRACE] encode tagged page_index=%d offset=%u offidx=%u\n",
|
|
206
|
+
+ index, offset, offset / kTaggedSize);
|
|
207
|
+
+ #endif
|
|
208
|
+
return ro::EncodedTagged(index, offset / kTaggedSize);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
@@ -325,6 +332,11 @@ class EncodeRelocationsVisitor final : public ObjectVisitor {
|
|
212
|
+
|
|
213
|
+
// Encode:
|
|
214
|
+
ro::EncodedTagged encoded = Encode(isolate_, o.GetHeapObject());
|
|
215
|
+
+
|
|
216
|
+
+ #ifndef V8_COMPRESS_POINTERS
|
|
217
|
+
+ memset(segment_->contents.get() + slot_offset, 0, kTaggedSize);
|
|
218
|
+
+ #endif
|
|
219
|
+
+
|
|
220
|
+
memcpy(segment_->contents.get() + slot_offset, &encoded,
|
|
221
|
+
ro::EncodedTagged::kSize);
|
|
222
|
+
|
|
223
|
+
@@ -357,8 +369,18 @@ void ReadOnlySegmentForSerialization::EncodeTaggedSlots(Isolate* isolate) {
|
|
224
|
+
const Address segment_end = segment_start + segment_size;
|
|
225
|
+
ReadOnlyPageObjectIterator it(page, segment_start,
|
|
226
|
+
SkipFreeSpaceOrFiller::kNo);
|
|
227
|
+
+
|
|
228
|
+
+ #ifdef PKG_TRACE_READONLY_HEAP
|
|
229
|
+
+ uint32_t counter = 0;
|
|
230
|
+
+ #endif
|
|
231
|
+
+
|
|
232
|
+
for (Tagged<HeapObject> o = it.Next(); !o.is_null(); o = it.Next()) {
|
|
233
|
+
if (o.address() >= segment_end) break;
|
|
234
|
+
+ #ifdef PKG_TRACE_READONLY_HEAP
|
|
235
|
+
+ Tagged<Map> map = o->map(isolate);
|
|
236
|
+
+ PrintF(" [PKGTRACE] tag heapobj i=%d so=%zu s=%d t=%d\n",
|
|
237
|
+
+ counter++, o.address()-segment_start, o->Size(), map->instance_type());
|
|
238
|
+
+ #endif
|
|
239
|
+
VisitObject(isolate, o, &v);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
@@ -384,7 +406,14 @@ class ReadOnlyHeapImageSerializer {
|
|
243
|
+
DCHECK_EQ(sink_->Position(), 0);
|
|
244
|
+
|
|
245
|
+
ReadOnlySpace* ro_space = isolate_->read_only_heap()->read_only_space();
|
|
246
|
+
-
|
|
247
|
+
+ #ifdef PKG_TRACE_READONLY_HEAP
|
|
248
|
+
+ #ifdef V8_COMPRESS_POINTERS
|
|
249
|
+
+ bool pce = true;
|
|
250
|
+
+ #else
|
|
251
|
+
+ bool pce = false;
|
|
252
|
+
+ #endif
|
|
253
|
+
+ PrintF("[PKGTRACE] BEGIN SERIALIZE READONLY ro_space=%p pce=%d\n", ro_space, pce);
|
|
254
|
+
+ #endif
|
|
255
|
+
// Allocate all pages first s.t. the deserializer can easily handle forward
|
|
256
|
+
// references (e.g.: an object on page i points at an object on page i+1).
|
|
257
|
+
for (const ReadOnlyPage* page : ro_space->pages()) {
|
|
258
|
+
@@ -399,6 +428,10 @@ class ReadOnlyHeapImageSerializer {
|
|
259
|
+
EmitReadOnlyRootsTable();
|
|
260
|
+
sink_->Put(Bytecode::kFinalizeReadOnlySpace, "space end");
|
|
261
|
+
sink_->PutUint30(isolate_->next_unique_sfi_id(), "shared function info ID");
|
|
262
|
+
+
|
|
263
|
+
+ #ifdef PKG_TRACE_READONLY_HEAP
|
|
264
|
+
+ PrintF("[PKGTRACE] END SERIALIZE READONLY\n");
|
|
265
|
+
+ #endif
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
uint32_t IndexOf(const ReadOnlyPage* page) {
|
|
269
|
+
@@ -416,6 +449,13 @@ class ReadOnlyHeapImageSerializer {
|
|
270
|
+
sink_->PutUint30(
|
|
271
|
+
static_cast<uint32_t>(page->HighWaterMark() - page->area_start()),
|
|
272
|
+
"area size in bytes");
|
|
273
|
+
+ #ifdef PKG_TRACE_READONLY_HEAP
|
|
274
|
+
+ PrintF("[PKGTRACE] emit allocate page area_ro_space_off=%zu area_start=%lx idx=%d size=%d \n",
|
|
275
|
+
+ ((uint8_t*)(page->area_start()))-((uint8_t*)(isolate_->read_only_heap()->read_only_space())),
|
|
276
|
+
+ page->area_start(),
|
|
277
|
+
+ IndexOf(page),
|
|
278
|
+
+ static_cast<uint32_t>(page->HighWaterMark() - page->area_start()));
|
|
279
|
+
+ #endif
|
|
280
|
+
if (V8_STATIC_ROOTS_BOOL) {
|
|
281
|
+
auto page_addr = page->ChunkAddress();
|
|
282
|
+
sink_->PutUint32(V8HeapCompressionScheme::CompressAny(page_addr),
|
|
283
|
+
@@ -447,6 +487,9 @@ class ReadOnlyHeapImageSerializer {
|
|
284
|
+
|
|
285
|
+
void SerializePage(const ReadOnlyPage* page) {
|
|
286
|
+
Address pos = page->area_start();
|
|
287
|
+
+ #ifdef PKG_TRACE_READONLY_HEAP
|
|
288
|
+
+ PrintF("[PKGTRACE] serialize page addr=%lx\n", page->area_start());
|
|
289
|
+
+ #endif
|
|
290
|
+
if (v8_flags.trace_serializer) {
|
|
291
|
+
PrintF("[ro serializer] Serializing page %p -> %p\n",
|
|
292
|
+
reinterpret_cast<char*>(page->area_start()),
|
|
293
|
+
@@ -479,6 +522,9 @@ class ReadOnlyHeapImageSerializer {
|
|
294
|
+
isolate_, page, pos, segment_size, &pre_processor_);
|
|
295
|
+
EmitSegment(&segment);
|
|
296
|
+
}
|
|
297
|
+
+ #ifdef PKG_TRACE_READONLY_HEAP
|
|
298
|
+
+ PrintF("[PKGTRACE] last segment\n");
|
|
299
|
+
+ #endif
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
@@ -511,6 +557,11 @@ class ReadOnlyHeapImageSerializer {
|
|
304
|
+
|
|
305
|
+
void EmitSegment(const ReadOnlySegmentForSerialization* segment) {
|
|
306
|
+
if (segment->segment_size == 0) return;
|
|
307
|
+
+ #ifdef PKG_TRACE_READONLY_HEAP
|
|
308
|
+
+ PrintF(" [PKGTRACE] segment segment_start=%lx page_index=%d offset=%zu size=%zu tagged_slots=%zu\n",
|
|
309
|
+
+ segment->segment_start, IndexOf(segment->page), segment->segment_offset,
|
|
310
|
+
+ segment->segment_size, segment->tagged_slots.size_in_bytes());
|
|
311
|
+
+ #endif
|
|
312
|
+
if (v8_flags.trace_serializer) {
|
|
313
|
+
PrintF("[ro serializer] * Serializing segment %p -> %p\n",
|
|
314
|
+
reinterpret_cast<char*>(segment->segment_start),
|
|
315
|
+
@@ -525,11 +576,29 @@ class ReadOnlyHeapImageSerializer {
|
|
316
|
+
"segment byte size");
|
|
317
|
+
sink_->PutRaw(segment->contents.get(),
|
|
318
|
+
static_cast<int>(segment->segment_size), "page");
|
|
319
|
+
+ #ifdef PKG_TRACE_READONLY_HEAP
|
|
320
|
+
+ PrintF(" [PKGTRACE] segment_contents: ");
|
|
321
|
+
+ const uint8_t* cdata = reinterpret_cast<const uint8_t*>(segment->contents.get());
|
|
322
|
+
+ for (size_t i = 0; i < segment->segment_size; i++) {
|
|
323
|
+
+ if (i%128==0) {PrintF("\n [PKGTRACE] ");}
|
|
324
|
+
+ PrintF("%02x", cdata[i]);
|
|
325
|
+
+ }
|
|
326
|
+
+ PrintF("\n");
|
|
327
|
+
+ #endif
|
|
328
|
+
if (!V8_STATIC_ROOTS_BOOL) {
|
|
329
|
+
sink_->Put(Bytecode::kRelocateSegment, "relocate segment");
|
|
330
|
+
sink_->PutRaw(segment->tagged_slots.data(),
|
|
331
|
+
static_cast<int>(segment->tagged_slots.size_in_bytes()),
|
|
332
|
+
"tagged_slots");
|
|
333
|
+
+ #ifdef PKG_TRACE_READONLY_HEAP
|
|
334
|
+
+ PrintF(" [PKGTRACE] tagged_slots: ");
|
|
335
|
+
+ const uint8_t* tdata = segment->tagged_slots.data();
|
|
336
|
+
+ for (size_t i = 0; i < segment->tagged_slots.size_in_bytes(); i++) {
|
|
337
|
+
+ if (i%128==0) {PrintF("\n [PKGTRACE] ");}
|
|
338
|
+
+ PrintF("%02x", tdata[i]);
|
|
339
|
+
+ }
|
|
340
|
+
+ PrintF("\n");
|
|
341
|
+
+ #endif
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
@@ -537,11 +606,20 @@ class ReadOnlyHeapImageSerializer {
|
|
346
|
+
sink_->Put(Bytecode::kReadOnlyRootsTable, "read only roots table");
|
|
347
|
+
if (!V8_STATIC_ROOTS_BOOL) {
|
|
348
|
+
ReadOnlyRoots roots(isolate_);
|
|
349
|
+
+ #ifdef PKG_TRACE_READONLY_HEAP
|
|
350
|
+
+ PrintF("[PKGTRACE] readonly roots %lu\n", ReadOnlyRoots::kEntriesCount);
|
|
351
|
+
+ #endif
|
|
352
|
+
for (size_t i = 0; i < ReadOnlyRoots::kEntriesCount; i++) {
|
|
353
|
+
RootIndex rudi = static_cast<RootIndex>(i);
|
|
354
|
+
Tagged<HeapObject> rudolf = Cast<HeapObject>(roots.object_at(rudi));
|
|
355
|
+
ro::EncodedTagged encoded = Encode(isolate_, rudolf);
|
|
356
|
+
sink_->PutUint32(encoded.ToUint32(), "read only roots entry");
|
|
357
|
+
+ #ifdef PKG_TRACE_READONLY_HEAP
|
|
358
|
+
+ Tagged<Map> map = rudolf->map(isolate_);
|
|
359
|
+
+ InstanceType instance_type = map->instance_type();
|
|
360
|
+
+ PrintF(" [PKGTRACE] readonly root i=%zu e=%x s=%d t=%d\n",
|
|
361
|
+
+ i, encoded.ToUint32(), rudolf->Size(), instance_type);
|
|
362
|
+
+ #endif
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
diff --git node/lib/child_process.js node/lib/child_process.js
|
|
367
|
+
index 824af65556..8393ee812f 100644
|
|
368
|
+
--- node/lib/child_process.js
|
|
369
|
+
+++ node/lib/child_process.js
|
|
370
|
+
@@ -171,7 +171,7 @@ function fork(modulePath, args = [], options) {
|
|
371
|
+
throw new ERR_CHILD_PROCESS_IPC_REQUIRED('options.stdio');
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
- return spawn(options.execPath, args, options);
|
|
375
|
+
+ return module.exports.spawn(options.execPath, args, options);
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
function _forkChild(fd, serializationMode) {
|
|
379
|
+
diff --git node/lib/internal/bootstrap/pkg.js node/lib/internal/bootstrap/pkg.js
|
|
380
|
+
new file mode 100644
|
|
381
|
+
index 0000000000..a697294fdf
|
|
382
|
+
--- /dev/null
|
|
383
|
+
+++ node/lib/internal/bootstrap/pkg.js
|
|
384
|
+
@@ -0,0 +1,49 @@
|
|
385
|
+
+'use strict';
|
|
386
|
+
+
|
|
387
|
+
+const {
|
|
388
|
+
+ prepareWorkerThreadExecution,
|
|
389
|
+
+ prepareMainThreadExecution
|
|
390
|
+
+} = require('internal/process/pre_execution');
|
|
391
|
+
+
|
|
392
|
+
+if (internalBinding('worker').isMainThread) {
|
|
393
|
+
+ prepareMainThreadExecution(true);
|
|
394
|
+
+} else {
|
|
395
|
+
+ prepareWorkerThreadExecution();
|
|
396
|
+
+}
|
|
397
|
+
+
|
|
398
|
+
+(function () {
|
|
399
|
+
+ var __require__ = require;
|
|
400
|
+
+ var fs = __require__('fs');
|
|
401
|
+
+ var vm = __require__('vm');
|
|
402
|
+
+ function readPrelude (fd) {
|
|
403
|
+
+ var PAYLOAD_POSITION = '// PAYLOAD_POSITION //' | 0;
|
|
404
|
+
+ var PAYLOAD_SIZE = '// PAYLOAD_SIZE //' | 0;
|
|
405
|
+
+ var PRELUDE_POSITION = '// PRELUDE_POSITION //' | 0;
|
|
406
|
+
+ var PRELUDE_SIZE = '// PRELUDE_SIZE //' | 0;
|
|
407
|
+
+ if (!PRELUDE_POSITION) {
|
|
408
|
+
+ // no prelude - remove entrypoint from argv[1]
|
|
409
|
+
+ process.argv.splice(1, 1);
|
|
410
|
+
+ return { undoPatch: true };
|
|
411
|
+
+ }
|
|
412
|
+
+ var prelude = Buffer.alloc(PRELUDE_SIZE);
|
|
413
|
+
+ var read = fs.readSync(fd, prelude, 0, PRELUDE_SIZE, PRELUDE_POSITION);
|
|
414
|
+
+ if (read !== PRELUDE_SIZE) {
|
|
415
|
+
+ console.error('Pkg: Error reading from file.');
|
|
416
|
+
+ process.exit(1);
|
|
417
|
+
+ }
|
|
418
|
+
+ var s = new vm.Script(prelude, { filename: 'pkg/prelude/bootstrap.js' });
|
|
419
|
+
+ var fn = s.runInThisContext();
|
|
420
|
+
+ return fn(process, __require__,
|
|
421
|
+
+ console, fd, PAYLOAD_POSITION, PAYLOAD_SIZE);
|
|
422
|
+
+ }
|
|
423
|
+
+ (function () {
|
|
424
|
+
+ var fd = fs.openSync(process.execPath, 'r');
|
|
425
|
+
+ var result = readPrelude(fd);
|
|
426
|
+
+ if (result && result.undoPatch) {
|
|
427
|
+
+ var bindingFs = process.binding('fs');
|
|
428
|
+
+ fs.internalModuleStat = bindingFs.internalModuleStat;
|
|
429
|
+
+ fs.internalModuleReadJSON = bindingFs.internalModuleReadJSON;
|
|
430
|
+
+ fs.closeSync(fd);
|
|
431
|
+
+ }
|
|
432
|
+
+ }());
|
|
433
|
+
+}());
|
|
434
|
+
diff --git node/lib/internal/modules/cjs/loader.js node/lib/internal/modules/cjs/loader.js
|
|
435
|
+
index 65a35299eb..025eb1c92f 100644
|
|
436
|
+
--- node/lib/internal/modules/cjs/loader.js
|
|
437
|
+
+++ node/lib/internal/modules/cjs/loader.js
|
|
438
|
+
@@ -267,12 +267,15 @@ function stat(filename) {
|
|
439
|
+
// Guard against internal bugs where a non-string filename is passed in by mistake.
|
|
440
|
+
assert(typeof filename === 'string');
|
|
441
|
+
|
|
442
|
+
+ const origFilename = filename;
|
|
443
|
+
filename = path.toNamespacedPath(filename);
|
|
444
|
+
if (statCache !== null) {
|
|
445
|
+
const result = statCache.get(filename);
|
|
446
|
+
if (result !== undefined) { return result; }
|
|
447
|
+
}
|
|
448
|
+
- const result = internalFsBinding.internalModuleStat(filename);
|
|
449
|
+
+ const fs = require('fs');
|
|
450
|
+
+ const result = fs.existsSync(origFilename) ?
|
|
451
|
+
+ (fs.statSync(origFilename).isDirectory() ? 1 : 0) : -1;
|
|
452
|
+
if (statCache !== null && result >= 0) {
|
|
453
|
+
// Only set cache when `internalModuleStat(filename)` succeeds.
|
|
454
|
+
statCache.set(filename, result);
|
|
455
|
+
diff --git node/lib/internal/modules/package_json_reader.js node/lib/internal/modules/package_json_reader.js
|
|
456
|
+
index 6c6bf0383b..25db3d9f43 100644
|
|
457
|
+
--- node/lib/internal/modules/package_json_reader.js
|
|
458
|
+
+++ node/lib/internal/modules/package_json_reader.js
|
|
459
|
+
@@ -120,17 +120,20 @@ const requiresJSONParse = (value) => (value !== undefined && (value[0] === '[' |
|
|
460
|
+
* @returns {PackageConfig}
|
|
461
|
+
*/
|
|
462
|
+
function read(jsonPath, { base, specifier, isESM } = kEmptyObject) {
|
|
463
|
+
- // This function will be called by both CJS and ESM, so we need to make sure
|
|
464
|
+
- // non-null attributes are converted to strings.
|
|
465
|
+
- const parsed = modulesBinding.readPackageJSON(
|
|
466
|
+
- jsonPath,
|
|
467
|
+
- isESM,
|
|
468
|
+
- base == null ? undefined : `${base}`,
|
|
469
|
+
- specifier == null ? undefined : `${specifier}`,
|
|
470
|
+
- );
|
|
471
|
+
-
|
|
472
|
+
- const result = deserializePackageJSON(jsonPath, parsed);
|
|
473
|
+
-
|
|
474
|
+
+ const fs = require('fs');
|
|
475
|
+
+ let result;
|
|
476
|
+
+ if (fs.existsSync(jsonPath)) {
|
|
477
|
+
+ const json = JSONParse(fs.readFileSync(jsonPath, { encoding: "utf8" }).trim());
|
|
478
|
+
+ result = deserializePackageJSON(jsonPath, [
|
|
479
|
+
+ json['name'],
|
|
480
|
+
+ json['main'],
|
|
481
|
+
+ json['type'],
|
|
482
|
+
+ json['imports'],
|
|
483
|
+
+ json['exports'],
|
|
484
|
+
+ ]);
|
|
485
|
+
+ } else {
|
|
486
|
+
+ result = deserializePackageJSON(jsonPath, undefined);
|
|
487
|
+
+ }
|
|
488
|
+
return {
|
|
489
|
+
__proto__: null,
|
|
490
|
+
...result.data,
|
|
491
|
+
diff --git node/lib/internal/process/pre_execution.js node/lib/internal/process/pre_execution.js
|
|
492
|
+
index 16a80c2d4f..4f6232e8b8 100644
|
|
493
|
+
--- node/lib/internal/process/pre_execution.js
|
|
494
|
+
+++ node/lib/internal/process/pre_execution.js
|
|
495
|
+
@@ -42,7 +42,11 @@ const {
|
|
496
|
+
runDeserializeCallbacks,
|
|
497
|
+
} = require('internal/v8/startup_snapshot');
|
|
498
|
+
|
|
499
|
+
+let _alreadyPrepared = false;
|
|
500
|
+
+
|
|
501
|
+
function prepareMainThreadExecution(expandArgv1 = false, initializeModules = true) {
|
|
502
|
+
+ if (_alreadyPrepared === true) return;
|
|
503
|
+
+ _alreadyPrepared = true;
|
|
504
|
+
return prepareExecution({
|
|
505
|
+
expandArgv1,
|
|
506
|
+
initializeModules,
|
|
507
|
+
@@ -281,7 +285,8 @@ function patchProcessObject(expandArgv1) {
|
|
508
|
+
let mainEntry;
|
|
509
|
+
// If requested, update process.argv[1] to replace whatever the user provided with the resolved absolute file path of
|
|
510
|
+
// the entry point.
|
|
511
|
+
- if (expandArgv1 && process.argv[1] && process.argv[1][0] !== '-') {
|
|
512
|
+
+ if (expandArgv1 && process.argv[1] && process.argv[1][0] !== '-' &&
|
|
513
|
+
+ process.argv[1] !== 'PKG_DUMMY_ENTRYPOINT') {
|
|
514
|
+
// Expand process.argv[1] into a full path.
|
|
515
|
+
const path = require('path');
|
|
516
|
+
try {
|
|
517
|
+
@@ -755,6 +760,7 @@ function loadPreloadModules() {
|
|
518
|
+
// For user code, we preload modules if `-r` is passed
|
|
519
|
+
const preloadModules = getOptionValue('--require');
|
|
520
|
+
if (preloadModules && preloadModules.length > 0) {
|
|
521
|
+
+ assert(false, '--require is not supported');
|
|
522
|
+
const {
|
|
523
|
+
Module: {
|
|
524
|
+
_preloadModules,
|
|
525
|
+
diff --git node/lib/vm.js node/lib/vm.js
|
|
526
|
+
index ae71080620..b05638de75 100644
|
|
527
|
+
--- node/lib/vm.js
|
|
528
|
+
+++ node/lib/vm.js
|
|
529
|
+
@@ -98,6 +98,7 @@ class Script extends ContextifyScript {
|
|
530
|
+
produceCachedData = false,
|
|
531
|
+
importModuleDynamically,
|
|
532
|
+
[kParsingContext]: parsingContext,
|
|
533
|
+
+ sourceless = false,
|
|
534
|
+
} = options;
|
|
535
|
+
|
|
536
|
+
validateString(filename, 'options.filename');
|
|
537
|
+
@@ -121,7 +122,8 @@ class Script extends ContextifyScript {
|
|
538
|
+
cachedData,
|
|
539
|
+
produceCachedData,
|
|
540
|
+
parsingContext,
|
|
541
|
+
- hostDefinedOptionId);
|
|
542
|
+
+ hostDefinedOptionId,
|
|
543
|
+
+ sourceless);
|
|
544
|
+
} catch (e) {
|
|
545
|
+
throw e; /* node-do-not-add-exception-line */
|
|
546
|
+
}
|
|
547
|
+
diff --git node/src/inspector_agent.cc node/src/inspector_agent.cc
|
|
548
|
+
index 5e1d9149dc..1426160ac0 100644
|
|
549
|
+
--- node/src/inspector_agent.cc
|
|
550
|
+
+++ node/src/inspector_agent.cc
|
|
551
|
+
@@ -858,11 +858,6 @@ bool Agent::Start(const std::string& path,
|
|
552
|
+
StartIoThreadAsyncCallback));
|
|
553
|
+
uv_unref(reinterpret_cast<uv_handle_t*>(&start_io_thread_async));
|
|
554
|
+
start_io_thread_async.data = this;
|
|
555
|
+
- if (parent_env_->should_start_debug_signal_handler()) {
|
|
556
|
+
- // Ignore failure, SIGUSR1 won't work, but that should not block node
|
|
557
|
+
- // start.
|
|
558
|
+
- StartDebugSignalHandler();
|
|
559
|
+
- }
|
|
560
|
+
|
|
561
|
+
parent_env_->AddCleanupHook([](void* data) {
|
|
562
|
+
Environment* env = static_cast<Environment*>(data);
|
|
563
|
+
diff --git node/src/node.cc node/src/node.cc
|
|
564
|
+
index 4ba019ddca..b30d716a41 100644
|
|
565
|
+
--- node/src/node.cc
|
|
566
|
+
+++ node/src/node.cc
|
|
567
|
+
@@ -351,6 +351,8 @@ MaybeLocal<Value> StartExecution(Environment* env,
|
|
568
|
+
return env->RunSnapshotDeserializeMain();
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
+ StartExecution(env, "internal/bootstrap/pkg");
|
|
572
|
+
+
|
|
573
|
+
if (env->worker_context() != nullptr) {
|
|
574
|
+
return StartExecution(env, "internal/main/worker_thread");
|
|
575
|
+
}
|
|
576
|
+
@@ -575,14 +577,6 @@ static void PlatformInit(ProcessInitializationFlags::Flags flags) {
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
if (!(flags & ProcessInitializationFlags::kNoDefaultSignalHandling)) {
|
|
580
|
+
-#if HAVE_INSPECTOR
|
|
581
|
+
- sigset_t sigmask;
|
|
582
|
+
- sigemptyset(&sigmask);
|
|
583
|
+
- sigaddset(&sigmask, SIGUSR1);
|
|
584
|
+
- const int err = pthread_sigmask(SIG_SETMASK, &sigmask, nullptr);
|
|
585
|
+
- CHECK_EQ(err, 0);
|
|
586
|
+
-#endif // HAVE_INSPECTOR
|
|
587
|
+
-
|
|
588
|
+
ResetSignalHandlers();
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
diff --git node/src/node_contextify.cc node/src/node_contextify.cc
|
|
592
|
+
index 14534ab896..dad27d634e 100644
|
|
593
|
+
--- node/src/node_contextify.cc
|
|
594
|
+
+++ node/src/node_contextify.cc
|
|
595
|
+
@@ -88,6 +88,7 @@ using v8::String;
|
|
596
|
+
using v8::Symbol;
|
|
597
|
+
using v8::UnboundScript;
|
|
598
|
+
using v8::Value;
|
|
599
|
+
+using v8::V8;
|
|
600
|
+
|
|
601
|
+
// The vm module executes code in a sandboxed environment with a different
|
|
602
|
+
// global object than the rest of the code. This is achieved by applying
|
|
603
|
+
@@ -982,13 +983,13 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
|
|
604
|
+
Local<ArrayBufferView> cached_data_buf;
|
|
605
|
+
bool produce_cached_data = false;
|
|
606
|
+
Local<Context> parsing_context = context;
|
|
607
|
+
-
|
|
608
|
+
+ bool sourceless = false;
|
|
609
|
+
Local<Symbol> id_symbol;
|
|
610
|
+
if (argc > 2) {
|
|
611
|
+
// new ContextifyScript(code, filename, lineOffset, columnOffset,
|
|
612
|
+
// cachedData, produceCachedData, parsingContext,
|
|
613
|
+
- // hostDefinedOptionId)
|
|
614
|
+
- CHECK_EQ(argc, 8);
|
|
615
|
+
+ // hostDefinedOptionId, sourceless)
|
|
616
|
+
+ CHECK_GE(argc, 8);
|
|
617
|
+
CHECK(args[2]->IsNumber());
|
|
618
|
+
line_offset = args[2].As<Int32>()->Value();
|
|
619
|
+
CHECK(args[3]->IsNumber());
|
|
620
|
+
@@ -1009,6 +1010,11 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
|
|
621
|
+
}
|
|
622
|
+
CHECK(args[7]->IsSymbol());
|
|
623
|
+
id_symbol = args[7].As<Symbol>();
|
|
624
|
+
+
|
|
625
|
+
+ if (argc > 8) {
|
|
626
|
+
+ CHECK(args[8]->IsBoolean());
|
|
627
|
+
+ sourceless = args[8]->IsTrue();
|
|
628
|
+
+ }
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
ContextifyScript* contextify_script = New(env, args.This());
|
|
632
|
+
@@ -1055,6 +1061,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
|
|
633
|
+
ShouldNotAbortOnUncaughtScope no_abort_scope(env);
|
|
634
|
+
Context::Scope scope(parsing_context);
|
|
635
|
+
|
|
636
|
+
+ if (sourceless && produce_cached_data) {
|
|
637
|
+
+ V8::EnableCompilationForSourcelessUse();
|
|
638
|
+
+ }
|
|
639
|
+
+
|
|
640
|
+
MaybeLocal<UnboundScript> maybe_v8_script =
|
|
641
|
+
ScriptCompiler::CompileUnboundScript(isolate, &source, compile_options);
|
|
642
|
+
|
|
643
|
+
@@ -1069,6 +1079,12 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
|
|
644
|
+
return;
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
+ if (sourceless && compile_options == ScriptCompiler::kConsumeCodeCache) {
|
|
648
|
+
+ if (!source.GetCachedData()->rejected) {
|
|
649
|
+
+ V8::FixSourcelessScript(env->isolate(), v8_script);
|
|
650
|
+
+ }
|
|
651
|
+
+ }
|
|
652
|
+
+
|
|
653
|
+
contextify_script->set_unbound_script(v8_script);
|
|
654
|
+
|
|
655
|
+
std::unique_ptr<ScriptCompiler::CachedData> new_cached_data;
|
|
656
|
+
@@ -1081,7 +1097,7 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
|
|
657
|
+
if (contextify_script->object()
|
|
658
|
+
->SetPrivate(context, env->host_defined_option_symbol(), id_symbol)
|
|
659
|
+
.IsNothing()) {
|
|
660
|
+
- return;
|
|
661
|
+
+return;
|
|
662
|
+
}
|
|
663
|
+
if (StoreCodeCacheResult(env,
|
|
664
|
+
self,
|
|
665
|
+
@@ -1092,6 +1108,9 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
|
|
666
|
+
.IsNothing()) {
|
|
667
|
+
return;
|
|
668
|
+
}
|
|
669
|
+
+ if (sourceless && produce_cached_data) {
|
|
670
|
+
+ V8::DisableCompilationForSourcelessUse();
|
|
671
|
+
+ }
|
|
672
|
+
if (self->Set(env->context(),
|
|
673
|
+
env->source_url_string(),
|
|
674
|
+
v8_script->GetSourceURL())
|
|
675
|
+
diff --git node/src/node_main.cc node/src/node_main.cc
|
|
676
|
+
index 3295121b87..bfe838b8c1 100644
|
|
677
|
+
--- node/src/node_main.cc
|
|
678
|
+
+++ node/src/node_main.cc
|
|
679
|
+
@@ -22,6 +22,8 @@
|
|
680
|
+
#include "node.h"
|
|
681
|
+
#include <cstdio>
|
|
682
|
+
|
|
683
|
+
+int reorder(int argc, char** argv);
|
|
684
|
+
+
|
|
685
|
+
#ifdef _WIN32
|
|
686
|
+
#include <windows.h>
|
|
687
|
+
#include <VersionHelpers.h>
|
|
688
|
+
@@ -88,12 +90,95 @@ int wmain(int argc, wchar_t* wargv[]) {
|
|
689
|
+
}
|
|
690
|
+
argv[argc] = nullptr;
|
|
691
|
+
// Now that conversion is done, we can finally start.
|
|
692
|
+
- return node::Start(argc, argv);
|
|
693
|
+
+ return reorder(argc, argv);
|
|
694
|
+
}
|
|
695
|
+
#else
|
|
696
|
+
// UNIX
|
|
697
|
+
|
|
698
|
+
int main(int argc, char* argv[]) {
|
|
699
|
+
+ return reorder(argc, argv);
|
|
700
|
+
+}
|
|
701
|
+
+#endif
|
|
702
|
+
+
|
|
703
|
+
+#include <string.h>
|
|
704
|
+
+
|
|
705
|
+
+int strlen2 (char* s) {
|
|
706
|
+
+ int len = 0;
|
|
707
|
+
+ while (*s) {
|
|
708
|
+
+ len += 1;
|
|
709
|
+
+ s += 1;
|
|
710
|
+
+ }
|
|
711
|
+
+ return len;
|
|
712
|
+
+}
|
|
713
|
+
+
|
|
714
|
+
+bool should_set_dummy() {
|
|
715
|
+
+#ifdef _WIN32
|
|
716
|
+
+ #define MAX_ENV_LENGTH 32767
|
|
717
|
+
+ wchar_t execpath_env[MAX_ENV_LENGTH];
|
|
718
|
+
+ DWORD result = GetEnvironmentVariableW(L"PKG_EXECPATH", execpath_env, MAX_ENV_LENGTH);
|
|
719
|
+
+ if (result == 0 && GetLastError() != ERROR_SUCCESS) return true;
|
|
720
|
+
+ return wcscmp(execpath_env, L"PKG_INVOKE_NODEJS") != 0;
|
|
721
|
+
+#else
|
|
722
|
+
+ const char* execpath_env = getenv("PKG_EXECPATH");
|
|
723
|
+
+ if (!execpath_env) return true;
|
|
724
|
+
+ return strcmp(execpath_env, "PKG_INVOKE_NODEJS") != 0;
|
|
725
|
+
+#endif
|
|
726
|
+
+}
|
|
727
|
+
+
|
|
728
|
+
+// for uv_setup_args
|
|
729
|
+
+int adjacent(int argc, char** argv) {
|
|
730
|
+
+ size_t size = 0;
|
|
731
|
+
+ for (int i = 0; i < argc; i++) {
|
|
732
|
+
+ size += strlen(argv[i]) + 1;
|
|
733
|
+
+ }
|
|
734
|
+
+ char* args = new char[size];
|
|
735
|
+
+ size_t pos = 0;
|
|
736
|
+
+ for (int i = 0; i < argc; i++) {
|
|
737
|
+
+ memcpy(&args[pos], argv[i], strlen(argv[i]) + 1);
|
|
738
|
+
+ argv[i] = &args[pos];
|
|
739
|
+
+ pos += strlen(argv[i]) + 1;
|
|
740
|
+
+ }
|
|
741
|
+
return node::Start(argc, argv);
|
|
742
|
+
}
|
|
743
|
+
+
|
|
744
|
+
+volatile char* BAKERY = (volatile char*) "\0// BAKERY // BAKERY " \
|
|
745
|
+
+ "// BAKERY // BAKERY // BAKERY // BAKERY // BAKERY // BAKERY " \
|
|
746
|
+
+ "// BAKERY // BAKERY // BAKERY // BAKERY // BAKERY // BAKERY " \
|
|
747
|
+
+ "// BAKERY // BAKERY // BAKERY // BAKERY // BAKERY // BAKERY ";
|
|
748
|
+
+
|
|
749
|
+
+#ifdef __clang__
|
|
750
|
+
+__attribute__((optnone))
|
|
751
|
+
+#elif defined(__GNUC__)
|
|
752
|
+
+__attribute__((optimize(0)))
|
|
753
|
+
#endif
|
|
754
|
+
+
|
|
755
|
+
+int load_baked(char** nargv) {
|
|
756
|
+
+ int c = 1;
|
|
757
|
+
+
|
|
758
|
+
+ char* bakery = (char*) BAKERY;
|
|
759
|
+
+ while (true) {
|
|
760
|
+
+ size_t width = strlen2(bakery);
|
|
761
|
+
+ if (width == 0) break;
|
|
762
|
+
+ nargv[c++] = bakery;
|
|
763
|
+
+ bakery += width + 1;
|
|
764
|
+
+ }
|
|
765
|
+
+
|
|
766
|
+
+ return c;
|
|
767
|
+
+}
|
|
768
|
+
+
|
|
769
|
+
+int reorder(int argc, char** argv) {
|
|
770
|
+
+ char** nargv = new char*[argc + 64];
|
|
771
|
+
+
|
|
772
|
+
+ nargv[0] = argv[0];
|
|
773
|
+
+ int c = load_baked(nargv);
|
|
774
|
+
+
|
|
775
|
+
+ if (should_set_dummy()) {
|
|
776
|
+
+ nargv[c++] = (char*) "PKG_DUMMY_ENTRYPOINT";
|
|
777
|
+
+ }
|
|
778
|
+
+
|
|
779
|
+
+ for (int i = 1; i < argc; i++) {
|
|
780
|
+
+ nargv[c++] = argv[i];
|
|
781
|
+
+ }
|
|
782
|
+
+
|
|
783
|
+
+ return adjacent(c, nargv);
|
|
784
|
+
+}
|
|
785
|
+
diff --git node/src/node_options.cc node/src/node_options.cc
|
|
786
|
+
index 99c5a7dbe4..b0ae409120 100644
|
|
787
|
+
--- node/src/node_options.cc
|
|
788
|
+
+++ node/src/node_options.cc
|
|
789
|
+
@@ -466,6 +466,7 @@ void Parse(
|
|
790
|
+
// TODO(addaleax): Make that unnecessary.
|
|
791
|
+
|
|
792
|
+
DebugOptionsParser::DebugOptionsParser() {
|
|
793
|
+
+ return;
|
|
794
|
+
AddOption("--inspect-port",
|
|
795
|
+
"set host:port for inspector",
|
|
796
|
+
&DebugOptions::host_port,
|
|
797
|
+
diff --git node/tools/icu/icu-generic.gyp node/tools/icu/icu-generic.gyp
|
|
798
|
+
index f49b4ddba7..eb1e4c0f9b 100644
|
|
799
|
+
--- node/tools/icu/icu-generic.gyp
|
|
800
|
+
+++ node/tools/icu/icu-generic.gyp
|
|
801
|
+
@@ -52,7 +52,7 @@
|
|
802
|
+
'conditions': [
|
|
803
|
+
[ 'os_posix == 1 and OS != "mac" and OS != "ios"', {
|
|
804
|
+
'cflags': [ '-Wno-deprecated-declarations', '-Wno-strict-aliasing' ],
|
|
805
|
+
- 'cflags_cc': [ '-frtti' ],
|
|
806
|
+
+ 'cflags_cc': [ '-frtti', '-fno-lto' ],
|
|
807
|
+
'cflags_cc!': [ '-fno-rtti' ],
|
|
808
|
+
}],
|
|
809
|
+
[ 'OS == "mac" or OS == "ios"', {
|
package/patches/patches.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
"
|
|
2
|
+
"v26.2.0": ["node.v26.2.0.cpp.patch"],
|
|
3
|
+
"v24.15.0": ["node.v24.15.0.cpp.patch"],
|
|
4
|
+
"v22.22.3": ["node.v22.22.3.cpp.patch"],
|
|
4
5
|
"v20.20.2": ["node.v20.20.2.cpp.patch"],
|
|
5
6
|
"v18.20.8": ["node.v18.20.8.cpp.patch"],
|
|
6
7
|
"v16.20.2": ["node.v16.20.2.cpp.patch"],
|