@yao-pkg/pkg-fetch 3.6.0 → 3.6.1
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 +28 -20
- package/lib-es5/apply-patches.js +19 -78
- package/lib-es5/bin.js +40 -89
- package/lib-es5/build.js +205 -374
- package/lib-es5/expected-shas.json +53 -34
- package/lib-es5/expected.js +1 -1
- package/lib-es5/generate-expected-shas.js +31 -72
- package/lib-es5/index.js +125 -203
- package/lib-es5/log.js +41 -61
- package/lib-es5/parse-update-shas.d.ts +3 -0
- package/lib-es5/parse-update-shas.js +106 -0
- package/lib-es5/places.js +13 -15
- package/lib-es5/print-hashes.js +4 -5
- package/lib-es5/system.js +18 -20
- package/lib-es5/utils.js +82 -140
- package/lib-es5/verify.js +133 -53
- package/package.json +12 -57
- package/patches/node.v16.20.2.cpp.patch +1 -1
- package/patches/{node.v18.18.2.cpp.patch → node.v18.20.8.cpp.patch} +207 -60
- package/patches/{node.v20.10.0.cpp.patch → node.v20.20.2.cpp.patch} +87 -50
- package/patches/{node.v19.8.1.cpp.patch → node.v22.22.3.cpp.patch} +316 -167
- package/patches/node.v24.15.0.cpp.patch +863 -0
- package/patches/node.v26.2.0.cpp.patch +809 -0
- package/patches/patches.json +5 -3
|
@@ -1,30 +1,48 @@
|
|
|
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
|
-
@@ -
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
@@ -192,7 +192,7 @@
|
|
6
|
+
['clang==1', {
|
|
7
|
+
'lto': ' -flto ', # Clang
|
|
8
|
+
}, {
|
|
9
9
|
- 'lto': ' -flto=4 -fuse-linker-plugin -ffat-lto-objects ', # GCC
|
|
10
10
|
+ 'lto': ' -flto=4 -ffat-lto-objects ', # GCC
|
|
11
|
-
}, {
|
|
12
|
-
'lto': ' -flto ', # Clang
|
|
13
11
|
}],
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
12
|
+
],
|
|
13
|
+
},
|
|
14
|
+
diff --git node/deps/ngtcp2/nghttp3/lib/nghttp3_ringbuf.c node/deps/ngtcp2/nghttp3/lib/nghttp3_ringbuf.c
|
|
15
|
+
index 7d3ab39bf8..67a48dee53 100644
|
|
16
|
+
--- node/deps/ngtcp2/nghttp3/lib/nghttp3_ringbuf.c
|
|
17
|
+
+++ node/deps/ngtcp2/nghttp3/lib/nghttp3_ringbuf.c
|
|
18
|
+
@@ -34,10 +34,7 @@
|
|
19
|
+
#include "nghttp3_macro.h"
|
|
20
|
+
|
|
21
|
+
static int ispow2(size_t n) {
|
|
22
|
+
-#if defined(_MSC_VER) && !defined(__clang__) && \
|
|
23
|
+
- (defined(_M_ARM) || (defined(_M_ARM64) && _MSC_VER < 1941))
|
|
24
|
+
- return n && !(n & (n - 1));
|
|
25
|
+
-#elif defined(WIN32)
|
|
26
|
+
+#if defined(WIN32)
|
|
27
|
+
return 1 == __popcnt((unsigned int)n);
|
|
28
|
+
#else /* !((defined(_MSC_VER) && !defined(__clang__) && (defined(_M_ARM) || \
|
|
29
|
+
(defined(_M_ARM64) && _MSC_VER < 1941))) || defined(WIN32)) */
|
|
30
|
+
diff --git node/deps/ngtcp2/ngtcp2/lib/ngtcp2_ringbuf.c node/deps/ngtcp2/ngtcp2/lib/ngtcp2_ringbuf.c
|
|
31
|
+
index 353afca4d4..dea944aed5 100644
|
|
32
|
+
--- node/deps/ngtcp2/ngtcp2/lib/ngtcp2_ringbuf.c
|
|
33
|
+
+++ node/deps/ngtcp2/ngtcp2/lib/ngtcp2_ringbuf.c
|
|
34
|
+
@@ -33,10 +33,7 @@
|
|
35
|
+
|
|
36
|
+
#ifndef NDEBUG
|
|
37
|
+
static int ispow2(size_t n) {
|
|
38
|
+
-# if defined(_MSC_VER) && !defined(__clang__) && \
|
|
39
|
+
- (defined(_M_ARM) || (defined(_M_ARM64) && _MSC_VER < 1941))
|
|
40
|
+
- return n && !(n & (n - 1));
|
|
41
|
+
-# elif defined(WIN32)
|
|
42
|
+
+#if defined(WIN32)
|
|
43
|
+
return 1 == __popcnt((unsigned int)n);
|
|
44
|
+
# else /* !((defined(_MSC_VER) && !defined(__clang__) && (defined(_M_ARM) || \
|
|
45
|
+
(defined(_M_ARM64) && _MSC_VER < 1941))) || defined(WIN32)) */
|
|
28
46
|
diff --git node/deps/v8/include/v8-initialization.h node/deps/v8/include/v8-initialization.h
|
|
29
47
|
index d3e35d6ec5..6e9bbe3849 100644
|
|
30
48
|
--- node/deps/v8/include/v8-initialization.h
|
|
@@ -41,10 +59,10 @@ index d3e35d6ec5..6e9bbe3849 100644
|
|
|
41
59
|
static const char* GetVersion();
|
|
42
60
|
|
|
43
61
|
diff --git node/deps/v8/src/api/api.cc node/deps/v8/src/api/api.cc
|
|
44
|
-
index
|
|
62
|
+
index f9ce798dc2..68af88ab13 100644
|
|
45
63
|
--- node/deps/v8/src/api/api.cc
|
|
46
64
|
+++ node/deps/v8/src/api/api.cc
|
|
47
|
-
@@ -
|
|
65
|
+
@@ -624,6 +624,28 @@ void V8::SetFlagsFromCommandLine(int* argc, char** argv, bool remove_flags) {
|
|
48
66
|
HelpOptions(HelpOptions::kDontExit));
|
|
49
67
|
}
|
|
50
68
|
|
|
@@ -52,33 +70,46 @@ index a4a4381614..2998f3c49b 100644
|
|
|
52
70
|
+bool save_predictable;
|
|
53
71
|
+
|
|
54
72
|
+void V8::EnableCompilationForSourcelessUse() {
|
|
55
|
-
+ save_lazy = i::
|
|
56
|
-
+ i::
|
|
57
|
-
+ save_predictable = i::
|
|
58
|
-
+ i::
|
|
73
|
+
+ save_lazy = i::v8_flags.lazy;
|
|
74
|
+
+ i::v8_flags.lazy = false;
|
|
75
|
+
+ save_predictable = i::v8_flags.predictable;
|
|
76
|
+
+ i::v8_flags.predictable = true;
|
|
59
77
|
+}
|
|
60
78
|
+
|
|
61
79
|
+void V8::DisableCompilationForSourcelessUse() {
|
|
62
|
-
+ i::
|
|
63
|
-
+ i::
|
|
80
|
+
+ i::v8_flags.lazy = save_lazy;
|
|
81
|
+
+ i::v8_flags.predictable = save_predictable;
|
|
64
82
|
+}
|
|
65
83
|
+
|
|
66
84
|
+void V8::FixSourcelessScript(Isolate* v8_isolate, Local<UnboundScript> unbound_script) {
|
|
67
85
|
+ auto isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
|
|
68
|
-
+ auto function_info =
|
|
69
|
-
+ i::Handle<i::SharedFunctionInfo>::cast(Utils::OpenHandle(*unbound_script));
|
|
86
|
+
+ auto function_info = i::Handle<i::SharedFunctionInfo>::cast(Utils::OpenHandle(*unbound_script));
|
|
70
87
|
+ i::Handle<i::Script> script(i::Script::cast(function_info->script()), isolate);
|
|
71
|
-
+ script->
|
|
88
|
+
+ script->SetSource(isolate, script, isolate->factory()->empty_string());
|
|
72
89
|
+}
|
|
73
90
|
+
|
|
74
91
|
RegisteredExtension* RegisteredExtension::first_extension_ = nullptr;
|
|
75
92
|
|
|
76
93
|
RegisteredExtension::RegisteredExtension(std::unique_ptr<Extension> extension)
|
|
94
|
+
diff --git node/deps/v8/src/codegen/code-stub-assembler.h node/deps/v8/src/codegen/code-stub-assembler.h
|
|
95
|
+
index c7c92eed93..9eaea3aaa8 100644
|
|
96
|
+
--- node/deps/v8/src/codegen/code-stub-assembler.h
|
|
97
|
+
+++ node/deps/v8/src/codegen/code-stub-assembler.h
|
|
98
|
+
@@ -286,7 +286,8 @@ enum class PrimitiveType { kBoolean, kNumber, kString, kSymbol };
|
|
99
|
+
|
|
100
|
+
// This is a check that always calls into the runtime if it aborts.
|
|
101
|
+
// This also exits silently when --hole-fuzzing is enabled.
|
|
102
|
+
-#define CSA_HOLE_SECURITY_CHECK(csa, x) CSA_CHECK_WITH_ABORT(csa, x)
|
|
103
|
+
+#define CSA_HOLE_SECURITY_CHECK(csa, x) \
|
|
104
|
+
+ (csa)->Check([&]() -> TNode<BoolT> { return x; }, #x, "placeholder", 1)
|
|
105
|
+
|
|
106
|
+
#ifdef DEBUG
|
|
107
|
+
// CSA_DCHECK_ARGS generates an
|
|
77
108
|
diff --git node/deps/v8/src/codegen/compiler.cc node/deps/v8/src/codegen/compiler.cc
|
|
78
|
-
index
|
|
109
|
+
index 9048655363..ab81c326fc 100644
|
|
79
110
|
--- node/deps/v8/src/codegen/compiler.cc
|
|
80
111
|
+++ node/deps/v8/src/codegen/compiler.cc
|
|
81
|
-
@@ -
|
|
112
|
+
@@ -3634,7 +3634,7 @@ MaybeHandle<SharedFunctionInfo> GetSharedFunctionInfoForScriptImpl(
|
|
82
113
|
maybe_script = lookup_result.script();
|
|
83
114
|
maybe_result = lookup_result.toplevel_sfi();
|
|
84
115
|
is_compiled_scope = lookup_result.is_compiled_scope();
|
|
@@ -87,77 +118,138 @@ index 5431deb83e..d11f04ccac 100644
|
|
|
87
118
|
compile_timer.set_hit_isolate_cache();
|
|
88
119
|
} else if (can_consume_code_cache) {
|
|
89
120
|
compile_timer.set_consuming_code_cache();
|
|
121
|
+
diff --git node/deps/v8/src/compiler/wasm-compiler.cc node/deps/v8/src/compiler/wasm-compiler.cc
|
|
122
|
+
index bd3dd3b27b..dab870e776 100644
|
|
123
|
+
--- node/deps/v8/src/compiler/wasm-compiler.cc
|
|
124
|
+
+++ node/deps/v8/src/compiler/wasm-compiler.cc
|
|
125
|
+
@@ -8618,12 +8618,13 @@ wasm::WasmCompilationResult CompileWasmImportCallWrapper(
|
|
126
|
+
'-');
|
|
127
|
+
|
|
128
|
+
auto compile_with_turboshaft = [&]() {
|
|
129
|
+
+ wasm::WrapperCompilationInfo info;
|
|
130
|
+
+ info.code_kind = CodeKind::WASM_TO_JS_FUNCTION;
|
|
131
|
+
+ info.import_info.import_kind = kind;
|
|
132
|
+
+ info.import_info.expected_arity = expected_arity;
|
|
133
|
+
+ info.import_info.suspend = suspend;
|
|
134
|
+
return Pipeline::GenerateCodeForWasmNativeStubFromTurboshaft(
|
|
135
|
+
- env->module, sig,
|
|
136
|
+
- wasm::WrapperCompilationInfo{
|
|
137
|
+
- .code_kind = CodeKind::WASM_TO_JS_FUNCTION,
|
|
138
|
+
- .import_info = {kind, expected_arity, suspend}},
|
|
139
|
+
- func_name, WasmStubAssemblerOptions(), nullptr);
|
|
140
|
+
+ env->module, sig, info, func_name, WasmStubAssemblerOptions(), nullptr);
|
|
141
|
+
};
|
|
142
|
+
auto compile_with_turbofan = [&]() {
|
|
143
|
+
//--------------------------------------------------------------------------
|
|
144
|
+
@@ -8779,13 +8780,15 @@ MaybeHandle<Code> CompileWasmToJSWrapper(Isolate* isolate,
|
|
145
|
+
base::VectorOf(name_buffer.get(), kMaxNameLen) + kNamePrefixLen, sig);
|
|
146
|
+
|
|
147
|
+
auto compile_with_turboshaft = [&]() {
|
|
148
|
+
+ wasm::WrapperCompilationInfo info;
|
|
149
|
+
+ info.code_kind = CodeKind::WASM_TO_JS_FUNCTION;
|
|
150
|
+
+ info.import_info.import_kind = kind;
|
|
151
|
+
+ info.import_info.expected_arity = expected_arity;
|
|
152
|
+
+ info.import_info.suspend = suspend;
|
|
153
|
+
std::unique_ptr<turboshaft::TurboshaftCompilationJob> job =
|
|
154
|
+
Pipeline::NewWasmTurboshaftWrapperCompilationJob(
|
|
155
|
+
- isolate, sig,
|
|
156
|
+
- wasm::WrapperCompilationInfo{
|
|
157
|
+
- .code_kind = CodeKind::WASM_TO_JS_FUNCTION,
|
|
158
|
+
- .import_info = {kind, expected_arity, suspend}},
|
|
159
|
+
- nullptr, std::move(name_buffer), WasmAssemblerOptions());
|
|
160
|
+
+ isolate, sig, info, nullptr, std::move(name_buffer),
|
|
161
|
+
+ WasmAssemblerOptions());
|
|
162
|
+
|
|
163
|
+
// Compile the wrapper
|
|
164
|
+
if (job->ExecuteJob(isolate->counters()->runtime_call_stats()) ==
|
|
165
|
+
diff --git node/deps/v8/src/heap/marking-visitor-inl.h node/deps/v8/src/heap/marking-visitor-inl.h
|
|
166
|
+
index 39a5bbd22c..4b860f55d5 100644
|
|
167
|
+
--- node/deps/v8/src/heap/marking-visitor-inl.h
|
|
168
|
+
+++ node/deps/v8/src/heap/marking-visitor-inl.h
|
|
169
|
+
@@ -329,6 +329,13 @@ bool MarkingVisitorBase<ConcreteVisitor>::HasBytecodeArrayForFlushing(
|
|
170
|
+
template <typename ConcreteVisitor>
|
|
171
|
+
bool MarkingVisitorBase<ConcreteVisitor>::ShouldFlushCode(
|
|
172
|
+
Tagged<SharedFunctionInfo> sfi) const {
|
|
173
|
+
+ auto script_obj = sfi->script();
|
|
174
|
+
+ if (!IsUndefined(script_obj)) {
|
|
175
|
+
+ auto script = i::Script::cast(script_obj);
|
|
176
|
+
+ if (IsUndefined(script->source())) {
|
|
177
|
+
+ return false;
|
|
178
|
+
+ }
|
|
179
|
+
+ }
|
|
180
|
+
return IsStressFlushingEnabled(code_flush_mode_) || IsOld(sfi);
|
|
181
|
+
}
|
|
182
|
+
|
|
90
183
|
diff --git node/deps/v8/src/objects/js-function.cc node/deps/v8/src/objects/js-function.cc
|
|
91
|
-
index
|
|
184
|
+
index 529e283bbf..c997c53a18 100644
|
|
92
185
|
--- node/deps/v8/src/objects/js-function.cc
|
|
93
186
|
+++ node/deps/v8/src/objects/js-function.cc
|
|
94
|
-
@@ -
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
+
|
|
99
|
-
+
|
|
100
|
-
+
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
+
|
|
115
|
-
+
|
|
116
|
-
+
|
|
117
|
-
+
|
|
187
|
+
@@ -1308,6 +1308,10 @@ Handle<String> JSFunction::ToString(Handle<JSFunction> function) {
|
|
188
|
+
Handle<Object> maybe_class_positions = JSReceiver::GetDataProperty(
|
|
189
|
+
isolate, function, isolate->factory()->class_positions_symbol());
|
|
190
|
+
if (IsClassPositions(*maybe_class_positions)) {
|
|
191
|
+
+ if (IsUndefined(
|
|
192
|
+
+ String::cast(Script::cast(shared_info->script())->source()))) {
|
|
193
|
+
+ return isolate->factory()->NewStringFromAsciiChecked("class {}");
|
|
194
|
+
+ }
|
|
195
|
+
Tagged<ClassPositions> class_positions =
|
|
196
|
+
ClassPositions::cast(*maybe_class_positions);
|
|
197
|
+
int start_position = class_positions->start();
|
|
198
|
+
diff --git node/deps/v8/src/objects/objects.cc node/deps/v8/src/objects/objects.cc
|
|
199
|
+
index 535ee9ed70..cf1e06d4fc 100644
|
|
200
|
+
--- node/deps/v8/src/objects/objects.cc
|
|
201
|
+
+++ node/deps/v8/src/objects/objects.cc
|
|
202
|
+
@@ -4246,7 +4246,12 @@ void Script::InitLineEndsInternal(IsolateT* isolate, Handle<Script> script) {
|
|
203
|
+
|
|
204
|
+
void Script::SetSource(Isolate* isolate, Handle<Script> script,
|
|
205
|
+
Handle<String> source) {
|
|
206
|
+
- script->set_source(*source);
|
|
207
|
+
+ if (source->length() > 0) {
|
|
208
|
+
+ script->set_source(*source);
|
|
209
|
+
+ } else {
|
|
210
|
+
+ Tagged<PrimitiveHeapObject> und = *isolate->factory()->undefined_value();
|
|
211
|
+
+ script->set_source(und);
|
|
118
212
|
+ }
|
|
119
|
-
|
|
120
|
-
|
|
213
|
+
if (isolate->NeedsSourcePositions()) InitLineEnds(isolate, script);
|
|
214
|
+
}
|
|
121
215
|
|
|
122
|
-
BytecodeArray bytecode = BytecodeArray::cast(data);
|
|
123
216
|
diff --git node/deps/v8/src/parsing/parsing.cc node/deps/v8/src/parsing/parsing.cc
|
|
124
|
-
index
|
|
217
|
+
index f160b27ea4..748452ba45 100644
|
|
125
218
|
--- node/deps/v8/src/parsing/parsing.cc
|
|
126
219
|
+++ node/deps/v8/src/parsing/parsing.cc
|
|
127
220
|
@@ -42,6 +42,7 @@ bool ParseProgram(ParseInfo* info, Handle<Script> script,
|
|
128
|
-
Isolate* isolate, ReportStatisticsMode mode) {
|
|
129
221
|
DCHECK(info->flags().is_toplevel());
|
|
130
222
|
DCHECK_NULL(info->literal());
|
|
131
|
-
+ if (String::cast(script->source()).IsUndefined(isolate)) return false;
|
|
132
223
|
|
|
224
|
+
+ if (IsUndefined(String::cast(script->source()))) return false;
|
|
133
225
|
VMState<PARSER> state(isolate);
|
|
134
226
|
|
|
135
|
-
|
|
227
|
+
// Create a character stream for the parser.
|
|
228
|
+
@@ -74,6 +75,8 @@ bool ParseFunction(ParseInfo* info, Handle<SharedFunctionInfo> shared_info,
|
|
136
229
|
|
|
137
230
|
// Create a character stream for the parser.
|
|
138
231
|
Handle<Script> script(Script::cast(shared_info->script()), isolate);
|
|
139
|
-
+ if (String::cast(script->source())
|
|
232
|
+
+ if (IsUndefined(String::cast(script->source()))) return false;
|
|
233
|
+
+
|
|
140
234
|
Handle<String> source(String::cast(script->source()), isolate);
|
|
141
235
|
std::unique_ptr<Utf16CharacterStream> stream(
|
|
142
236
|
ScannerStream::For(isolate, source, shared_info->StartPosition(),
|
|
143
237
|
diff --git node/deps/v8/src/snapshot/code-serializer.cc node/deps/v8/src/snapshot/code-serializer.cc
|
|
144
|
-
index
|
|
238
|
+
index ec69ad5123..5bc92af5aa 100644
|
|
145
239
|
--- node/deps/v8/src/snapshot/code-serializer.cc
|
|
146
240
|
+++ node/deps/v8/src/snapshot/code-serializer.cc
|
|
147
|
-
@@ -
|
|
148
|
-
}
|
|
241
|
+
@@ -703,10 +703,6 @@ SerializedCodeSanityCheckResult SerializedCodeData::SanityCheck(
|
|
149
242
|
|
|
150
243
|
SerializedCodeSanityCheckResult SerializedCodeData::SanityCheckJustSource(
|
|
151
|
-
|
|
244
|
+
uint32_t expected_source_hash) const {
|
|
152
245
|
- uint32_t source_hash = GetHeaderValue(kSourceHashOffset);
|
|
153
246
|
- if (source_hash != expected_source_hash) {
|
|
154
247
|
- return SerializedCodeSanityCheckResult::kSourceMismatch;
|
|
155
248
|
- }
|
|
156
|
-
+ uint32_t) const {
|
|
157
249
|
return SerializedCodeSanityCheckResult::kSuccess;
|
|
158
250
|
}
|
|
159
251
|
|
|
160
|
-
@@ -
|
|
252
|
+
@@ -723,13 +719,12 @@ SerializedCodeSanityCheckResult SerializedCodeData::SanityCheckWithoutSource(
|
|
161
253
|
if (version_hash != Version::Hash()) {
|
|
162
254
|
return SerializedCodeSanityCheckResult::kVersionMismatch;
|
|
163
255
|
}
|
|
@@ -165,14 +257,34 @@ index 95352299f8..2dd794b855 100644
|
|
|
165
257
|
- if (flags_hash != FlagList::Hash()) {
|
|
166
258
|
- return SerializedCodeSanityCheckResult::kFlagsMismatch;
|
|
167
259
|
- }
|
|
260
|
+
uint32_t ro_snapshot_checksum =
|
|
261
|
+
GetHeaderValue(kReadOnlySnapshotChecksumOffset);
|
|
262
|
+
if (ro_snapshot_checksum != expected_ro_snapshot_checksum) {
|
|
263
|
+
+ // for debugging snapshot checkum issues
|
|
264
|
+
+ // PrintF("[pkg] ReadOnlySnapshotChecksum mismatch: code=%08x built=%08x\n",
|
|
265
|
+
+ // ro_snapshot_checksum, expected_ro_snapshot_checksum);
|
|
266
|
+
return SerializedCodeSanityCheckResult::kReadOnlySnapshotChecksumMismatch;
|
|
267
|
+
}
|
|
168
268
|
uint32_t payload_length = GetHeaderValue(kPayloadLengthOffset);
|
|
169
|
-
|
|
170
|
-
|
|
269
|
+
diff --git node/deps/v8/src/snapshot/read-only-serializer.cc node/deps/v8/src/snapshot/read-only-serializer.cc
|
|
270
|
+
index 29c69a782e..4431cd14ac 100644
|
|
271
|
+
--- node/deps/v8/src/snapshot/read-only-serializer.cc
|
|
272
|
+
+++ node/deps/v8/src/snapshot/read-only-serializer.cc
|
|
273
|
+
@@ -237,6 +237,9 @@ class EncodeRelocationsVisitor final : public ObjectVisitor {
|
|
274
|
+
|
|
275
|
+
// Encode:
|
|
276
|
+
ro::EncodedTagged encoded = Encode(isolate_, o.GetHeapObject());
|
|
277
|
+
+ #ifndef V8_COMPRESS_POINTERS
|
|
278
|
+
+ memset(segment_->contents.get() + slot_offset, 0, kTaggedSize);
|
|
279
|
+
+ #endif
|
|
280
|
+
memcpy(segment_->contents.get() + slot_offset, &encoded,
|
|
281
|
+
ro::EncodedTagged::kSize);
|
|
282
|
+
|
|
171
283
|
diff --git node/lib/child_process.js node/lib/child_process.js
|
|
172
|
-
index
|
|
284
|
+
index 960ecd25eb..1b34323375 100644
|
|
173
285
|
--- node/lib/child_process.js
|
|
174
286
|
+++ node/lib/child_process.js
|
|
175
|
-
@@ -
|
|
287
|
+
@@ -171,7 +171,7 @@ function fork(modulePath, args = [], options) {
|
|
176
288
|
throw new ERR_CHILD_PROCESS_IPC_REQUIRED('options.stdio');
|
|
177
289
|
}
|
|
178
290
|
|
|
@@ -183,7 +295,7 @@ index 5d3e2d63a7..077b96a415 100644
|
|
|
183
295
|
function _forkChild(fd, serializationMode) {
|
|
184
296
|
diff --git node/lib/internal/bootstrap/pkg.js node/lib/internal/bootstrap/pkg.js
|
|
185
297
|
new file mode 100644
|
|
186
|
-
index 0000000000..
|
|
298
|
+
index 0000000000..a697294fdf
|
|
187
299
|
--- /dev/null
|
|
188
300
|
+++ node/lib/internal/bootstrap/pkg.js
|
|
189
301
|
@@ -0,0 +1,49 @@
|
|
@@ -237,37 +349,72 @@ index 0000000000..e97e9e524c
|
|
|
237
349
|
+ }());
|
|
238
350
|
+}());
|
|
239
351
|
diff --git node/lib/internal/modules/cjs/loader.js node/lib/internal/modules/cjs/loader.js
|
|
240
|
-
index
|
|
352
|
+
index e70b465db8..265197441d 100644
|
|
241
353
|
--- node/lib/internal/modules/cjs/loader.js
|
|
242
354
|
+++ node/lib/internal/modules/cjs/loader.js
|
|
243
|
-
@@ -
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
355
|
+
@@ -265,14 +265,18 @@ function stat(filename) {
|
|
356
|
+
// Guard against internal bugs where a non-string filename is passed in by mistake.
|
|
357
|
+
assert(typeof filename === 'string');
|
|
358
|
+
|
|
359
|
+
+ const origFilename = filename;
|
|
360
|
+
filename = path.toNamespacedPath(filename);
|
|
361
|
+
if (statCache !== null) {
|
|
362
|
+
const result = statCache.get(filename);
|
|
363
|
+
if (result !== undefined) { return result; }
|
|
364
|
+
}
|
|
365
|
+
- const result = internalFsBinding.internalModuleStat(filename);
|
|
366
|
+
+ const fs = require('fs');
|
|
367
|
+
+ const result = fs.existsSync(origFilename) ?
|
|
368
|
+
+ (fs.statSync(origFilename).isDirectory() ? 1 : 0) : -1;
|
|
369
|
+
+
|
|
370
|
+
if (statCache !== null && result >= 0) {
|
|
371
|
+
- // Only set cache when `internalModuleStat(filename)` succeeds.
|
|
372
|
+
+ // Only set cache when `internalModuleStat(internalFsBinding, filename)` succeeds.
|
|
373
|
+
statCache.set(filename, result);
|
|
374
|
+
}
|
|
375
|
+
return result;
|
|
252
376
|
diff --git node/lib/internal/modules/package_json_reader.js node/lib/internal/modules/package_json_reader.js
|
|
253
|
-
index
|
|
377
|
+
index 0f9442ea7a..e30582b3cc 100644
|
|
254
378
|
--- node/lib/internal/modules/package_json_reader.js
|
|
255
379
|
+++ node/lib/internal/modules/package_json_reader.js
|
|
256
|
-
@@ -
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
380
|
+
@@ -111,17 +111,20 @@ const requiresJSONParse = (value) => (value !== undefined && (value[0] === '[' |
|
|
381
|
+
* @returns {PackageConfig}
|
|
382
|
+
*/
|
|
383
|
+
function read(jsonPath, { base, specifier, isESM } = kEmptyObject) {
|
|
384
|
+
- // This function will be called by both CJS and ESM, so we need to make sure
|
|
385
|
+
- // non-null attributes are converted to strings.
|
|
386
|
+
- const parsed = modulesBinding.readPackageJSON(
|
|
387
|
+
- jsonPath,
|
|
388
|
+
- isESM,
|
|
389
|
+
- base == null ? undefined : `${base}`,
|
|
390
|
+
- specifier == null ? undefined : `${specifier}`,
|
|
391
|
+
- );
|
|
392
|
+
-
|
|
393
|
+
- const result = deserializePackageJSON(jsonPath, parsed);
|
|
394
|
+
-
|
|
395
|
+
+ const fs = require('fs');
|
|
396
|
+
+ let result;
|
|
397
|
+
+ if (fs.existsSync(jsonPath)) {
|
|
398
|
+
+ const json = JSONParse(fs.readFileSync(jsonPath, { encoding: "utf8" }).trim());
|
|
399
|
+
+ result = deserializePackageJSON(jsonPath, [
|
|
400
|
+
+ json['name'],
|
|
401
|
+
+ json['main'],
|
|
402
|
+
+ json['type'],
|
|
403
|
+
+ json['imports'],
|
|
404
|
+
+ json['exports'],
|
|
405
|
+
+ ]);
|
|
406
|
+
+ } else {
|
|
407
|
+
+ result = deserializePackageJSON(jsonPath, undefined);
|
|
408
|
+
+ }
|
|
409
|
+
return {
|
|
410
|
+
__proto__: null,
|
|
411
|
+
...result.data,
|
|
265
412
|
diff --git node/lib/internal/process/pre_execution.js node/lib/internal/process/pre_execution.js
|
|
266
|
-
index
|
|
413
|
+
index 3546544ad0..7a285054a5 100644
|
|
267
414
|
--- node/lib/internal/process/pre_execution.js
|
|
268
415
|
+++ node/lib/internal/process/pre_execution.js
|
|
269
|
-
@@ -
|
|
270
|
-
|
|
416
|
+
@@ -49,7 +49,11 @@ const {
|
|
417
|
+
runDeserializeCallbacks,
|
|
271
418
|
} = require('internal/v8/startup_snapshot');
|
|
272
419
|
|
|
273
420
|
+let _alreadyPrepared = false;
|
|
@@ -275,21 +422,20 @@ index ebc699ef1d..f109969a94 100644
|
|
|
275
422
|
function prepareMainThreadExecution(expandArgv1 = false, initializeModules = true) {
|
|
276
423
|
+ if (_alreadyPrepared === true) return;
|
|
277
424
|
+ _alreadyPrepared = true;
|
|
278
|
-
|
|
279
|
-
prepareExecution({
|
|
425
|
+
return prepareExecution({
|
|
280
426
|
expandArgv1,
|
|
281
427
|
initializeModules,
|
|
282
|
-
@@ -
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
-
|
|
287
|
-
+
|
|
288
|
-
+
|
|
428
|
+
@@ -266,7 +270,8 @@ function patchProcessObject(expandArgv1) {
|
|
429
|
+
let mainEntry;
|
|
430
|
+
// If requested, update process.argv[1] to replace whatever the user provided with the resolved absolute file path of
|
|
431
|
+
// the entry point.
|
|
432
|
+
- if (expandArgv1 && process.argv[1] && process.argv[1][0] !== '-') {
|
|
433
|
+
+ if (expandArgv1 && process.argv[1] && process.argv[1][0] !== '-' &&
|
|
434
|
+
+ process.argv[1] !== 'PKG_DUMMY_ENTRYPOINT') {
|
|
289
435
|
// Expand process.argv[1] into a full path.
|
|
290
436
|
const path = require('path');
|
|
291
437
|
try {
|
|
292
|
-
@@ -
|
|
438
|
+
@@ -748,6 +753,7 @@ function loadPreloadModules() {
|
|
293
439
|
// For user code, we preload modules if `-r` is passed
|
|
294
440
|
const preloadModules = getOptionValue('--require');
|
|
295
441
|
if (preloadModules && preloadModules.length > 0) {
|
|
@@ -298,10 +444,10 @@ index ebc699ef1d..f109969a94 100644
|
|
|
298
444
|
Module: {
|
|
299
445
|
_preloadModules,
|
|
300
446
|
diff --git node/lib/vm.js node/lib/vm.js
|
|
301
|
-
index
|
|
447
|
+
index ae71080620..b05638de75 100644
|
|
302
448
|
--- node/lib/vm.js
|
|
303
449
|
+++ node/lib/vm.js
|
|
304
|
-
@@ -
|
|
450
|
+
@@ -98,6 +98,7 @@ class Script extends ContextifyScript {
|
|
305
451
|
produceCachedData = false,
|
|
306
452
|
importModuleDynamically,
|
|
307
453
|
[kParsingContext]: parsingContext,
|
|
@@ -309,48 +455,37 @@ index 19117bca5d..94a21205f1 100644
|
|
|
309
455
|
} = options;
|
|
310
456
|
|
|
311
457
|
validateString(filename, 'options.filename');
|
|
312
|
-
@@ -
|
|
313
|
-
columnOffset,
|
|
458
|
+
@@ -121,7 +122,8 @@ class Script extends ContextifyScript {
|
|
314
459
|
cachedData,
|
|
315
460
|
produceCachedData,
|
|
316
|
-
|
|
317
|
-
|
|
461
|
+
parsingContext,
|
|
462
|
+
- hostDefinedOptionId);
|
|
463
|
+
+ hostDefinedOptionId,
|
|
318
464
|
+ sourceless);
|
|
319
465
|
} catch (e) {
|
|
320
466
|
throw e; /* node-do-not-add-exception-line */
|
|
321
467
|
}
|
|
322
|
-
diff --git node/node.gyp node/node.gyp
|
|
323
|
-
index 2e41a7bb22..6131b75467 100644
|
|
324
|
-
--- node/node.gyp
|
|
325
|
-
+++ node/node.gyp
|
|
326
|
-
@@ -110,6 +110,9 @@
|
|
327
|
-
},
|
|
328
|
-
|
|
329
|
-
'conditions': [
|
|
330
|
-
+ ['target_arch=="arm64"', {
|
|
331
|
-
+ 'cflags': ['-msign-return-address=all'], # Pointer authentication.
|
|
332
|
-
+ }],
|
|
333
|
-
['OS in "aix os400"', {
|
|
334
|
-
'ldflags': [
|
|
335
|
-
'-Wl,-bnoerrmsg',
|
|
336
468
|
diff --git node/src/inspector_agent.cc node/src/inspector_agent.cc
|
|
337
|
-
index
|
|
469
|
+
index 2318c4e0df..fb998531a7 100644
|
|
338
470
|
--- node/src/inspector_agent.cc
|
|
339
471
|
+++ node/src/inspector_agent.cc
|
|
340
|
-
@@ -
|
|
472
|
+
@@ -832,11 +832,6 @@ bool Agent::Start(const std::string& path,
|
|
341
473
|
StartIoThreadAsyncCallback));
|
|
342
474
|
uv_unref(reinterpret_cast<uv_handle_t*>(&start_io_thread_async));
|
|
343
475
|
start_io_thread_async.data = this;
|
|
344
|
-
-
|
|
345
|
-
-
|
|
476
|
+
- if (parent_env_->should_start_debug_signal_handler()) {
|
|
477
|
+
- // Ignore failure, SIGUSR1 won't work, but that should not block node
|
|
478
|
+
- // start.
|
|
479
|
+
- StartDebugSignalHandler();
|
|
480
|
+
- }
|
|
346
481
|
|
|
347
482
|
parent_env_->AddCleanupHook([](void* data) {
|
|
348
483
|
Environment* env = static_cast<Environment*>(data);
|
|
349
484
|
diff --git node/src/node.cc node/src/node.cc
|
|
350
|
-
index
|
|
485
|
+
index db0011b429..bb6dfa8f5f 100644
|
|
351
486
|
--- node/src/node.cc
|
|
352
487
|
+++ node/src/node.cc
|
|
353
|
-
@@ -
|
|
488
|
+
@@ -404,6 +404,8 @@ MaybeLocal<Value> StartExecution(Environment* env, StartExecutionCallback cb) {
|
|
354
489
|
return env->RunSnapshotDeserializeMain();
|
|
355
490
|
}
|
|
356
491
|
|
|
@@ -359,7 +494,7 @@ index 6bdcbb3de9..f94d3d396d 100644
|
|
|
359
494
|
if (env->worker_context() != nullptr) {
|
|
360
495
|
return StartExecution(env, "internal/main/worker_thread");
|
|
361
496
|
}
|
|
362
|
-
@@ -
|
|
497
|
+
@@ -628,14 +630,6 @@ static void PlatformInit(ProcessInitializationFlags::Flags flags) {
|
|
363
498
|
}
|
|
364
499
|
|
|
365
500
|
if (!(flags & ProcessInitializationFlags::kNoDefaultSignalHandling)) {
|
|
@@ -375,40 +510,46 @@ index 6bdcbb3de9..f94d3d396d 100644
|
|
|
375
510
|
}
|
|
376
511
|
|
|
377
512
|
diff --git node/src/node_contextify.cc node/src/node_contextify.cc
|
|
378
|
-
index
|
|
513
|
+
index d52388717e..4d478e77be 100644
|
|
379
514
|
--- node/src/node_contextify.cc
|
|
380
515
|
+++ node/src/node_contextify.cc
|
|
381
|
-
@@ -
|
|
382
|
-
using v8::String;
|
|
516
|
+
@@ -86,6 +86,7 @@ using v8::Symbol;
|
|
383
517
|
using v8::Uint32;
|
|
384
518
|
using v8::UnboundScript;
|
|
385
|
-
+using v8::V8;
|
|
386
519
|
using v8::Value;
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
520
|
+
+using v8::V8;
|
|
521
|
+
|
|
522
|
+
// The vm module executes code in a sandboxed environment with a different
|
|
523
|
+
// global object than the rest of the code. This is achieved by applying
|
|
524
|
+
@@ -993,13 +994,13 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
|
|
390
525
|
Local<ArrayBufferView> cached_data_buf;
|
|
391
526
|
bool produce_cached_data = false;
|
|
392
527
|
Local<Context> parsing_context = context;
|
|
528
|
+
-
|
|
393
529
|
+ bool sourceless = false;
|
|
394
|
-
|
|
530
|
+
Local<Symbol> id_symbol;
|
|
395
531
|
if (argc > 2) {
|
|
396
532
|
// new ContextifyScript(code, filename, lineOffset, columnOffset,
|
|
397
|
-
// cachedData, produceCachedData, parsingContext
|
|
398
|
-
-
|
|
399
|
-
|
|
533
|
+
// cachedData, produceCachedData, parsingContext,
|
|
534
|
+
- // hostDefinedOptionId)
|
|
535
|
+
- CHECK_EQ(argc, 8);
|
|
536
|
+
+ // hostDefinedOptionId, sourceless)
|
|
537
|
+
+ CHECK_GE(argc, 8);
|
|
400
538
|
CHECK(args[2]->IsNumber());
|
|
401
539
|
line_offset = args[2].As<Int32>()->Value();
|
|
402
540
|
CHECK(args[3]->IsNumber());
|
|
403
|
-
@@ -
|
|
404
|
-
CHECK_NOT_NULL(sandbox);
|
|
405
|
-
parsing_context = sandbox->context();
|
|
541
|
+
@@ -1020,6 +1021,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
|
|
406
542
|
}
|
|
407
|
-
|
|
543
|
+
CHECK(args[7]->IsSymbol());
|
|
544
|
+
id_symbol = args[7].As<Symbol>();
|
|
545
|
+
+ if (argc > 8) {
|
|
546
|
+
+ CHECK(args[8]->IsBoolean());
|
|
547
|
+
+ sourceless = args[8]->IsTrue();
|
|
548
|
+
+ }
|
|
408
549
|
}
|
|
409
550
|
|
|
410
551
|
ContextifyScript* contextify_script =
|
|
411
|
-
@@ -
|
|
552
|
+
@@ -1067,6 +1072,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
|
|
412
553
|
ShouldNotAbortOnUncaughtScope no_abort_scope(env);
|
|
413
554
|
Context::Scope scope(parsing_context);
|
|
414
555
|
|
|
@@ -419,11 +560,10 @@ index 5aadefd84d..f9c307b178 100644
|
|
|
419
560
|
MaybeLocal<UnboundScript> maybe_v8_script =
|
|
420
561
|
ScriptCompiler::CompileUnboundScript(isolate, &source, compile_options);
|
|
421
562
|
|
|
422
|
-
@@ -
|
|
423
|
-
"ContextifyScript::New");
|
|
563
|
+
@@ -1081,6 +1090,12 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
|
|
424
564
|
return;
|
|
425
565
|
}
|
|
426
|
-
|
|
566
|
+
|
|
427
567
|
+ if (sourceless && compile_options == ScriptCompiler::kConsumeCodeCache) {
|
|
428
568
|
+ if (!source.GetCachedData()->rejected) {
|
|
429
569
|
+ V8::FixSourcelessScript(env->isolate(), v8_script);
|
|
@@ -431,9 +571,9 @@ index 5aadefd84d..f9c307b178 100644
|
|
|
431
571
|
+ }
|
|
432
572
|
+
|
|
433
573
|
contextify_script->script_.Reset(isolate, v8_script);
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
@@ -
|
|
574
|
+
contextify_script->script_.SetWeak();
|
|
575
|
+
contextify_script->object()->SetInternalField(kUnboundScriptSlot, v8_script);
|
|
576
|
+
@@ -1120,6 +1135,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
|
|
437
577
|
.IsNothing())
|
|
438
578
|
return;
|
|
439
579
|
|
|
@@ -445,7 +585,7 @@ index 5aadefd84d..f9c307b178 100644
|
|
|
445
585
|
}
|
|
446
586
|
|
|
447
587
|
diff --git node/src/node_main.cc node/src/node_main.cc
|
|
448
|
-
index
|
|
588
|
+
index f66099a557..4048f6bd93 100644
|
|
449
589
|
--- node/src/node_main.cc
|
|
450
590
|
+++ node/src/node_main.cc
|
|
451
591
|
@@ -22,6 +22,8 @@
|
|
@@ -555,19 +695,28 @@ index 56deaf47fa..e7ffa1baaa 100644
|
|
|
555
695
|
+ return adjacent(c, nargv);
|
|
556
696
|
+}
|
|
557
697
|
diff --git node/src/node_options.cc node/src/node_options.cc
|
|
558
|
-
index
|
|
698
|
+
index 5b74045886..2dfb7bd76e 100644
|
|
559
699
|
--- node/src/node_options.cc
|
|
560
700
|
+++ node/src/node_options.cc
|
|
561
|
-
@@ -
|
|
701
|
+
@@ -359,7 +359,7 @@ void Parse(
|
|
702
|
+
PerProcessOptions* const options,
|
|
703
|
+
OptionEnvvarSettings required_env_settings, StringVector* const errors) {
|
|
704
|
+
_ppop_instance.Parse(
|
|
705
|
+
- args, exec_args, v8_args, options, required_env_settings, errors);
|
|
706
|
+
+args, exec_args, v8_args, options, required_env_settings, errors);
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
// XXX: If you add an option here, please also add it to doc/node.1 and
|
|
710
|
+
@@ -367,6 +367,7 @@ void Parse(
|
|
562
711
|
// TODO(addaleax): Make that unnecessary.
|
|
563
712
|
|
|
564
713
|
DebugOptionsParser::DebugOptionsParser() {
|
|
565
714
|
+ return;
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
715
|
+
AddOption("--inspect-port",
|
|
716
|
+
"set host:port for inspector",
|
|
717
|
+
&DebugOptions::host_port,
|
|
569
718
|
diff --git node/tools/icu/icu-generic.gyp node/tools/icu/icu-generic.gyp
|
|
570
|
-
index
|
|
719
|
+
index f007c65232..002a00a6ae 100644
|
|
571
720
|
--- node/tools/icu/icu-generic.gyp
|
|
572
721
|
+++ node/tools/icu/icu-generic.gyp
|
|
573
722
|
@@ -52,7 +52,7 @@
|