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

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

Issue 2137993003: [wasm] Adding feature to JIT a wasm function at runtime and hook up the compiled code into the indi… (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixing unit test- 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
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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 var kExprF64UConvertI64 = 0xb1; 297 var kExprF64UConvertI64 = 0xb1;
298 var kExprF64ConvertF32 = 0xb2; 298 var kExprF64ConvertF32 = 0xb2;
299 var kExprF64ReinterpretI64 = 0xb3; 299 var kExprF64ReinterpretI64 = 0xb3;
300 var kExprI32ReinterpretF32 = 0xb4; 300 var kExprI32ReinterpretF32 = 0xb4;
301 var kExprI64ReinterpretF64 = 0xb5; 301 var kExprI64ReinterpretF64 = 0xb5;
302 var kExprI32Ror = 0xb6; 302 var kExprI32Ror = 0xb6;
303 var kExprI32Rol = 0xb7; 303 var kExprI32Rol = 0xb7;
304 var kExprI64Ror = 0xb8; 304 var kExprI64Ror = 0xb8;
305 var kExprI64Rol = 0xb9; 305 var kExprI64Rol = 0xb9;
306 306
307 var kExprJITSingleFunction = 0xf0;
308
307 var kTrapUnreachable = 0; 309 var kTrapUnreachable = 0;
308 var kTrapMemOutOfBounds = 1; 310 var kTrapMemOutOfBounds = 1;
309 var kTrapDivByZero = 2; 311 var kTrapDivByZero = 2;
310 var kTrapDivUnrepresentable = 3; 312 var kTrapDivUnrepresentable = 3;
311 var kTrapRemByZero = 4; 313 var kTrapRemByZero = 4;
312 var kTrapFloatUnrepresentable = 5; 314 var kTrapFloatUnrepresentable = 5;
313 var kTrapFuncInvalid = 6; 315 var kTrapFuncInvalid = 6;
314 var kTrapFuncSigMismatch = 7; 316 var kTrapFuncSigMismatch = 7;
315 var kTrapMemAllocationFail = 8; 317 var kTrapMemAllocationFail = 8;
318 var kTrapInvalidIndex = 9;
316 319
317 var kTrapMsgs = [ 320 var kTrapMsgs = [
318 "unreachable", 321 "unreachable",
319 "memory access out of bounds", 322 "memory access out of bounds",
320 "divide by zero", 323 "divide by zero",
321 "divide result unrepresentable", 324 "divide result unrepresentable",
322 "remainder by zero", 325 "remainder by zero",
323 "integer result unrepresentable", 326 "integer result unrepresentable",
324 "invalid function", 327 "invalid function",
325 "function signature mismatch", 328 "function signature mismatch",
326 "failed to allocate memory" 329 "failed to allocate memory",
330 "invalid index into function table"
327 ]; 331 ];
328 332
329 function assertTraps(trap, code) { 333 function assertTraps(trap, code) {
330 var threwException = true; 334 var threwException = true;
331 try { 335 try {
332 if (typeof code === 'function') { 336 if (typeof code === 'function') {
333 code(); 337 code();
334 } else { 338 } else {
335 eval(code); 339 eval(code);
336 } 340 }
337 threwException = false; 341 threwException = false;
338 } catch (e) { 342 } catch (e) {
339 assertEquals("object", typeof e); 343 assertEquals("object", typeof e);
340 assertEquals(kTrapMsgs[trap], e.message); 344 assertEquals(kTrapMsgs[trap], e.message);
341 // Success. 345 // Success.
342 return; 346 return;
343 } 347 }
344 throw new MjsUnitAssertionError("Did not trap, expected: " + kTrapMsgs[trap] ); 348 throw new MjsUnitAssertionError("Did not trap, expected: " + kTrapMsgs[trap] );
345 } 349 }
OLDNEW
« test/mjsunit/wasm/jit-single-function.js ('K') | « test/mjsunit/wasm/jit-single-function.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698