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

Side by Side Diff: test/mjsunit/wasm/gc-buffer.js

Issue 2591753002: [wasm] Implement correct 2-level namespace for imports. (Closed)
Patch Set: Fix debug tests Created 3 years, 12 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
« no previous file with comments | « test/mjsunit/wasm/ffi-error.js ('k') | test/mjsunit/wasm/gc-frame.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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 --stress-gc --expose-gc 5 // Flags: --expose-wasm --stress-gc --expose-gc
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 function run(f) { 10 function run(f) {
11 // wrap the creation in a closure so that the only thing returned is 11 // wrap the creation in a closure so that the only thing returned is
12 // the module (i.e. the underlying array buffer of WASM wire bytes dies). 12 // the module (i.e. the underlying array buffer of WASM wire bytes dies).
13 var module = (() => { 13 var module = (() => {
14 var builder = new WasmModuleBuilder(); 14 var builder = new WasmModuleBuilder();
15 builder.addImport("the_name_of_my_import", kSig_i_i); 15 builder.addImport("mod", "the_name_of_my_import", kSig_i_i);
16 builder.addFunction("main", kSig_i_i) 16 builder.addFunction("main", kSig_i_i)
17 .addBody([ 17 .addBody([
18 kExprGetLocal, 0, 18 kExprGetLocal, 0,
19 kExprCallFunction, 0]) 19 kExprCallFunction, 0])
20 .exportAs("main"); 20 .exportAs("main");
21 print("module"); 21 print("module");
22 return new WebAssembly.Module(builder.toBuffer()); 22 return new WebAssembly.Module(builder.toBuffer());
23 })(); 23 })();
24 24
25 gc(); 25 gc();
26 for (var i = 0; i < 10; i++) { 26 for (var i = 0; i < 10; i++) {
27 print(" instance " + i); 27 print(" instance " + i);
28 var instance = new WebAssembly.Instance(module, {the_name_of_my_import: f}); 28 var instance = new WebAssembly.Instance(module, {"mod": {the_name_of_my_impo rt: f}});
29 var g = instance.exports.main; 29 var g = instance.exports.main;
30 assertEquals("function", typeof g); 30 assertEquals("function", typeof g);
31 for (var j = 0; j < 10; j++) { 31 for (var j = 0; j < 10; j++) {
32 assertEquals(f(j), g(j)); 32 assertEquals(f(j), g(j));
33 } 33 }
34 } 34 }
35 } 35 }
36 36
37 (function test() { 37 (function test() {
38 for (var i = 0; i < 3; i++) { 38 for (var i = 0; i < 3; i++) {
39 run(x => (x + 19)); 39 run(x => (x + 19));
40 run(x => (x - 18)); 40 run(x => (x - 18));
41 } 41 }
42 })(); 42 })();
OLDNEW
« no previous file with comments | « test/mjsunit/wasm/ffi-error.js ('k') | test/mjsunit/wasm/gc-frame.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698