Commit 447de9ae authored by ahaas's avatar ahaas Committed by Commit bot

[wasm] Correctly handle the result of WasmModule::Instantiate in the wasm-module-runner

WasmModule::Instantiate can return an empty handle if it is not possible
to instantiate the module. With this change the wasm-module-runner does
not assume anymore that WasmModule::Instantiate produces a valid handle.

BUG=chromium:648078
R=titzer@chromium.org

Review-Url: https://codereview.chromium.org/2365493003
Cr-Commit-Position: refs/heads/master@{#39629}
parent 396dbab6
......@@ -66,10 +66,14 @@ const Handle<JSObject> InstantiateModuleForTesting(Isolate* isolate,
isolate, module->module_start, module->module_end, thrower,
ModuleOrigin::kWasmOrigin);
if (module_object.is_null()) return Handle<JSObject>::null();
return WasmModule::Instantiate(isolate, module_object.ToHandleChecked(),
Handle<JSReceiver>::null(),
Handle<JSArrayBuffer>::null())
.ToHandleChecked();
MaybeHandle<JSObject> maybe_instance = WasmModule::Instantiate(
isolate, module_object.ToHandleChecked(), Handle<JSReceiver>::null(),
Handle<JSArrayBuffer>::null());
Handle<JSObject> instance;
if (!maybe_instance.ToHandle(&instance)) {
return Handle<JSObject>::null();
}
return instance;
}
int32_t CompileAndRunWasmModule(Isolate* isolate, const byte* module_start,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment