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

Side by Side Diff: test/mjsunit/wasm/wasm-constants.js

Issue 2051043002: Implement Wasm GrowMemory opcode as a wasm runtime call (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Review changes Created 4 years, 5 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/grow-memory.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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 var kExprI64Rol = 0xb9; 305 var kExprI64Rol = 0xb9;
306 306
307 var kTrapUnreachable = 0; 307 var kTrapUnreachable = 0;
308 var kTrapMemOutOfBounds = 1; 308 var kTrapMemOutOfBounds = 1;
309 var kTrapDivByZero = 2; 309 var kTrapDivByZero = 2;
310 var kTrapDivUnrepresentable = 3; 310 var kTrapDivUnrepresentable = 3;
311 var kTrapRemByZero = 4; 311 var kTrapRemByZero = 4;
312 var kTrapFloatUnrepresentable = 5; 312 var kTrapFloatUnrepresentable = 5;
313 var kTrapFuncInvalid = 6; 313 var kTrapFuncInvalid = 6;
314 var kTrapFuncSigMismatch = 7; 314 var kTrapFuncSigMismatch = 7;
315 var kTrapMemAllocationFail = 8;
315 316
316 var kTrapMsgs = [ 317 var kTrapMsgs = [
317 "unreachable", 318 "unreachable",
318 "memory access out of bounds", 319 "memory access out of bounds",
319 "divide by zero", 320 "divide by zero",
320 "divide result unrepresentable", 321 "divide result unrepresentable",
321 "remainder by zero", 322 "remainder by zero",
322 "integer result unrepresentable", 323 "integer result unrepresentable",
323 "invalid function", 324 "invalid function",
324 "function signature mismatch" 325 "function signature mismatch",
326 "failed to allocate memory"
325 ]; 327 ];
326 328
327 function assertTraps(trap, code) { 329 function assertTraps(trap, code) {
328 var threwException = true; 330 var threwException = true;
329 try { 331 try {
330 if (typeof code === 'function') { 332 if (typeof code === 'function') {
331 code(); 333 code();
332 } else { 334 } else {
333 eval(code); 335 eval(code);
334 } 336 }
335 threwException = false; 337 threwException = false;
336 } catch (e) { 338 } catch (e) {
337 assertEquals("object", typeof e); 339 assertEquals("object", typeof e);
338 assertEquals(kTrapMsgs[trap], e.message); 340 assertEquals(kTrapMsgs[trap], e.message);
339 // Success. 341 // Success.
340 return; 342 return;
341 } 343 }
342 throw new MjsUnitAssertionError("Did not trap, expected: " + kTrapMsgs[trap] ); 344 throw new MjsUnitAssertionError("Did not trap, expected: " + kTrapMsgs[trap] );
343 } 345 }
OLDNEW
« no previous file with comments | « test/mjsunit/wasm/grow-memory.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698