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

Side by Side Diff: test/mjsunit/wasm/instantiate-module-basic.js

Issue 2121593002: [wasm] Compile and Instantiation (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: test Created 4 years, 5 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 unified diff | Download patch
« src/wasm/wasm-js.cc ('K') | « src/wasm/wasm-js.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Flags: --expose-wasm 5 // Flags: --expose-wasm
6 6
7 load("test/mjsunit/wasm/wasm-constants.js"); 7 load("test/mjsunit/wasm/wasm-constants.js");
8 load("test/mjsunit/wasm/wasm-module-builder.js"); 8 load("test/mjsunit/wasm/wasm-module-builder.js");
9 9
10 let kReturnValue = 117; 10 let kReturnValue = 117;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 51
52 // Deprecated experimental API. 52 // Deprecated experimental API.
53 CheckInstance(Wasm.instantiateModule(buffer)); 53 CheckInstance(Wasm.instantiateModule(buffer));
54 54
55 // Official API 55 // Official API
56 let module = new WebAssembly.Module(buffer); 56 let module = new WebAssembly.Module(buffer);
57 CheckInstance(new WebAssembly.Instance(module)); 57 CheckInstance(new WebAssembly.Instance(module));
58 58
59 let promise = WebAssembly.compile(buffer); 59 let promise = WebAssembly.compile(buffer);
60 promise.then(module => CheckInstance(new WebAssembly.Instance(module))); 60 promise.then(module => CheckInstance(new WebAssembly.Instance(module)));
61
62 // Negative tests.
rossberg 2016/07/04 10:04:00 We should probably have a few new positive tests,
Mircea Trofin 2016/07/05 06:02:43 True - actually, for that to work, we'll have to c
63 (function InvalidModules() {
64 let invalid_cases = [undefined, 1, "", "a", {some:1, obj: "b"}];
65 let len = invalid_cases.length;
66 for (var i = 0; i < len; ++i) {
67 try {
68 let instance = new WebAssembly.Instance(1);
69 assertUnreachable("should not be able to instantiate invalid modules.");
70 } catch (e) {
71 assertContains("Argument 0", e.toString());
72 }
73 }
74 })();
OLDNEW
« src/wasm/wasm-js.cc ('K') | « src/wasm/wasm-js.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698