@yao-pkg/pkg-fetch 3.5.3

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.
@@ -0,0 +1,560 @@
1
+ --- node/common.gypi
2
+ +++ node/common.gypi
3
+ @@ -171,7 +171,7 @@
4
+ 'MSVC_runtimeType': 2 # MultiThreadedDLL (/MD)
5
+ }],
6
+ ['llvm_version=="0.0"', {
7
+ - 'lto': ' -flto=4 -fuse-linker-plugin -ffat-lto-objects ', # GCC
8
+ + 'lto': ' -flto=4 -ffat-lto-objects ', # GCC
9
+ }, {
10
+ 'lto': ' -flto ', # Clang
11
+ }],
12
+ --- node/deps/v8/include/v8.h
13
+ +++ node/deps/v8/include/v8.h
14
+ @@ -9633,6 +9633,10 @@ class V8_EXPORT V8 {
15
+ char** argv,
16
+ bool remove_flags);
17
+
18
+ + static void EnableCompilationForSourcelessUse();
19
+ + static void DisableCompilationForSourcelessUse();
20
+ + static void FixSourcelessScript(Isolate* v8_isolate, Local<UnboundScript> script);
21
+ +
22
+ /** Get the version string. */
23
+ static const char* GetVersion();
24
+
25
+ --- node/deps/v8/src/api/api.cc
26
+ +++ node/deps/v8/src/api/api.cc
27
+ @@ -840,6 +840,34 @@ void V8::SetFlagsFromCommandLine(int* argc, char** argv, bool remove_flags) {
28
+ i::FlagList::SetFlagsFromCommandLine(argc, argv, remove_flags);
29
+ }
30
+
31
+ +
32
+ +bool save_lazy;
33
+ +bool save_predictable;
34
+ +
35
+ +
36
+ +void V8::EnableCompilationForSourcelessUse() {
37
+ + save_lazy = i::FLAG_lazy;
38
+ + i::FLAG_lazy = false;
39
+ + save_predictable = i::FLAG_predictable;
40
+ + i::FLAG_predictable = true;
41
+ +}
42
+ +
43
+ +
44
+ +void V8::DisableCompilationForSourcelessUse() {
45
+ + i::FLAG_lazy = save_lazy;
46
+ + i::FLAG_predictable = save_predictable;
47
+ +}
48
+ +
49
+ +
50
+ +void V8::FixSourcelessScript(Isolate* v8_isolate, Local<UnboundScript> unbound_script) {
51
+ + auto isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
52
+ + auto function_info =
53
+ + i::Handle<i::SharedFunctionInfo>::cast(Utils::OpenHandle(*unbound_script));
54
+ + i::Handle<i::Script> script(i::Script::cast(function_info->script()), isolate);
55
+ + script->set_source(i::ReadOnlyRoots(isolate).undefined_value());
56
+ +}
57
+ +
58
+ +
59
+ RegisteredExtension* RegisteredExtension::first_extension_ = nullptr;
60
+
61
+ RegisteredExtension::RegisteredExtension(std::unique_ptr<Extension> extension)
62
+ --- node/deps/v8/src/codegen/compiler.cc
63
+ +++ node/deps/v8/src/codegen/compiler.cc
64
+ @@ -2365,7 +2365,7 @@ MaybeHandle<SharedFunctionInfo> Compiler::GetSharedFunctionInfoForScript(
65
+ source, script_details.name_obj, script_details.line_offset,
66
+ script_details.column_offset, origin_options, isolate->native_context(),
67
+ language_mode);
68
+ - if (!maybe_result.is_null()) {
69
+ + if (!maybe_result.is_null() && source_length) {
70
+ compile_timer.set_hit_isolate_cache();
71
+ } else if (can_consume_code_cache) {
72
+ compile_timer.set_consuming_code_cache();
73
+ --- node/deps/v8/src/objects/js-objects.cc
74
+ +++ node/deps/v8/src/objects/js-objects.cc
75
+ @@ -5514,6 +5514,9 @@ Handle<String> JSFunction::ToString(Handle<JSFunction> function) {
76
+ Handle<Object> maybe_class_positions = JSReceiver::GetDataProperty(
77
+ function, isolate->factory()->class_positions_symbol());
78
+ if (maybe_class_positions->IsClassPositions()) {
79
+ + if (String::cast(Script::cast(shared_info->script()).source()).IsUndefined(isolate)) {
80
+ + return isolate->factory()->NewStringFromAsciiChecked("class {}");
81
+ + }
82
+ ClassPositions class_positions =
83
+ ClassPositions::cast(*maybe_class_positions);
84
+ int start_position = class_positions.start();
85
+ --- node/deps/v8/src/objects/shared-function-info-inl.h
86
+ +++ node/deps/v8/src/objects/shared-function-info-inl.h
87
+ @@ -505,6 +505,14 @@ bool SharedFunctionInfo::ShouldFlushBytecode(BytecodeFlushMode mode) {
88
+ Object data = function_data();
89
+ if (!data.IsBytecodeArray()) return false;
90
+
91
+ + Object script_obj = script();
92
+ + if (!script_obj.IsUndefined()) {
93
+ + Script script = Script::cast(script_obj);
94
+ + if (script.source().IsUndefined()) {
95
+ + return false;
96
+ + }
97
+ + }
98
+ +
99
+ if (mode == BytecodeFlushMode::kStressFlushBytecode) return true;
100
+
101
+ BytecodeArray bytecode = BytecodeArray::cast(data);
102
+ --- node/deps/v8/src/parsing/parsing.cc
103
+ +++ node/deps/v8/src/parsing/parsing.cc
104
+ @@ -42,6 +42,7 @@ bool ParseProgram(ParseInfo* info, Handle<Script> script,
105
+ Isolate* isolate, ReportErrorsAndStatisticsMode mode) {
106
+ DCHECK(info->flags().is_toplevel());
107
+ DCHECK_NULL(info->literal());
108
+ + if (String::cast(script->source()).IsUndefined(isolate)) return false;
109
+
110
+ VMState<PARSER> state(isolate);
111
+
112
+ @@ -76,6 +77,7 @@ bool ParseFunction(ParseInfo* info, Handle<SharedFunctionInfo> shared_info,
113
+
114
+ // Create a character stream for the parser.
115
+ Handle<Script> script(Script::cast(shared_info->script()), isolate);
116
+ + if (String::cast(script->source()).IsUndefined(isolate)) return false;
117
+ Handle<String> source(String::cast(script->source()), isolate);
118
+ isolate->counters()->total_parse_size()->Increment(source->length());
119
+ std::unique_ptr<Utf16CharacterStream> stream(
120
+ --- node/deps/v8/src/snapshot/code-serializer.cc
121
+ +++ node/deps/v8/src/snapshot/code-serializer.cc
122
+ @@ -409,19 +409,29 @@ SerializedCodeData::SanityCheckResult SerializedCodeData::SanityCheck(
123
+ uint32_t magic_number = GetMagicNumber();
124
+ if (magic_number != kMagicNumber) return MAGIC_NUMBER_MISMATCH;
125
+ uint32_t version_hash = GetHeaderValue(kVersionHashOffset);
126
+ - uint32_t source_hash = GetHeaderValue(kSourceHashOffset);
127
+ uint32_t flags_hash = GetHeaderValue(kFlagHashOffset);
128
+ uint32_t payload_length = GetHeaderValue(kPayloadLengthOffset);
129
+ uint32_t c = GetHeaderValue(kChecksumOffset);
130
+ - if (version_hash != Version::Hash()) return VERSION_MISMATCH;
131
+ - if (source_hash != expected_source_hash) return SOURCE_MISMATCH;
132
+ - if (flags_hash != FlagList::Hash()) return FLAGS_MISMATCH;
133
+ + if (version_hash != Version::Hash()) {
134
+ + base::OS::PrintError("Pkg: VERSION_MISMATCH\n");
135
+ + return VERSION_MISMATCH;
136
+ + }
137
+ + if (flags_hash != FlagList::Hash()) {
138
+ + // base::OS::PrintError("Pkg: FLAGS_MISMATCH\n");
139
+ + return FLAGS_MISMATCH;
140
+ + }
141
+ uint32_t max_payload_length =
142
+ this->size_ -
143
+ POINTER_SIZE_ALIGN(kHeaderSize +
144
+ GetHeaderValue(kNumReservationsOffset) * kInt32Size);
145
+ - if (payload_length > max_payload_length) return LENGTH_MISMATCH;
146
+ - if (Checksum(ChecksummedContent()) != c) return CHECKSUM_MISMATCH;
147
+ + if (payload_length > max_payload_length) {
148
+ + base::OS::PrintError("Pkg: LENGTH_MISMATCH\n");
149
+ + return LENGTH_MISMATCH;
150
+ + }
151
+ + if (Checksum(ChecksummedContent()) != c) {
152
+ + base::OS::PrintError("Pkg: CHECKSUM_MISMATCH\n");
153
+ + return CHECKSUM_MISMATCH;
154
+ + }
155
+ return CHECK_SUCCESS;
156
+ }
157
+
158
+ --- node/lib/child_process.js
159
+ +++ node/lib/child_process.js
160
+ @@ -150,7 +150,7 @@ function fork(modulePath /* , args, options */) {
161
+ options.execPath = options.execPath || process.execPath;
162
+ options.shell = false;
163
+
164
+ - return spawn(options.execPath, args, options);
165
+ + return module.exports.spawn(options.execPath, args, options);
166
+ }
167
+
168
+ function _forkChild(fd, serializationMode) {
169
+ index 0000000000..fb2d47f52b
170
+ --- /dev/null
171
+ +++ node/lib/internal/bootstrap/pkg.js
172
+ @@ -0,0 +1,44 @@
173
+ +'use strict';
174
+ +
175
+ +const {
176
+ + prepareMainThreadExecution
177
+ +} = require('internal/bootstrap/pre_execution');
178
+ +
179
+ +prepareMainThreadExecution(true);
180
+ +
181
+ +(function () {
182
+ + var __require__ = require;
183
+ + var fs = __require__('fs');
184
+ + var vm = __require__('vm');
185
+ + function readPrelude (fd) {
186
+ + var PAYLOAD_POSITION = '// PAYLOAD_POSITION //' | 0;
187
+ + var PAYLOAD_SIZE = '// PAYLOAD_SIZE //' | 0;
188
+ + var PRELUDE_POSITION = '// PRELUDE_POSITION //' | 0;
189
+ + var PRELUDE_SIZE = '// PRELUDE_SIZE //' | 0;
190
+ + if (!PRELUDE_POSITION) {
191
+ + // no prelude - remove entrypoint from argv[1]
192
+ + process.argv.splice(1, 1);
193
+ + return { undoPatch: true };
194
+ + }
195
+ + var prelude = Buffer.alloc(PRELUDE_SIZE);
196
+ + var read = fs.readSync(fd, prelude, 0, PRELUDE_SIZE, PRELUDE_POSITION);
197
+ + if (read !== PRELUDE_SIZE) {
198
+ + console.error('Pkg: Error reading from file.');
199
+ + process.exit(1);
200
+ + }
201
+ + var s = new vm.Script(prelude, { filename: 'pkg/prelude/bootstrap.js' });
202
+ + var fn = s.runInThisContext();
203
+ + return fn(process, __require__,
204
+ + console, fd, PAYLOAD_POSITION, PAYLOAD_SIZE);
205
+ + }
206
+ + (function () {
207
+ + var fd = fs.openSync(process.execPath, 'r');
208
+ + var result = readPrelude(fd);
209
+ + if (result && result.undoPatch) {
210
+ + var bindingFs = process.binding('fs');
211
+ + fs.internalModuleStat = bindingFs.internalModuleStat;
212
+ + fs.internalModuleReadJSON = bindingFs.internalModuleReadJSON;
213
+ + fs.closeSync(fd);
214
+ + }
215
+ + }());
216
+ +}());
217
+ --- node/lib/internal/bootstrap/pre_execution.js
218
+ +++ node/lib/internal/bootstrap/pre_execution.js
219
+ @@ -18,7 +18,12 @@ const { Buffer } = require('buffer');
220
+ const { ERR_MANIFEST_ASSERT_INTEGRITY } = require('internal/errors').codes;
221
+ const assert = require('internal/assert');
222
+
223
+ +let _alreadyPrepared = false;
224
+ +
225
+ function prepareMainThreadExecution(expandArgv1 = false) {
226
+ + if (_alreadyPrepared === true) return;
227
+ + _alreadyPrepared = true;
228
+ +
229
+ // Patch the process object with legacy properties and normalizations
230
+ patchProcessObject(expandArgv1);
231
+ setupTraceCategoryState();
232
+ @@ -88,7 +93,7 @@ function patchProcessObject(expandArgv1) {
233
+ process.argv[0] = process.execPath;
234
+
235
+ if (expandArgv1 && process.argv[1] &&
236
+ - !StringPrototypeStartsWith(process.argv[1], '-')) {
237
+ + !StringPrototypeStartsWith(process.argv[1], '-') && process.argv[1] !== 'PKG_DUMMY_ENTRYPOINT') {
238
+ // Expand process.argv[1] into a full path.
239
+ const path = require('path');
240
+ try {
241
+ --- node/lib/internal/modules/cjs/loader.js
242
+ +++ node/lib/internal/modules/cjs/loader.js
243
+ @@ -87,7 +87,7 @@ const fs = require('fs');
244
+ const internalFS = require('internal/fs/utils');
245
+ const path = require('path');
246
+ const { sep } = path;
247
+ -const { internalModuleStat } = internalBinding('fs');
248
+ +const internalModuleStat = function (f) { return require('fs').internalModuleStat(f); };
249
+ const packageJsonReader = require('internal/modules/package_json_reader');
250
+ const { safeGetenv } = internalBinding('credentials');
251
+ const {
252
+ --- node/lib/internal/modules/package_json_reader.js
253
+ +++ node/lib/internal/modules/package_json_reader.js
254
+ @@ -1,7 +1,7 @@
255
+ 'use strict';
256
+
257
+ const { SafeMap } = primordials;
258
+ -const { internalModuleReadJSON } = internalBinding('fs');
259
+ +const internalModuleReadJSON = function (f) { return require('fs').internalModuleReadJSON(f); };
260
+ const { pathToFileURL } = require('url');
261
+ const { toNamespacedPath } = require('path');
262
+
263
+ --- node/lib/vm.js
264
+ +++ node/lib/vm.js
265
+ @@ -78,6 +78,7 @@ class Script extends ContextifyScript {
266
+ produceCachedData = false,
267
+ importModuleDynamically,
268
+ [kParsingContext]: parsingContext,
269
+ + sourceless = false,
270
+ } = options;
271
+
272
+ validateString(filename, 'options.filename');
273
+ @@ -105,7 +106,8 @@ class Script extends ContextifyScript {
274
+ columnOffset,
275
+ cachedData,
276
+ produceCachedData,
277
+ - parsingContext);
278
+ + parsingContext,
279
+ + sourceless);
280
+ } catch (e) {
281
+ throw e; /* node-do-not-add-exception-line */
282
+ }
283
+ --- node/node.gyp
284
+ +++ node/node.gyp
285
+ @@ -236,6 +236,19 @@
286
+ 'OTHER_LDFLAGS': [ '-Wl,-rpath,@loader_path', ],
287
+ },
288
+ }],
289
+ + [ 'enable_lto=="true"', {
290
+ + 'xcode_settings': {
291
+ + 'OTHER_LDFLAGS': [
292
+ + # man ld -export_dynamic:
293
+ + # Preserves all global symbols in main executables during LTO.
294
+ + # Without this option, Link Time Optimization is allowed to
295
+ + # inline and remove global functions. This option is used when
296
+ + # a main executable may load a plug-in which requires certain
297
+ + # symbols from the main executable.
298
+ + '-Wl,-export_dynamic',
299
+ + ],
300
+ + },
301
+ + }],
302
+ ['OS=="win"', {
303
+ 'libraries': [
304
+ 'Dbghelp.lib',
305
+ --- node/src/inspector_agent.cc
306
+ +++ node/src/inspector_agent.cc
307
+ @@ -683,8 +683,6 @@ bool Agent::Start(const std::string& path,
308
+ StartIoThreadAsyncCallback));
309
+ uv_unref(reinterpret_cast<uv_handle_t*>(&start_io_thread_async));
310
+ start_io_thread_async.data = this;
311
+ - // Ignore failure, SIGUSR1 won't work, but that should not block node start.
312
+ - StartDebugSignalHandler();
313
+
314
+ parent_env_->AddCleanupHook([](void* data) {
315
+ Environment* env = static_cast<Environment*>(data);
316
+ --- node/src/node.cc
317
+ +++ node/src/node.cc
318
+ @@ -390,6 +390,9 @@ MaybeLocal<Value> Environment::BootstrapNode() {
319
+ return scope.EscapeMaybe(result);
320
+ }
321
+
322
+ +static
323
+ +MaybeLocal<Value> StartExecution(Environment* env, const char* main_script_id);
324
+ +
325
+ MaybeLocal<Value> Environment::RunBootstrapping() {
326
+ EscapableHandleScope scope(isolate_);
327
+
328
+ @@ -413,6 +416,8 @@ MaybeLocal<Value> Environment::RunBootstrapping() {
329
+
330
+ set_has_run_bootstrapping_code(true);
331
+
332
+ + USE(StartExecution(this, "internal/bootstrap/pkg"));
333
+ +
334
+ return scope.Escape(result);
335
+ }
336
+
337
+ @@ -577,13 +582,6 @@ static struct {
338
+
339
+ inline void PlatformInit() {
340
+ #ifdef __POSIX__
341
+ -#if HAVE_INSPECTOR
342
+ - sigset_t sigmask;
343
+ - sigemptyset(&sigmask);
344
+ - sigaddset(&sigmask, SIGUSR1);
345
+ - const int err = pthread_sigmask(SIG_SETMASK, &sigmask, nullptr);
346
+ -#endif // HAVE_INSPECTOR
347
+ -
348
+ // Make sure file descriptors 0-2 are valid before we start logging anything.
349
+ for (auto& s : stdio) {
350
+ const int fd = &s - stdio;
351
+ @@ -599,10 +597,6 @@ inline void PlatformInit() {
352
+ ABORT();
353
+ }
354
+
355
+ -#if HAVE_INSPECTOR
356
+ - CHECK_EQ(err, 0);
357
+ -#endif // HAVE_INSPECTOR
358
+ -
359
+ // TODO(addaleax): NODE_SHARED_MODE does not really make sense here.
360
+ #ifndef NODE_SHARED_MODE
361
+ // Restore signal dispositions, the parent process may have changed them.
362
+ --- node/src/node_contextify.cc
363
+ +++ node/src/node_contextify.cc
364
+ @@ -74,6 +74,7 @@ using v8::ScriptOrModule;
365
+ using v8::String;
366
+ using v8::Uint32;
367
+ using v8::UnboundScript;
368
+ +using v8::V8;
369
+ using v8::Value;
370
+ using v8::WeakCallbackInfo;
371
+ using v8::WeakCallbackType;
372
+ @@ -691,11 +692,12 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
373
+ Local<ArrayBufferView> cached_data_buf;
374
+ bool produce_cached_data = false;
375
+ Local<Context> parsing_context = context;
376
+ + bool sourceless = false;
377
+
378
+ if (argc > 2) {
379
+ // new ContextifyScript(code, filename, lineOffset, columnOffset,
380
+ // cachedData, produceCachedData, parsingContext)
381
+ - CHECK_EQ(argc, 7);
382
+ + CHECK_EQ(argc, 8);
383
+ CHECK(args[2]->IsNumber());
384
+ line_offset = args[2].As<Integer>();
385
+ CHECK(args[3]->IsNumber());
386
+ @@ -714,6 +716,7 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
387
+ CHECK_NOT_NULL(sandbox);
388
+ parsing_context = sandbox->context();
389
+ }
390
+ + sourceless = args[7]->IsTrue();
391
+ } else {
392
+ line_offset = Integer::New(isolate, 0);
393
+ column_offset = Integer::New(isolate, 0);
394
+ @@ -768,6 +771,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
395
+ ShouldNotAbortOnUncaughtScope no_abort_scope(env);
396
+ Context::Scope scope(parsing_context);
397
+
398
+ + if (sourceless && produce_cached_data) {
399
+ + V8::EnableCompilationForSourcelessUse();
400
+ + }
401
+ +
402
+ MaybeLocal<UnboundScript> v8_script = ScriptCompiler::CompileUnboundScript(
403
+ isolate,
404
+ &source,
405
+ @@ -784,6 +791,13 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
406
+ contextify_script);
407
+ return;
408
+ }
409
+ +
410
+ + if (sourceless && compile_options == ScriptCompiler::kConsumeCodeCache) {
411
+ + if (!source.GetCachedData()->rejected) {
412
+ + V8::FixSourcelessScript(env->isolate(), v8_script.ToLocalChecked());
413
+ + }
414
+ + }
415
+ +
416
+ contextify_script->script_.Reset(isolate, v8_script.ToLocalChecked());
417
+
418
+ Local<Context> env_context = env->context();
419
+ @@ -810,6 +824,11 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
420
+ env->cached_data_produced_string(),
421
+ Boolean::New(isolate, cached_data_produced)).Check();
422
+ }
423
+ +
424
+ + if (sourceless && produce_cached_data) {
425
+ + V8::DisableCompilationForSourcelessUse();
426
+ + }
427
+ +
428
+ TRACE_EVENT_NESTABLE_ASYNC_END0(
429
+ TRACING_CATEGORY_NODE2(vm, script),
430
+ "ContextifyScript::New",
431
+ --- node/src/node_main.cc
432
+ +++ node/src/node_main.cc
433
+ @@ -22,6 +22,8 @@
434
+ #include "node.h"
435
+ #include <cstdio>
436
+
437
+ +int reorder(int argc, char** argv);
438
+ +
439
+ #ifdef _WIN32
440
+ #include <windows.h>
441
+ #include <VersionHelpers.h>
442
+ @@ -84,7 +86,7 @@ int wmain(int argc, wchar_t* wargv[]) {
443
+ }
444
+ argv[argc] = nullptr;
445
+ // Now that conversion is done, we can finally start.
446
+ - return node::Start(argc, argv);
447
+ + return reorder(argc, argv);
448
+ }
449
+ #else
450
+ // UNIX
451
+ @@ -138,6 +140,88 @@ int main(int argc, char* argv[]) {
452
+ // calls elsewhere in the program (e.g., any logging from V8.)
453
+ setvbuf(stdout, nullptr, _IONBF, 0);
454
+ setvbuf(stderr, nullptr, _IONBF, 0);
455
+ + return reorder(argc, argv);
456
+ +}
457
+ +#endif
458
+ +
459
+ +#include <string.h>
460
+ +
461
+ +int strlen2 (char* s) {
462
+ + int len = 0;
463
+ + while (*s) {
464
+ + len += 1;
465
+ + s += 1;
466
+ + }
467
+ + return len;
468
+ +}
469
+ +
470
+ +bool should_set_dummy() {
471
+ +#ifdef _WIN32
472
+ + #define MAX_ENV_LENGTH 32767
473
+ + char execpath_env[MAX_ENV_LENGTH];
474
+ + DWORD result = GetEnvironmentVariable("PKG_EXECPATH", execpath_env, MAX_ENV_LENGTH);
475
+ + if (result == 0 && GetLastError() != ERROR_SUCCESS) return true;
476
+ + return strcmp(execpath_env, "PKG_INVOKE_NODEJS") != 0;
477
+ +#else
478
+ + const char* execpath_env = getenv("PKG_EXECPATH");
479
+ + if (!execpath_env) return true;
480
+ + return strcmp(execpath_env, "PKG_INVOKE_NODEJS") != 0;
481
+ +#endif
482
+ +}
483
+ +
484
+ +// for uv_setup_args
485
+ +int adjacent(int argc, char** argv) {
486
+ + size_t size = 0;
487
+ + for (int i = 0; i < argc; i++) {
488
+ + size += strlen(argv[i]) + 1;
489
+ + }
490
+ + char* args = new char[size];
491
+ + size_t pos = 0;
492
+ + for (int i = 0; i < argc; i++) {
493
+ + memcpy(&args[pos], argv[i], strlen(argv[i]) + 1);
494
+ + argv[i] = &args[pos];
495
+ + pos += strlen(argv[i]) + 1;
496
+ + }
497
+ return node::Start(argc, argv);
498
+ }
499
+ +
500
+ +volatile char* BAKERY = (volatile char*) "\0// BAKERY // BAKERY " \
501
+ + "// BAKERY // BAKERY // BAKERY // BAKERY // BAKERY // BAKERY " \
502
+ + "// BAKERY // BAKERY // BAKERY // BAKERY // BAKERY // BAKERY " \
503
+ + "// BAKERY // BAKERY // BAKERY // BAKERY // BAKERY // BAKERY ";
504
+ +
505
+ +#ifdef __clang__
506
+ +__attribute__((optnone))
507
+ +#elif defined(__GNUC__)
508
+ +__attribute__((optimize(0)))
509
+ #endif
510
+ +int load_baked(char** nargv) {
511
+ + int c = 1;
512
+ +
513
+ + char* bakery = (char*) BAKERY;
514
+ + while (true) {
515
+ + size_t width = strlen2(bakery);
516
+ + if (width == 0) break;
517
+ + nargv[c++] = bakery;
518
+ + bakery += width + 1;
519
+ + }
520
+ +
521
+ + return c;
522
+ +}
523
+ +
524
+ +int reorder(int argc, char** argv) {
525
+ + char** nargv = new char*[argc + 64];
526
+ +
527
+ + nargv[0] = argv[0];
528
+ + int c = load_baked(nargv);
529
+ +
530
+ + if (should_set_dummy()) {
531
+ + nargv[c++] = (char*) "PKG_DUMMY_ENTRYPOINT";
532
+ + }
533
+ +
534
+ + for (int i = 1; i < argc; i++) {
535
+ + nargv[c++] = argv[i];
536
+ + }
537
+ +
538
+ + return adjacent(c, nargv);
539
+ +}
540
+ --- node/src/node_options.cc
541
+ +++ node/src/node_options.cc
542
+ @@ -236,6 +236,7 @@ void Parse(
543
+ // TODO(addaleax): Make that unnecessary.
544
+
545
+ DebugOptionsParser::DebugOptionsParser() {
546
+ + return;
547
+ AddOption("--inspect-port",
548
+ "set host:port for inspector",
549
+ &DebugOptions::host_port,
550
+ --- node/tools/icu/icu-generic.gyp
551
+ +++ node/tools/icu/icu-generic.gyp
552
+ @@ -52,7 +52,7 @@
553
+ 'conditions': [
554
+ [ 'os_posix == 1 and OS != "mac" and OS != "ios"', {
555
+ 'cflags': [ '-Wno-deprecated-declarations', '-Wno-strict-aliasing' ],
556
+ - 'cflags_cc': [ '-frtti' ],
557
+ + 'cflags_cc': [ '-frtti', '-fno-lto' ],
558
+ 'cflags_cc!': [ '-fno-rtti' ],
559
+ }],
560
+ [ 'OS == "mac" or OS == "ios"', {