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

Unified Diff: test/mjsunit/wasm/wasm-api-overloading.js

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
« src/wasm/wasm-js.cc ('K') | « test/mjsunit/wasm/js-api.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/wasm/wasm-api-overloading.js
diff --git a/test/mjsunit/wasm/wasm-api-overloading.js b/test/mjsunit/wasm/wasm-api-overloading.js
new file mode 100644
index 0000000000000000000000000000000000000000..ccd4aa93ebea7e0f1bf550d84b6b19c30771e69f
--- /dev/null
+++ b/test/mjsunit/wasm/wasm-api-overloading.js
@@ -0,0 +1,39 @@
+// Copyright 2017 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax
+
+load("test/mjsunit/wasm/wasm-constants.js");
+load("test/mjsunit/wasm/wasm-module-builder.js");
+
+%ResetWasmOverloads();
+let buffer = (() => {
+ let builder = new WasmModuleBuilder();
+ builder.addFunction("f", kSig_i_v)
+ .addBody([kExprI32Const, 42])
+ .exportAs("f");
+ return builder.toBuffer();
+})();
+
+var module = new WebAssembly.Module(buffer);
+var wrapper = [module];
+
+assertPromiseResult(
+ WebAssembly.instantiate(wrapper),
+ assertUnreachable,
+ e => assertTrue(e instanceof TypeError));
+
+assertPromiseResult(
+ (() => {
+ %SetWasmCompileFromPromiseOverload();
+ return WebAssembly.instantiate(wrapper);
+ })(),
+ pair => {
+ print(2);
+ var pair = result.pair;
+ assertTrue(pair.instance instanceof WebAssembly.Instance);
+ assertTrue(pair.module instanceof WebAssembly.Module);
+ %ResetWasmOverloads();
+ },
+ assertUnreachable);
« src/wasm/wasm-js.cc ('K') | « test/mjsunit/wasm/js-api.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698