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

Side by Side Diff: test/mjsunit/wasm/wasm-constants.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: 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/compiler/wasm-compiler.cc ('K') | « test/mjsunit/wasm/stack.js ('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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 function bytes() { 7 function bytes() {
8 var buffer = new ArrayBuffer(arguments.length); 8 var buffer = new ArrayBuffer(arguments.length);
9 var view = new Uint8Array(buffer); 9 var view = new Uint8Array(buffer);
10 for (var i = 0; i < arguments.length; i++) { 10 for (var i = 0; i < arguments.length; i++) {
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 310
311 var kTrapUnreachable = 0; 311 var kTrapUnreachable = 0;
312 var kTrapMemOutOfBounds = 1; 312 var kTrapMemOutOfBounds = 1;
313 var kTrapDivByZero = 2; 313 var kTrapDivByZero = 2;
314 var kTrapDivUnrepresentable = 3; 314 var kTrapDivUnrepresentable = 3;
315 var kTrapRemByZero = 4; 315 var kTrapRemByZero = 4;
316 var kTrapFloatUnrepresentable = 5; 316 var kTrapFloatUnrepresentable = 5;
317 var kTrapFuncInvalid = 6; 317 var kTrapFuncInvalid = 6;
318 var kTrapFuncSigMismatch = 7; 318 var kTrapFuncSigMismatch = 7;
319 var kTrapInvalidIndex = 8; 319 var kTrapInvalidIndex = 8;
320 var kTrapStackOverflow = 9;
320 321
321 var kTrapMsgs = [ 322 var kTrapMsgs = [
322 "unreachable", 323 "unreachable",
323 "memory access out of bounds", 324 "memory access out of bounds",
324 "divide by zero", 325 "divide by zero",
325 "divide result unrepresentable", 326 "divide result unrepresentable",
326 "remainder by zero", 327 "remainder by zero",
327 "integer result unrepresentable", 328 "integer result unrepresentable",
328 "invalid function", 329 "invalid function",
329 "function signature mismatch", 330 "function signature mismatch",
330 "invalid index into function table" 331 "invalid index into function table",
332 "Maximum WebAssembly call stack size exceeded"
331 ]; 333 ];
332 334
333 function assertTraps(trap, code) { 335 function assertTraps(trap, code) {
334 var threwException = true; 336 var threwException = true;
335 try { 337 try {
336 if (typeof code === 'function') { 338 if (typeof code === 'function') {
337 code(); 339 code();
338 } else { 340 } else {
339 eval(code); 341 eval(code);
340 } 342 }
341 threwException = false; 343 threwException = false;
342 } catch (e) { 344 } catch (e) {
343 assertEquals("object", typeof e); 345 assertEquals("object", typeof e);
344 assertEquals(kTrapMsgs[trap], e.message); 346 assertEquals(kTrapMsgs[trap], e.message);
345 // Success. 347 // Success.
346 return; 348 return;
347 } 349 }
348 throw new MjsUnitAssertionError("Did not trap, expected: " + kTrapMsgs[trap] ); 350 throw new MjsUnitAssertionError("Did not trap, expected: " + kTrapMsgs[trap] );
349 } 351 }
OLDNEW
« src/compiler/wasm-compiler.cc ('K') | « test/mjsunit/wasm/stack.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698