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 |