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

Side by Side Diff: test/mjsunit/wasm/stack.js

Issue 2256603002: [wasm] Add stack checks at the beginning of each function. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Do not trap but use the runtime stack guard call Created 4 years, 4 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
« src/wasm/ast-decoder.cc ('K') | « src/wasm/ast-decoder.cc ('k') | no next file » | 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 // clang-format off 5 // clang-format off
6 // Flags: --expose-wasm 6 // Flags: --expose-wasm
7 7
8 load("test/mjsunit/wasm/wasm-constants.js"); 8 load("test/mjsunit/wasm/wasm-constants.js");
9 load("test/mjsunit/wasm/wasm-module-builder.js"); 9 load("test/mjsunit/wasm/wasm-module-builder.js");
10 10
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 assertContains("out of bounds", e.message); 118 assertContains("out of bounds", e.message);
119 verifyStack(e.stack, [ 119 verifyStack(e.stack, [
120 // isWasm function line pos file 120 // isWasm function line pos file
121 [ true, "", 2, 3, null], 121 [ true, "", 2, 3, null],
122 [ true, "call_mem_out_of_bounds", 3, 1, null], 122 [ true, "call_mem_out_of_bounds", 3, 1, null],
123 [ false, "testWasmMemOutOfBounds", 115, 0, "stack.js"], 123 [ false, "testWasmMemOutOfBounds", 115, 0, "stack.js"],
124 [ false, null, 127, 0, "stack.js"] 124 [ false, null, 127, 0, "stack.js"]
125 ]); 125 ]);
126 } 126 }
127 })(); 127 })();
128
129
130 (function testStackOverflow() {
131 print("testStackOverflow");
132 var builder = new WasmModuleBuilder();
133
134 var sig_index = builder.addType(kSig_v_v);
135 builder.addFunction("recursion", sig_index)
136 .addBody([
137 kExprI32Const, 0,
138 kExprCallIndirect, kArity0, sig_index
139 ])
140 .exportFunc()
141 builder.appendToTable([0]);
142
143 try {
144 builder.instantiate().exports.recursion();
145 fail("expected wasm exception");
146 } catch (e) {
147 assertEquals("Maximum call stack size exceeded", e.message, "trap reason");
148 }
149 })();
OLDNEW
« src/wasm/ast-decoder.cc ('K') | « src/wasm/ast-decoder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698