OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/api.h" | 5 #include "src/api.h" |
6 | 6 |
7 #include <string.h> // For memcpy, strlen. | 7 #include <string.h> // For memcpy, strlen. |
8 #ifdef V8_USE_ADDRESS_SANITIZER | 8 #ifdef V8_USE_ADDRESS_SANITIZER |
9 #include <sanitizer/asan_interface.h> | 9 #include <sanitizer/asan_interface.h> |
10 #endif // V8_USE_ADDRESS_SANITIZER | 10 #endif // V8_USE_ADDRESS_SANITIZER |
(...skipping 8706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8717 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | 8717 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
8718 isolate->set_oom_behavior(that); | 8718 isolate->set_oom_behavior(that); |
8719 } | 8719 } |
8720 | 8720 |
8721 void Isolate::SetAllowCodeGenerationFromStringsCallback( | 8721 void Isolate::SetAllowCodeGenerationFromStringsCallback( |
8722 AllowCodeGenerationFromStringsCallback callback) { | 8722 AllowCodeGenerationFromStringsCallback callback) { |
8723 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | 8723 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
8724 isolate->set_allow_code_gen_callback(callback); | 8724 isolate->set_allow_code_gen_callback(callback); |
8725 } | 8725 } |
8726 | 8726 |
8727 void Isolate::SetAllowWasmCompileCallback(AllowWasmCompileCallback callback) { | |
8728 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | |
8729 isolate->set_allow_wasm_compile_callback(callback); | |
8730 } | |
8731 | |
8732 void Isolate::SetAllowWasmInstantiateCallback( | |
8733 AllowWasmInstantiateCallback callback) { | |
8734 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | |
8735 isolate->set_allow_wasm_instantiate_callback(callback); | |
8736 } | |
8737 | |
8738 #define CALLBACK_SETTER(ExternalName, Type, InternalName) \ | 8727 #define CALLBACK_SETTER(ExternalName, Type, InternalName) \ |
8739 void Isolate::Set##ExternalName(Type callback) { \ | 8728 void Isolate::Set##ExternalName(Type callback) { \ |
8740 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); \ | 8729 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); \ |
8741 isolate->set_##InternalName(callback); \ | 8730 isolate->set_##InternalName(callback); \ |
8742 } | 8731 } |
8743 | 8732 |
8744 CALLBACK_SETTER(WasmModuleCallback, ExtensionCallback, wasm_module_callback) | 8733 CALLBACK_SETTER(WasmModuleCallback, ExtensionCallback, wasm_module_callback) |
8745 CALLBACK_SETTER(WasmCompileCallback, ExtensionCallback, wasm_compile_callback) | 8734 CALLBACK_SETTER(WasmCompileCallback, ExtensionCallback, wasm_compile_callback) |
8746 CALLBACK_SETTER(WasmInstanceCallback, ExtensionCallback, wasm_instance_callback) | 8735 CALLBACK_SETTER(WasmInstanceCallback, ExtensionCallback, wasm_instance_callback) |
8747 CALLBACK_SETTER(WasmInstantiateCallback, ExtensionCallback, | 8736 CALLBACK_SETTER(WasmInstantiateCallback, ExtensionCallback, |
(...skipping 1610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10358 Address callback_address = | 10347 Address callback_address = |
10359 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 10348 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
10360 VMState<EXTERNAL> state(isolate); | 10349 VMState<EXTERNAL> state(isolate); |
10361 ExternalCallbackScope call_scope(isolate, callback_address); | 10350 ExternalCallbackScope call_scope(isolate, callback_address); |
10362 callback(info); | 10351 callback(info); |
10363 } | 10352 } |
10364 | 10353 |
10365 | 10354 |
10366 } // namespace internal | 10355 } // namespace internal |
10367 } // namespace v8 | 10356 } // namespace v8 |
OLD | NEW |