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

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

Issue 2806073002: [wasm] instantiate expressed in terms of compile (Closed)
Patch Set: feedback 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 4574b5103e13b16101106bf17e1f6a3f99de33e7..716826c2b33e0cf2f7a3ec6f431c60ed8b4891a7 100644
--- a/src/runtime/runtime-test.cc
+++ b/src/runtime/runtime-test.cc
@@ -111,6 +111,21 @@ bool WasmInstantiateOverride(const v8::FunctionCallbackInfo<v8::Value>& args) {
return true;
}
+bool GetWasmFromArray(const v8::FunctionCallbackInfo<v8::Value>& args) {
+ CHECK(args.Length() == 1);
+ v8::Local<v8::Context> context = args.GetIsolate()->GetCurrentContext();
+ v8::Local<v8::Value> module =
+ v8::Local<v8::Object>::Cast(args[0])->Get(context, 0).ToLocalChecked();
+
+ v8::Local<v8::Promise::Resolver> resolver =
+ v8::Promise::Resolver::New(context).ToLocalChecked();
+ args.GetReturnValue().Set(resolver->GetPromise());
+ USE(resolver->Resolve(context, module));
+ return true;
+}
+
+bool NoExtension(const v8::FunctionCallbackInfo<v8::Value>&) { return false; }
+
} // namespace
namespace v8 {
@@ -452,6 +467,16 @@ RUNTIME_FUNCTION(Runtime_ClearFunctionFeedback) {
return isolate->heap()->undefined_value();
}
+RUNTIME_FUNCTION(Runtime_SetWasmCompileFromPromiseOverload) {
+ isolate->set_wasm_compile_callback(GetWasmFromArray);
+ return isolate->heap()->undefined_value();
+}
+
+RUNTIME_FUNCTION(Runtime_ResetWasmOverloads) {
+ isolate->set_wasm_compile_callback(NoExtension);
+ 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
@@ -1007,5 +1032,6 @@ RUNTIME_FUNCTION(Runtime_DecrementWaitCount) {
isolate->DecrementWaitCountForTesting();
return isolate->heap()->undefined_value();
}
+
} // namespace internal
} // namespace v8
« 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