Skip to content

Commit

Permalink
Merge pull request #1 from vercel/main
Browse files Browse the repository at this point in the history
patches: bump to 18.12.1, 16.18.1 and 14.21.1 (vercel#260)
  • Loading branch information
dyllan-to-you authored Nov 17, 2022
2 parents 6e2309f + 794e97e commit 0bef926
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 74 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ index 0000000000..fb2d47f52b
Environment* env = static_cast<Environment*>(data);
--- node/src/node.cc
+++ node/src/node.cc
@@ -386,6 +386,9 @@ MaybeLocal<Value> Environment::BootstrapNode() {
@@ -390,6 +390,9 @@ MaybeLocal<Value> Environment::BootstrapNode() {
return scope.EscapeMaybe(result);
}

Expand All @@ -325,7 +325,7 @@ index 0000000000..fb2d47f52b
MaybeLocal<Value> Environment::RunBootstrapping() {
EscapableHandleScope scope(isolate_);

@@ -409,6 +412,8 @@ MaybeLocal<Value> Environment::RunBootstrapping() {
@@ -413,6 +416,8 @@ MaybeLocal<Value> Environment::RunBootstrapping() {

set_has_run_bootstrapping_code(true);

Expand All @@ -334,7 +334,7 @@ index 0000000000..fb2d47f52b
return scope.Escape(result);
}

@@ -573,13 +578,6 @@ static struct {
@@ -577,13 +582,6 @@ static struct {

inline void PlatformInit() {
#ifdef __POSIX__
Expand All @@ -348,7 +348,7 @@ index 0000000000..fb2d47f52b
// Make sure file descriptors 0-2 are valid before we start logging anything.
for (auto& s : stdio) {
const int fd = &s - stdio;
@@ -595,10 +593,6 @@ inline void PlatformInit() {
@@ -599,10 +597,6 @@ inline void PlatformInit() {
ABORT();
}

Expand Down
43 changes: 22 additions & 21 deletions patches/node.v16.16.0.cpp.patch → patches/node.v16.18.1.cpp.patch
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
if (Checksum(ChecksummedContent()) != c) return CHECKSUM_MISMATCH;
--- node/lib/child_process.js
+++ node/lib/child_process.js
@@ -163,7 +163,7 @@ function fork(modulePath, args = [], options) {
@@ -166,7 +166,7 @@ function fork(modulePath, args = [], options) {
options.execPath = options.execPath || process.execPath;
options.shell = false;

Expand Down Expand Up @@ -189,20 +189,21 @@ index 0000000000..fb2d47f52b
+}());
--- node/lib/internal/bootstrap/pre_execution.js
+++ node/lib/internal/bootstrap/pre_execution.js
@@ -25,7 +25,12 @@ const { Buffer } = require('buffer');
@@ -26,8 +26,13 @@ const { Buffer } = require('buffer');
const { ERR_MANIFEST_ASSERT_INTEGRITY } = require('internal/errors').codes;
const assert = require('internal/assert');

+let _alreadyPrepared = false;
+
function prepareMainThreadExecution(expandArgv1 = false) {
function prepareMainThreadExecution(expandArgv1 = false,
initialzeModules = true) {
+ if (_alreadyPrepared === true) return;
+ _alreadyPrepared = true;
+
refreshRuntimeOptions();

// TODO(joyeecheung): this is also necessary for workers when they deserialize
// this toggle from the snapshot.
reconnectZeroFillToggle();
@@ -100,7 +105,8 @@ function patchProcessObject(expandArgv1) {
@@ -119,7 +124,8 @@ function patchProcessObject(expandArgv1) {
process.argv[0] = process.execPath;

if (expandArgv1 && process.argv[1] &&
Expand All @@ -214,7 +215,7 @@ index 0000000000..fb2d47f52b
try {
--- node/lib/internal/modules/cjs/loader.js
+++ node/lib/internal/modules/cjs/loader.js
@@ -86,7 +86,7 @@ const fs = require('fs');
@@ -92,7 +92,7 @@ const fs = require('fs');
const internalFS = require('internal/fs/utils');
const path = require('path');
const { sep } = path;
Expand Down Expand Up @@ -267,16 +268,16 @@ index 0000000000..fb2d47f52b
Environment* env = static_cast<Environment*>(data);
--- node/src/node.cc
+++ node/src/node.cc
@@ -473,6 +473,8 @@ MaybeLocal<Value> StartExecution(Environment* env, StartExecutionCallback cb) {
return scope.EscapeMaybe(cb(info));
@@ -481,6 +481,8 @@ MaybeLocal<Value> StartExecution(Environment* env, StartExecutionCallback cb) {
return env->RunSnapshotDeserializeMain();
}

+ StartExecution(env, "internal/bootstrap/pkg");
+
if (env->worker_context() != nullptr) {
return StartExecution(env, "internal/main/worker_thread");
}
@@ -583,13 +585,6 @@ static struct {
@@ -599,13 +601,6 @@ static struct {

inline void PlatformInit() {
#ifdef __POSIX__
Expand All @@ -290,7 +291,7 @@ index 0000000000..fb2d47f52b
// Make sure file descriptors 0-2 are valid before we start logging anything.
for (auto& s : stdio) {
const int fd = &s - stdio;
@@ -605,10 +600,6 @@ inline void PlatformInit() {
@@ -621,10 +616,6 @@ inline void PlatformInit() {
ABORT();
}

Expand All @@ -311,7 +312,7 @@ index 0000000000..fb2d47f52b
using v8::Value;
using v8::WeakCallbackInfo;
using v8::WeakCallbackType;
@@ -709,11 +710,12 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
@@ -711,11 +712,12 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
Local<ArrayBufferView> cached_data_buf;
bool produce_cached_data = false;
Local<Context> parsing_context = context;
Expand All @@ -325,15 +326,15 @@ index 0000000000..fb2d47f52b
CHECK(args[2]->IsNumber());
line_offset = args[2].As<Int32>()->Value();
CHECK(args[3]->IsNumber());
@@ -732,6 +734,7 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
@@ -734,6 +736,7 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
CHECK_NOT_NULL(sandbox);
parsing_context = sandbox->context();
}
+ sourceless = args[7]->IsTrue();
}

ContextifyScript* contextify_script =
@@ -784,6 +787,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
@@ -785,6 +788,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
ShouldNotAbortOnUncaughtScope no_abort_scope(env);
Context::Scope scope(parsing_context);

Expand All @@ -344,8 +345,8 @@ index 0000000000..fb2d47f52b
MaybeLocal<UnboundScript> v8_script = ScriptCompiler::CompileUnboundScript(
isolate,
&source,
@@ -800,6 +807,13 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
contextify_script);
@@ -799,6 +806,13 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
"ContextifyScript::New");
return;
}
+
Expand All @@ -358,7 +359,7 @@ index 0000000000..fb2d47f52b
contextify_script->script_.Reset(isolate, v8_script.ToLocalChecked());

Local<Context> env_context = env->context();
@@ -826,6 +840,11 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
@@ -825,6 +839,11 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
env->cached_data_produced_string(),
Boolean::New(isolate, cached_data_produced)).Check();
}
Expand All @@ -367,9 +368,9 @@ index 0000000000..fb2d47f52b
+ V8::DisableCompilationForSourcelessUse();
+ }
+
TRACE_EVENT_NESTABLE_ASYNC_END0(
TRACING_CATEGORY_NODE2(vm, script),
"ContextifyScript::New",
TRACE_EVENT_END0(TRACING_CATEGORY_NODE2(vm, script), "ContextifyScript::New");
}

--- node/src/node_main.cc
+++ node/src/node_main.cc
@@ -22,6 +22,8 @@
Expand Down Expand Up @@ -481,7 +482,7 @@ index 0000000000..fb2d47f52b
+}
--- node/src/node_options.cc
+++ node/src/node_options.cc
@@ -254,6 +254,7 @@ void Parse(
@@ -275,6 +275,7 @@ void Parse(
// TODO(addaleax): Make that unnecessary.

DebugOptionsParser::DebugOptionsParser() {
Expand Down
81 changes: 35 additions & 46 deletions patches/node.v18.5.0.cpp.patch → patches/node.v18.12.1.cpp.patch
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

--- node/deps/v8/src/api/api.cc
+++ node/deps/v8/src/api/api.cc
@@ -706,6 +706,29 @@ void V8::SetFlagsFromCommandLine(int* argc, char** argv, bool remove_flags) {
@@ -709,6 +709,29 @@ void V8::SetFlagsFromCommandLine(int* argc, char** argv, bool remove_flags) {
HelpOptions(HelpOptions::kDontExit));
}

Expand Down Expand Up @@ -140,7 +140,7 @@
if (payload_length > max_payload_length) {
--- node/lib/child_process.js
+++ node/lib/child_process.js
@@ -160,7 +160,7 @@ function fork(modulePath, args = [], options) {
@@ -164,7 +164,7 @@ function fork(modulePath, args = [], options) {
throw new ERR_CHILD_PROCESS_IPC_REQUIRED('options.stdio');
}

Expand All @@ -157,7 +157,7 @@ index 00000000000..fb2d47f52b6
+
+const {
+ prepareMainThreadExecution
+} = require('internal/bootstrap/pre_execution');
+} = require('internal/process/pre_execution');
+
+prepareMainThreadExecution(true);
+
Expand Down Expand Up @@ -197,12 +197,12 @@ index 00000000000..fb2d47f52b6
+ }
+ }());
+}());
--- node/lib/internal/bootstrap/pre_execution.js
+++ node/lib/internal/bootstrap/pre_execution.js
@@ -29,8 +29,13 @@ const {
} = require('internal/errors').codes;
const assert = require('internal/assert');
--- node/lib/internal/process/pre_execution.js
+++ node/lib/internal/process/pre_execution.js
@@ -33,8 +33,13 @@ const {
isBuildingSnapshot,
} = require('v8').startupSnapshot;

+let _alreadyPrepared = false;
+
function prepareMainThreadExecution(expandArgv1 = false,
Expand All @@ -211,9 +211,9 @@ index 00000000000..fb2d47f52b6
+ _alreadyPrepared = true;
+
refreshRuntimeOptions();

// TODO(joyeecheung): this is also necessary for workers when they deserialize
@@ -119,7 +124,8 @@ function patchProcessObject(expandArgv1) {
@@ -128,7 +133,8 @@ function patchProcessObject(expandArgv1) {
process.argv[0] = process.execPath;

if (expandArgv1 && process.argv[1] &&
Expand All @@ -223,7 +223,7 @@ index 00000000000..fb2d47f52b6
// Expand process.argv[1] into a full path.
const path = require('path');
try {
@@ -574,6 +580,7 @@ function loadPreloadModules() {
@@ -589,6 +595,7 @@ function loadPreloadModules() {
// For user code, we preload modules if `-r` is passed
const preloadModules = getOptionValue('--require');
if (preloadModules && preloadModules.length > 0) {
Expand All @@ -233,7 +233,7 @@ index 00000000000..fb2d47f52b6
_preloadModules
--- node/lib/internal/modules/cjs/loader.js
+++ node/lib/internal/modules/cjs/loader.js
@@ -86,7 +86,7 @@ const fs = require('fs');
@@ -92,7 +92,7 @@ const fs = require('fs');
const internalFS = require('internal/fs/utils');
const path = require('path');
const { sep } = path;
Expand Down Expand Up @@ -275,7 +275,7 @@ index 00000000000..fb2d47f52b6
}
--- node/src/inspector_agent.cc
+++ node/src/inspector_agent.cc
@@ -690,8 +690,6 @@ bool Agent::Start(const std::string& path,
@@ -693,8 +693,6 @@ bool Agent::Start(const std::string& path,
StartIoThreadAsyncCallback));
uv_unref(reinterpret_cast<uv_handle_t*>(&start_io_thread_async));
start_io_thread_async.data = this;
Expand All @@ -286,40 +286,30 @@ index 00000000000..fb2d47f52b6
Environment* env = static_cast<Environment*>(data);
--- node/src/node.cc
+++ node/src/node.cc
@@ -482,6 +482,8 @@ MaybeLocal<Value> StartExecution(Environment* env, StartExecutionCallback cb) {
return scope.EscapeMaybe(cb(info));
@@ -458,6 +458,8 @@ MaybeLocal<Value> StartExecution(Environment* env, StartExecutionCallback cb) {
return env->RunSnapshotDeserializeMain();
}

+ StartExecution(env, "internal/bootstrap/pkg");
+
if (env->worker_context() != nullptr) {
return StartExecution(env, "internal/main/worker_thread");
}
@@ -600,13 +602,6 @@ static struct {
@@ -628,14 +630,6 @@ static void PlatformInit(ProcessInitializationFlags::Flags flags) {
}

inline void PlatformInit() {
#ifdef __POSIX__
if (!(flags & ProcessInitializationFlags::kNoDefaultSignalHandling)) {
-#if HAVE_INSPECTOR
- sigset_t sigmask;
- sigemptyset(&sigmask);
- sigaddset(&sigmask, SIGUSR1);
- const int err = pthread_sigmask(SIG_SETMASK, &sigmask, nullptr);
- sigset_t sigmask;
- sigemptyset(&sigmask);
- sigaddset(&sigmask, SIGUSR1);
- const int err = pthread_sigmask(SIG_SETMASK, &sigmask, nullptr);
- CHECK_EQ(err, 0);
-#endif // HAVE_INSPECTOR
-
// Make sure file descriptors 0-2 are valid before we start logging anything.
for (auto& s : stdio) {
const int fd = &s - stdio;
@@ -622,10 +617,6 @@ inline void PlatformInit() {
ABORT();
ResetSignalHandlers();
}

-#if HAVE_INSPECTOR
- CHECK_EQ(err, 0);
-#endif // HAVE_INSPECTOR
-
// TODO(addaleax): NODE_SHARED_MODE does not really make sense here.
#ifndef NODE_SHARED_MODE
// Restore signal dispositions, the parent process may have changed them.
--- node/src/node_contextify.cc
+++ node/src/node_contextify.cc
@@ -74,6 +74,7 @@ using v8::ScriptOrModule;
Expand All @@ -330,7 +320,7 @@ index 00000000000..fb2d47f52b6
using v8::Value;
using v8::WeakCallbackInfo;
using v8::WeakCallbackType;
@@ -701,11 +702,12 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
@@ -741,11 +742,12 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
Local<ArrayBufferView> cached_data_buf;
bool produce_cached_data = false;
Local<Context> parsing_context = context;
Expand All @@ -344,15 +334,15 @@ index 00000000000..fb2d47f52b6
CHECK(args[2]->IsNumber());
line_offset = args[2].As<Int32>()->Value();
CHECK(args[3]->IsNumber());
@@ -724,6 +726,7 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
@@ -764,6 +766,7 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
CHECK_NOT_NULL(sandbox);
parsing_context = sandbox->context();
}
+ sourceless = args[7]->IsTrue();
}

ContextifyScript* contextify_script =
@@ -775,6 +778,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
@@ -814,6 +817,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
ShouldNotAbortOnUncaughtScope no_abort_scope(env);
Context::Scope scope(parsing_context);

Expand All @@ -363,7 +353,7 @@ index 00000000000..fb2d47f52b6
MaybeLocal<UnboundScript> v8_script = ScriptCompiler::CompileUnboundScript(
isolate,
&source,
@@ -789,6 +796,13 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
@@ -828,6 +835,13 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
"ContextifyScript::New");
return;
}
Expand All @@ -377,7 +367,7 @@ index 00000000000..fb2d47f52b6
contextify_script->script_.Reset(isolate, v8_script.ToLocalChecked());

Local<Context> env_context = env->context();
@@ -815,6 +829,11 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
@@ -854,6 +868,11 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
env->cached_data_produced_string(),
Boolean::New(isolate, cached_data_produced)).Check();
}
Expand All @@ -400,7 +390,7 @@ index 00000000000..fb2d47f52b6
#ifdef _WIN32
#include <windows.h>
#include <VersionHelpers.h>
@@ -84,7 +86,7 @@ int wmain(int argc, wchar_t* wargv[]) {
@@ -84,12 +86,95 @@ int wmain(int argc, wchar_t* wargv[]) {
}
argv[argc] = nullptr;
// Now that conversion is done, we can finally start.
Expand All @@ -409,10 +399,8 @@ index 00000000000..fb2d47f52b6
}
#else
// UNIX
@@ -124,6 +126,88 @@ int main(int argc, char* argv[]) {
// calls elsewhere in the program (e.g., any logging from V8.)
setvbuf(stdout, nullptr, _IONBF, 0);
setvbuf(stderr, nullptr, _IONBF, 0);

int main(int argc, char* argv[]) {
+ return reorder(argc, argv);
+}
+#endif
Expand Down Expand Up @@ -468,6 +456,7 @@ index 00000000000..fb2d47f52b6
+#elif defined(__GNUC__)
+__attribute__((optimize(0)))
#endif
+
+int load_baked(char** nargv) {
+ int c = 1;
+
Expand Down Expand Up @@ -500,7 +489,7 @@ index 00000000000..fb2d47f52b6
+}
--- node/src/node_options.cc
+++ node/src/node_options.cc
@@ -275,6 +275,7 @@ void Parse(
@@ -299,6 +299,7 @@ void Parse(
// TODO(addaleax): Make that unnecessary.

DebugOptionsParser::DebugOptionsParser() {
Expand Down
Loading

0 comments on commit 0bef926

Please sign in to comment.