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

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

Issue 2640453003: [wasm] Fix and tighten memory validation (Closed)
Patch Set: Comments 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
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 --trap-if 5 // Flags: --expose-wasm --trap-if
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:
11 Error.prepareStackTrace = function(error, frames) { 11 Error.prepareStackTrace = function(error, frames) {
12 return frames; 12 return frames;
13 }; 13 };
14 14
15 var builder = new WasmModuleBuilder(); 15 var builder = new WasmModuleBuilder();
16 16
17 builder.addMemory(0, 1, false);
18
17 var sig_index = builder.addType(kSig_i_v) 19 var sig_index = builder.addType(kSig_i_v)
18 20
19 // Build a function to resemble this code: 21 // Build a function to resemble this code:
20 // if (idx < 2) { 22 // if (idx < 2) {
21 // return load(-2 / idx); 23 // return load(-2 / idx);
22 // } else if (idx == 2) { 24 // } else if (idx == 2) {
23 // unreachable; 25 // unreachable;
24 // } else { 26 // } else {
25 // return call_indirect(idx); 27 // return call_indirect(idx);
26 // } 28 // }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 assertEquals(0, e.stack[0].getLineNumber(), "wasmFunctionIndex"); 72 assertEquals(0, e.stack[0].getLineNumber(), "wasmFunctionIndex");
71 assertEquals(position, e.stack[0].getPosition(), "position"); 73 assertEquals(position, e.stack[0].getPosition(), "position");
72 } 74 }
73 } 75 }
74 76
75 // The actual tests: 77 // The actual tests:
76 testWasmTrap(0, kTrapDivByZero, 14); 78 testWasmTrap(0, kTrapDivByZero, 14);
77 testWasmTrap(1, kTrapMemOutOfBounds, 15); 79 testWasmTrap(1, kTrapMemOutOfBounds, 15);
78 testWasmTrap(2, kTrapUnreachable, 28); 80 testWasmTrap(2, kTrapUnreachable, 28);
79 testWasmTrap(3, kTrapFuncInvalid, 32); 81 testWasmTrap(3, kTrapFuncInvalid, 32);
OLDNEW
« no previous file with comments | « test/mjsunit/wasm/trap-location.js ('k') | test/unittests/wasm/function-body-decoder-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698