GeezerVison is showing github.com — src: allow embedder control of code generation policy · nodejs/node@17eea18
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: src/api/environment.cc +9-1Lines changed: 9 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -263,8 +263,16 @@ void SetIsolateMiscHandlers(v8::Isolate* isolate, const IsolateSettings& s) { |
263 | 263 | auto* allow_wasm_codegen_cb = s.allow_wasm_code_generation_callback ? |
264 | 264 | s.allow_wasm_code_generation_callback : AllowWasmCodeGenerationCallback; |
265 | 265 | isolate->SetAllowWasmCodeGenerationCallback(allow_wasm_codegen_cb); |
| 266 | + |
| 267 | + auto* modify_code_generation_from_strings_callback = |
| 268 | + ModifyCodeGenerationFromStrings; |
| 269 | + if (s.flags & ALLOW_MODIFY_CODE_GENERATION_FROM_STRINGS_CALLBACK && |
| 270 | + s.modify_code_generation_from_strings_callback) { |
| 271 | + modify_code_generation_from_strings_callback = |
| 272 | + s.modify_code_generation_from_strings_callback; |
| 273 | + } |
266 | 274 | isolate->SetModifyCodeGenerationFromStringsCallback( |
267 | | - ModifyCodeGenerationFromStrings); |
| 275 | + modify_code_generation_from_strings_callback); |
268 | 276 |
|
269 | 277 | Mutex::ScopedLock lock(node::per_process::cli_options_mutex); |
270 | 278 | if (per_process::cli_options->get_per_isolate_options() |
|
Collapse file
Copy file name to clipboardExpand all lines: src/node.h +4-1Lines changed: 4 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -438,7 +438,8 @@ enum IsolateSettingsFlags { |
438 | 438 | MESSAGE_LISTENER_WITH_ERROR_LEVEL = 1 << 0, |
439 | 439 | DETAILED_SOURCE_POSITIONS_FOR_PROFILING = 1 << 1, |
440 | 440 | SHOULD_NOT_SET_PROMISE_REJECTION_CALLBACK = 1 << 2, |
441 | | - SHOULD_NOT_SET_PREPARE_STACK_TRACE_CALLBACK = 1 << 3 |
| 441 | + SHOULD_NOT_SET_PREPARE_STACK_TRACE_CALLBACK = 1 << 3, |
| 442 | + ALLOW_MODIFY_CODE_GENERATION_FROM_STRINGS_CALLBACK = 1 << 4, |
442 | 443 | }; |
443 | 444 |
|
444 | 445 | struct IsolateSettings { |
@@ -456,6 +457,8 @@ struct IsolateSettings { |
456 | 457 | v8::PromiseRejectCallback promise_reject_callback = nullptr; |
457 | 458 | v8::AllowWasmCodeGenerationCallback |
458 | 459 | allow_wasm_code_generation_callback = nullptr; |
| 460 | + v8::ModifyCodeGenerationFromStringsCallback2 |
| 461 | + modify_code_generation_from_strings_callback = nullptr; |
459 | 462 | }; |
460 | 463 |
|
461 | 464 | // Overriding IsolateSettings may produce unexpected behavior |
|