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

Unified Diff: src/runtime/runtime-test.cc

Issue 2806073002: [wasm] instantiate expressed in terms of compile (Closed)
Patch Set: intantiate 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 side-by-side diff with in-line comments
Download patch
Index: src/runtime/runtime-test.cc
diff --git a/src/runtime/runtime-test.cc b/src/runtime/runtime-test.cc
index 3270055caba6c57eccc9f13a4be31a38ffe7d50a..95bc30d9093cb5dba9d90efbdaed20cfe5a5e691 100644
--- a/src/runtime/runtime-test.cc
+++ b/src/runtime/runtime-test.cc
@@ -111,6 +111,15 @@ bool WasmInstantiateOverride(const v8::FunctionCallbackInfo<v8::Value>& args) {
return true;
}
+bool GetWasmFromResolvedPromise(
+ const v8::FunctionCallbackInfo<v8::Value>& args) {
+ CHECK(args.Length() == 1);
+ v8::Local<v8::Promise> promise = v8::Local<v8::Promise>::Cast(args[0]);
+ CHECK(promise->State() == v8::Promise::PromiseState::kFulfilled);
+ args.GetReturnValue().Set(promise);
+ return true;
+}
+
} // namespace
namespace v8 {
@@ -445,6 +454,24 @@ RUNTIME_FUNCTION(Runtime_ClearFunctionFeedback) {
return isolate->heap()->undefined_value();
}
+RUNTIME_FUNCTION(Runtime_SetWasmCompileFromPromiseOverload) {
+ v8::ExtensionCallback old = isolate->wasm_compile_callback();
+ HandleScope scope(isolate);
+ Handle<Foreign> ret =
+ isolate->factory()->NewForeign(reinterpret_cast<Address>(old));
+ isolate->set_wasm_compile_callback(GetWasmFromResolvedPromise);
+ return *ret;
+}
+
+RUNTIME_FUNCTION(Runtime_ResetWasmOverloads) {
+ HandleScope scope(isolate);
+ DCHECK_EQ(1, args.length());
+ CONVERT_ARG_HANDLE_CHECKED(Foreign, old, 0);
+ isolate->set_wasm_compile_callback(
+ reinterpret_cast<v8::ExtensionCallback>(old->foreign_address()));
+ return isolate->heap()->undefined_value();
+}
+
RUNTIME_FUNCTION(Runtime_CheckWasmWrapperElision) {
// This only supports the case where the function being exported
// calls an intermediate function, and the intermediate function
« no previous file with comments | « src/runtime/runtime.h ('k') | src/wasm/wasm-js.cc » ('j') | src/wasm/wasm-js.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698