Skip to content

Commit

Permalink
src: allow embedder control of code generation policy
Browse files Browse the repository at this point in the history
  • Loading branch information
codebytere committed Jan 26, 2023
1 parent 8ba54e5 commit 8c13d11
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/api/environment.cc
Expand Up @@ -265,8 +265,10 @@ 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);
isolate->SetModifyCodeGenerationFromStringsCallback(
ModifyCodeGenerationFromStrings);

auto* modify_code_generation_from_strings_callback = s.modify_code_generation_from_strings_callback ?
s.modify_code_generation_from_strings_callback : ModifyCodeGenerationFromStrings;
isolate->SetModifyCodeGenerationFromStringsCallback(modify_code_generation_from_strings_callback);

Mutex::ScopedLock lock(node::per_process::cli_options_mutex);
if (per_process::cli_options->get_per_isolate_options()
Expand Down
2 changes: 2 additions & 0 deletions src/node.h
Expand Up @@ -471,6 +471,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
Expand Down

0 comments on commit 8c13d11

Please sign in to comment.