Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e77d538

Browse filesBrowse files
codebytereMylesBorins
authored andcommitted
src: allow embedder control of code generation policy
PR-URL: #46368 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com>
1 parent aef57cd commit e77d538
Copy full SHA for e77d538

File tree

Expand file treeCollapse file tree

2 files changed

+13
-2
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+13
-2
lines changed
Open diff view settings
Collapse file

‎src/api/environment.cc‎

Copy file name to clipboardExpand all lines: src/api/environment.cc
+9-1Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,16 @@ void SetIsolateMiscHandlers(v8::Isolate* isolate, const IsolateSettings& s) {
265265
auto* allow_wasm_codegen_cb = s.allow_wasm_code_generation_callback ?
266266
s.allow_wasm_code_generation_callback : AllowWasmCodeGenerationCallback;
267267
isolate->SetAllowWasmCodeGenerationCallback(allow_wasm_codegen_cb);
268+
269+
auto* modify_code_generation_from_strings_callback =
270+
ModifyCodeGenerationFromStrings;
271+
if (s.flags & ALLOW_MODIFY_CODE_GENERATION_FROM_STRINGS_CALLBACK &&
272+
s.modify_code_generation_from_strings_callback) {
273+
modify_code_generation_from_strings_callback =
274+
s.modify_code_generation_from_strings_callback;
275+
}
268276
isolate->SetModifyCodeGenerationFromStringsCallback(
269-
ModifyCodeGenerationFromStrings);
277+
modify_code_generation_from_strings_callback);
270278

271279
Mutex::ScopedLock lock(node::per_process::cli_options_mutex);
272280
if (per_process::cli_options->get_per_isolate_options()
Collapse file

‎src/node.h‎

Copy file name to clipboardExpand all lines: src/node.h
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,8 @@ enum IsolateSettingsFlags {
453453
MESSAGE_LISTENER_WITH_ERROR_LEVEL = 1 << 0,
454454
DETAILED_SOURCE_POSITIONS_FOR_PROFILING = 1 << 1,
455455
SHOULD_NOT_SET_PROMISE_REJECTION_CALLBACK = 1 << 2,
456-
SHOULD_NOT_SET_PREPARE_STACK_TRACE_CALLBACK = 1 << 3
456+
SHOULD_NOT_SET_PREPARE_STACK_TRACE_CALLBACK = 1 << 3,
457+
ALLOW_MODIFY_CODE_GENERATION_FROM_STRINGS_CALLBACK = 1 << 4,
457458
};
458459

459460
struct IsolateSettings {
@@ -471,6 +472,8 @@ struct IsolateSettings {
471472
v8::PromiseRejectCallback promise_reject_callback = nullptr;
472473
v8::AllowWasmCodeGenerationCallback
473474
allow_wasm_code_generation_callback = nullptr;
475+
v8::ModifyCodeGenerationFromStringsCallback2
476+
modify_code_generation_from_strings_callback = nullptr;
474477
};
475478

476479
// Overriding IsolateSettings may produce unexpected behavior

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.