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

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

Issue 2630553002: [wasm] Enforce that function bodies end with the \"end\" opcode. (Closed)
Patch Set: Collapse some tests together Created 3 years, 11 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/incrementer.wasm ('k') | test/mjsunit/wasm/table.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 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 436
437 // Verify that grow does not alter function behaviors 437 // Verify that grow does not alter function behaviors
438 for (var j = 0; j < 10; j++) { 438 for (var j = 0; j < 10; j++) {
439 let func = table.get(j); 439 let func = table.get(j);
440 assertEquals("function", typeof func); 440 assertEquals("function", typeof func);
441 assertEquals(j, func()); 441 assertEquals(j, func());
442 assertEquals(j, instances[j].exports.main(j)); 442 assertEquals(j, instances[j].exports.main(j));
443 } 443 }
444 444
445 let new_builder = new WasmModuleBuilder(); 445 let new_builder = new WasmModuleBuilder();
446 new_builder.addExport("wasm", new_builder.addFunction("", kSig_v_v)); 446 new_builder.addExport("wasm", new_builder.addFunction("", kSig_v_v).addBody([] ));
447 new_builder.addImportedTable("x", "table", 20, 30); 447 new_builder.addImportedTable("x", "table", 20, 30);
448 let new_module = new WebAssembly.Module(new_builder.toBuffer()); 448 let new_module = new WebAssembly.Module(new_builder.toBuffer());
449 let instance = new WebAssembly.Instance(new_module, {x: {table: table}}); 449 let instance = new WebAssembly.Instance(new_module, {x: {table: table}});
450 let new_func = instance.exports.wasm; 450 let new_func = instance.exports.wasm;
451 451
452 for (var j = 10; j < 20; j++) { 452 for (var j = 10; j < 20; j++) {
453 table.set(j, new_func); 453 table.set(j, new_func);
454 let func = table.get(j); 454 let func = table.get(j);
455 assertEquals("function", typeof func); 455 assertEquals("function", typeof func);
456 assertSame(new_func, table.get(j)); 456 assertSame(new_func, table.get(j));
457 } 457 }
458 assertThrows(() => table.grow(11)); 458 assertThrows(() => table.grow(11));
459 })(); 459 })();
OLDNEW
« no previous file with comments | « test/mjsunit/wasm/incrementer.wasm ('k') | test/mjsunit/wasm/table.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698