Skip to content

Commit 6e19527

Browse files
committed
src: reduce unnecessary serialization of CLI options in C++
nodejs/node#52451
1 parent c5b5be4 commit 6e19527

1 file changed

Lines changed: 18 additions & 12 deletions

File tree

‎patches/node/fix_assert_module_in_the_renderer_process.patch‎

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,24 @@ index f9d29f0065b1de63a62cfdce74a9705c22dd87d7..3f44160f1bd40fc2d4658f10edf0d0b3
5858
}
5959

6060
diff --git a/src/node_options.cc b/src/node_options.cc
61-
index 28fbd93c5d4a6f379844e10e556920b7614910d8..53cf93719bea001db09697b56f197815549dc953 100644
61+
index 74955717117001393e8b55809b4e4a1424019dad..409c6e3918e3ef7c9d35f87e093cb965cb889dd7 100644
6262
--- a/src/node_options.cc
6363
+++ b/src/node_options.cc
64-
@@ -1321,6 +1321,11 @@ void GetEmbedderOptions(const FunctionCallbackInfo<Value>& args) {
65-
Local<Context> context = env->context();
66-
Local<Object> ret = Object::New(isolate);
64+
@@ -1393,14 +1393,16 @@ void GetEmbedderOptions(const FunctionCallbackInfo<Value>& args) {
65+
}
66+
Isolate* isolate = args.GetIsolate();
67+
68+
- constexpr size_t kOptionsSize = 4;
69+
+ constexpr size_t kOptionsSize = 5;
70+
std::array<Local<Name>, kOptionsSize> names = {
71+
+ FIXED_ONE_BYTE_STRING(env->isolate(), "hasPrepareStackTraceCallback"),
72+
FIXED_ONE_BYTE_STRING(env->isolate(), "shouldNotRegisterESMLoader"),
73+
FIXED_ONE_BYTE_STRING(env->isolate(), "noGlobalSearchPaths"),
74+
FIXED_ONE_BYTE_STRING(env->isolate(), "noBrowserGlobals"),
75+
FIXED_ONE_BYTE_STRING(env->isolate(), "hasEmbedderPreload")};
6776

68-
+ if (ret->Set(context,
69-
+ FIXED_ONE_BYTE_STRING(env->isolate(), "hasPrepareStackTraceCallback"),
70-
+ Boolean::New(isolate, !env->prepare_stack_trace_callback().IsEmpty()))
71-
+ .IsNothing()) return;
72-
+
73-
if (ret->Set(context,
74-
FIXED_ONE_BYTE_STRING(env->isolate(), "shouldNotRegisterESMLoader"),
75-
Boolean::New(isolate, env->should_not_register_esm_loader()))
77+
std::array<Local<Value>, kOptionsSize> values = {
78+
+ Boolean::New(isolate, env->prepare_stack_trace_callback().IsEmpty()),
79+
Boolean::New(isolate, env->should_not_register_esm_loader()),
80+
Boolean::New(isolate, env->no_global_search_paths()),
81+
Boolean::New(isolate, env->no_browser_globals()),

0 commit comments

Comments
 (0)