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

Unified Diff: src/wasm/wasm-js.cc

Issue 2460773003: [wasm] make WebAssembly.Instance require a WebAssembly.Memory (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « no previous file | test/mjsunit/wasm/compiled-module-serialization.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/wasm-js.cc
diff --git a/src/wasm/wasm-js.cc b/src/wasm/wasm-js.cc
index 72482388ed3099febfe994aa1b7a968270c3ab1a..4b2b897d82734112bac66f8d8d0532d3e4412d41 100644
--- a/src/wasm/wasm-js.cc
+++ b/src/wasm/wasm-js.cc
@@ -228,10 +228,14 @@ void WebAssemblyInstance(const v8::FunctionCallbackInfo<v8::Value>& args) {
}
i::Handle<i::JSArrayBuffer> memory = i::Handle<i::JSArrayBuffer>::null();
- if (args.Length() > 2 && args[2]->IsArrayBuffer()) {
+ if (args.Length() > 2 && args[2]->IsObject()) {
Local<Object> obj = Local<Object>::Cast(args[2]);
i::Handle<i::Object> mem_obj = v8::Utils::OpenHandle(*obj);
- memory = i::Handle<i::JSArrayBuffer>(i::JSArrayBuffer::cast(*mem_obj));
+ if (i::WasmJs::IsWasmMemoryObject(i_isolate, mem_obj)) {
+ memory = i::WasmJs::GetWasmMemoryArrayBuffer(i_isolate, mem_obj);
+ } else {
+ thrower.TypeError("Argument 2 must be a WebAssembly.Memory");
+ }
}
i::MaybeHandle<i::JSObject> instance =
i::wasm::WasmModule::Instantiate(i_isolate, &thrower, i_obj, ffi, memory);
« no previous file with comments | « no previous file | test/mjsunit/wasm/compiled-module-serialization.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698