[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}
This commit is contained in:
ahaas 2016-09-22 07:23:32 -07:00 committed by Commit bot
parent 396dbab65e
commit 447de9ae5b

View File

@ -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,