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

Side by Side Diff: test/mjsunit/wasm/indirect-tables.js

Issue 2594993002: [wasm] Rename wasm::LocalType to wasm::ValueType and kAst* to kWasm* (Closed)
Patch Set: Fix inspector tests Created 4 years 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/indirect-calls.js ('k') | test/mjsunit/wasm/instantiate-module-basic.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 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 function AddFunctions(builder) { 10 function AddFunctions(builder) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 .addBody([ 43 .addBody([
44 kExprI32Const, 33, // -- 44 kExprI32Const, 33, // --
45 kExprGetLocal, 0, // -- 45 kExprGetLocal, 0, // --
46 kExprGetLocal, 1, // -- 46 kExprGetLocal, 1, // --
47 kExprCallIndirect, 0, kTableZero]) // -- 47 kExprCallIndirect, 0, kTableZero]) // --
48 .exportAs("main"); 48 .exportAs("main");
49 49
50 f.add.exportAs("blarg"); 50 f.add.exportAs("blarg");
51 51
52 builder.setFunctionTableLength(10); 52 builder.setFunctionTableLength(10);
53 let g = builder.addImportedGlobal("q", "base", kAstI32); 53 let g = builder.addImportedGlobal("q", "base", kWasmI32);
54 builder.addFunctionTableInit(g, true, [f.mul.index, f.add.index, 54 builder.addFunctionTableInit(g, true, [f.mul.index, f.add.index,
55 f.sub.index, 55 f.sub.index,
56 d]); 56 d]);
57 builder.addExportOfKind("table", kExternalTable, 0); 57 builder.addExportOfKind("table", kExternalTable, 0);
58 58
59 let module = new WebAssembly.Module(builder.toBuffer()); 59 let module = new WebAssembly.Module(builder.toBuffer());
60 60
61 for (let i = 0; i < 5; i++) { 61 for (let i = 0; i < 5; i++) {
62 print(" base = " + i); 62 print(" base = " + i);
63 let instance = new WebAssembly.Instance(module, {q: {base: i, js_div: js_div }}); 63 let instance = new WebAssembly.Instance(module, {q: {base: i, js_div: js_div }});
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 103
104 104
105 (function ImportedTableTest() { 105 (function ImportedTableTest() {
106 let kTableSize = 10; 106 let kTableSize = 10;
107 print("ImportedTableTest..."); 107 print("ImportedTableTest...");
108 var builder = new WasmModuleBuilder(); 108 var builder = new WasmModuleBuilder();
109 109
110 let d = builder.addImport("q", "js_div", kSig_i_ii); 110 let d = builder.addImport("q", "js_div", kSig_i_ii);
111 let f = AddFunctions(builder); 111 let f = AddFunctions(builder);
112 builder.setFunctionTableLength(kTableSize); 112 builder.setFunctionTableLength(kTableSize);
113 let g = builder.addImportedGlobal("q", "base", kAstI32); 113 let g = builder.addImportedGlobal("q", "base", kWasmI32);
114 builder.addFunctionTableInit(g, true, [f.mul.index, f.add.index, 114 builder.addFunctionTableInit(g, true, [f.mul.index, f.add.index,
115 f.sub.index, 115 f.sub.index,
116 d]); 116 d]);
117 builder.addExportOfKind("table", kExternalTable, 0); 117 builder.addExportOfKind("table", kExternalTable, 0);
118 118
119 let m1 = new WebAssembly.Module(builder.toBuffer()); 119 let m1 = new WebAssembly.Module(builder.toBuffer());
120 120
121 var builder = new WasmModuleBuilder(); 121 var builder = new WasmModuleBuilder();
122 122
123 builder.addImportedTable("r", "table", kTableSize, kTableSize); 123 builder.addImportedTable("r", "table", kTableSize, kTableSize);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 })(); 173 })();
174 174
175 (function ImportedTableTest() { 175 (function ImportedTableTest() {
176 let kTableSize = 10; 176 let kTableSize = 10;
177 print("ManualTableTest..."); 177 print("ManualTableTest...");
178 178
179 var builder = new WasmModuleBuilder(); 179 var builder = new WasmModuleBuilder();
180 180
181 let d = builder.addImport("q", "js_div", kSig_i_ii); 181 let d = builder.addImport("q", "js_div", kSig_i_ii);
182 builder.addImportedTable("q", "table", kTableSize, kTableSize); 182 builder.addImportedTable("q", "table", kTableSize, kTableSize);
183 let g = builder.addImportedGlobal("q", "base", kAstI32); 183 let g = builder.addImportedGlobal("q", "base", kWasmI32);
184 let f = AddFunctions(builder); 184 let f = AddFunctions(builder);
185 builder.addFunctionTableInit(g, true, [f.mul.index, f.add.index, 185 builder.addFunctionTableInit(g, true, [f.mul.index, f.add.index,
186 f.sub.index, 186 f.sub.index,
187 d]); 187 d]);
188 builder.addFunction("main", kSig_i_ii) 188 builder.addFunction("main", kSig_i_ii)
189 .addBody([ 189 .addBody([
190 kExprI32Const, 55, // -- 190 kExprI32Const, 55, // --
191 kExprGetLocal, 0, // -- 191 kExprGetLocal, 0, // --
192 kExprGetLocal, 1, // -- 192 kExprGetLocal, 1, // --
193 kExprCallIndirect, 0, kTableZero]) // -- 193 kExprCallIndirect, 0, kTableZero]) // --
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 240
241 (function CumulativeTest() { 241 (function CumulativeTest() {
242 print("CumulativeTest..."); 242 print("CumulativeTest...");
243 243
244 let kTableSize = 10; 244 let kTableSize = 10;
245 let table = new WebAssembly.Table({element: "anyfunc", initial: 10}); 245 let table = new WebAssembly.Table({element: "anyfunc", initial: 10});
246 246
247 var builder = new WasmModuleBuilder(); 247 var builder = new WasmModuleBuilder();
248 248
249 builder.addImportedTable("x", "table", kTableSize, kTableSize); 249 builder.addImportedTable("x", "table", kTableSize, kTableSize);
250 let g = builder.addImportedGlobal("x", "base", kAstI32); 250 let g = builder.addImportedGlobal("x", "base", kWasmI32);
251 let sig_index = builder.addType(kSig_i_v); 251 let sig_index = builder.addType(kSig_i_v);
252 builder.addFunction("g", sig_index) 252 builder.addFunction("g", sig_index)
253 .addBody([ 253 .addBody([
254 kExprGetGlobal, g 254 kExprGetGlobal, g
255 ]); 255 ]);
256 builder.addFunction("main", kSig_i_ii) 256 builder.addFunction("main", kSig_i_ii)
257 .addBody([ 257 .addBody([
258 kExprGetLocal, 0, 258 kExprGetLocal, 0,
259 kExprCallIndirect, sig_index, kTableZero]) // -- 259 kExprCallIndirect, sig_index, kTableZero]) // --
260 .exportAs("main"); 260 .exportAs("main");
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 var i2 = new WebAssembly.Instance(m2, ffi); 368 var i2 = new WebAssembly.Instance(m2, ffi);
369 } else { 369 } else {
370 assertThrows(() => new WebAssembly.Instance(m2, ffi)); 370 assertThrows(() => new WebAssembly.Instance(m2, ffi));
371 } 371 }
372 } 372 }
373 } 373 }
374 374
375 375
376 376
377 })(); 377 })();
OLDNEW
« no previous file with comments | « test/mjsunit/wasm/indirect-calls.js ('k') | test/mjsunit/wasm/instantiate-module-basic.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698