mirror of
https://github.com/nodejs/node.git
synced 2026-11-25 23:01:06 -05:00
src: allow embedder control of code generation policy
PR-URL: https://github.com/nodejs/node/pull/46368 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com>
This commit is contained in:
1 parent
aef57cd290
commit
e77d538d32
2 files changed
+13
-2
No files matched your search
@@ -265,8 +265,16 @@ void SetIsolateMiscHandlers(v8::Isolate* isolate, const IsolateSettings& s) {
|
||||
auto* allow_wasm_codegen_cb = s.allow_wasm_code_generation_callback ?
|
||||
s.allow_wasm_code_generation_callback : AllowWasmCodeGenerationCallback;
|
||||
isolate->SetAllowWasmCodeGenerationCallback(allow_wasm_codegen_cb);
|
||||
|
||||
auto* modify_code_generation_from_strings_callback =
|
||||
ModifyCodeGenerationFromStrings;
|
||||
if (s.flags & ALLOW_MODIFY_CODE_GENERATION_FROM_STRINGS_CALLBACK &&
|
||||
s.modify_code_generation_from_strings_callback) {
|
||||
modify_code_generation_from_strings_callback =
|
||||
s.modify_code_generation_from_strings_callback;
|
||||
}
|
||||
isolate->SetModifyCodeGenerationFromStringsCallback(
|
||||
ModifyCodeGenerationFromStrings);
|
||||
modify_code_generation_from_strings_callback);
|
||||
|
||||
Mutex::ScopedLock lock(node::per_process::cli_options_mutex);
|
||||
if (per_process::cli_options->get_per_isolate_options()
|
||||
|
||||
+4
-1
@@ -453,7 +453,8 @@ enum IsolateSettingsFlags {
|
||||
MESSAGE_LISTENER_WITH_ERROR_LEVEL = 1 << 0,
|
||||
DETAILED_SOURCE_POSITIONS_FOR_PROFILING = 1 << 1,
|
||||
SHOULD_NOT_SET_PROMISE_REJECTION_CALLBACK = 1 << 2,
|
||||
SHOULD_NOT_SET_PREPARE_STACK_TRACE_CALLBACK = 1 << 3
|
||||
SHOULD_NOT_SET_PREPARE_STACK_TRACE_CALLBACK = 1 << 3,
|
||||
ALLOW_MODIFY_CODE_GENERATION_FROM_STRINGS_CALLBACK = 1 << 4,
|
||||
};
|
||||
|
||||
struct IsolateSettings {
|
||||
@@ -471,6 +472,8 @@ struct IsolateSettings {
|
||||
v8::PromiseRejectCallback promise_reject_callback = nullptr;
|
||||
v8::AllowWasmCodeGenerationCallback
|
||||
allow_wasm_code_generation_callback = nullptr;
|
||||
v8::ModifyCodeGenerationFromStringsCallback2
|
||||
modify_code_generation_from_strings_callback = nullptr;
|
||||
};
|
||||
|
||||
// Overriding IsolateSettings may produce unexpected behavior
|
||||
|
||||
Reference in new issue
Block a user