Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(182)

Side by Side Diff: src/api.cc

Issue 2773063002: [wasm] Override mechanism for wasm js APIs (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 8720 matching lines...) Expand 10 before | Expand all | Expand 10 after
8731 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); 8731 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
8732 isolate->set_allow_wasm_compile_callback(callback); 8732 isolate->set_allow_wasm_compile_callback(callback);
8733 } 8733 }
8734 8734
8735 void Isolate::SetAllowWasmInstantiateCallback( 8735 void Isolate::SetAllowWasmInstantiateCallback(
8736 AllowWasmInstantiateCallback callback) { 8736 AllowWasmInstantiateCallback callback) {
8737 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); 8737 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
8738 isolate->set_allow_wasm_instantiate_callback(callback); 8738 isolate->set_allow_wasm_instantiate_callback(callback);
8739 } 8739 }
8740 8740
8741 #define CALLBACK_SETTER(ExternalName, Type, InternalName) \
8742 void Isolate::Set##ExternalName(Type callback) { \
8743 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); \
8744 isolate->set_##InternalName(callback); \
8745 }
8746
8747 CALLBACK_SETTER(WasmModuleCallback, ExtensionCallback, wasm_module_callback)
8748 CALLBACK_SETTER(WasmCompileCallback, ExtensionCallback, wasm_compile_callback)
8749 CALLBACK_SETTER(WasmInstanceCallback, ExtensionCallback, wasm_instance_callback)
8750 CALLBACK_SETTER(WasmInstantiateCallback, ExtensionCallback,
8751 wasm_instantiate_callback)
8752
8741 bool Isolate::IsDead() { 8753 bool Isolate::IsDead() {
8742 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); 8754 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
8743 return isolate->IsDead(); 8755 return isolate->IsDead();
8744 } 8756 }
8745 8757
8746 bool Isolate::AddMessageListener(MessageCallback that, Local<Value> data) { 8758 bool Isolate::AddMessageListener(MessageCallback that, Local<Value> data) {
8747 return AddMessageListenerWithErrorLevel(that, kMessageError, data); 8759 return AddMessageListenerWithErrorLevel(that, kMessageError, data);
8748 } 8760 }
8749 8761
8750 bool Isolate::AddMessageListenerWithErrorLevel(MessageCallback that, 8762 bool Isolate::AddMessageListenerWithErrorLevel(MessageCallback that,
(...skipping 1568 matching lines...) Expand 10 before | Expand all | Expand 10 after
10319 Address callback_address = 10331 Address callback_address =
10320 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 10332 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
10321 VMState<EXTERNAL> state(isolate); 10333 VMState<EXTERNAL> state(isolate);
10322 ExternalCallbackScope call_scope(isolate, callback_address); 10334 ExternalCallbackScope call_scope(isolate, callback_address);
10323 callback(info); 10335 callback(info);
10324 } 10336 }
10325 10337
10326 10338
10327 } // namespace internal 10339 } // namespace internal
10328 } // namespace v8 10340 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698