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

Side by Side Diff: test/mjsunit/wasm/trap-location.js

Issue 2479283002: Revert of [wasm] Indirect calls without function table cause validation errors. (Closed)
Patch Set: Created 4 years, 1 month 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/cctest/wasm/test-run-wasm.cc ('k') | test/unittests/wasm/ast-decoder-unittest.cc » ('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 // Collect the Callsite objects instead of just a string: 10 // Collect the Callsite objects instead of just a string:
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 kExprI32Eq, 49 kExprI32Eq,
50 kExprIf, kAstStmt, 50 kExprIf, kAstStmt,
51 kExprUnreachable, 51 kExprUnreachable,
52 kExprEnd, 52 kExprEnd,
53 // offset 30 53 // offset 30
54 kExprGetLocal, 0, 54 kExprGetLocal, 0,
55 kExprCallIndirect, sig_index, kTableZero, 55 kExprCallIndirect, sig_index, kTableZero,
56 kExprEnd, 56 kExprEnd,
57 ]) 57 ])
58 .exportAs("main"); 58 .exportAs("main");
59 builder.appendToTable([0]);
60 59
61 var module = builder.instantiate(); 60 var module = builder.instantiate();
62 61
63 function testWasmTrap(value, reason, position) { 62 function testWasmTrap(value, reason, position) {
64 try { 63 try {
65 module.exports.main(value); 64 module.exports.main(value);
66 fail("expected wasm exception"); 65 fail("expected wasm exception");
67 } catch (e) { 66 } catch (e) {
68 assertEquals(kTrapMsgs[reason], e.message, "trap reason"); 67 assertEquals(kTrapMsgs[reason], e.message, "trap reason");
69 assertEquals(3, e.stack.length, "number of frames"); 68 assertEquals(3, e.stack.length, "number of frames");
70 assertEquals(0, e.stack[0].getLineNumber(), "wasmFunctionIndex"); 69 assertEquals(0, e.stack[0].getLineNumber(), "wasmFunctionIndex");
71 assertEquals(position, e.stack[0].getPosition(), "position"); 70 assertEquals(position, e.stack[0].getPosition(), "position");
72 } 71 }
73 } 72 }
74 73
75 // The actual tests: 74 // The actual tests:
76 testWasmTrap(0, kTrapDivByZero, 14); 75 testWasmTrap(0, kTrapDivByZero, 14);
77 testWasmTrap(1, kTrapMemOutOfBounds, 15); 76 testWasmTrap(1, kTrapMemOutOfBounds, 15);
78 testWasmTrap(2, kTrapUnreachable, 28); 77 testWasmTrap(2, kTrapUnreachable, 28);
79 testWasmTrap(3, kTrapFuncInvalid, 32); 78 testWasmTrap(3, kTrapFuncInvalid, 32);
OLDNEW
« no previous file with comments | « test/cctest/wasm/test-run-wasm.cc ('k') | test/unittests/wasm/ast-decoder-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698