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

Side by Side Diff: test/mjsunit/wasm/divrem-trap.js

Issue 1740373002: [wasm] Add a magic word and a version number to the binary. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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/calls.js ('k') | test/mjsunit/wasm/export-table.js » ('j') | 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 --expose-gc --allow-natives-syntax 5 // Flags: --expose-wasm --expose-gc --allow-natives-syntax
6 6
7 load("test/mjsunit/wasm/wasm-constants.js"); 7 load("test/mjsunit/wasm/wasm-constants.js");
8 8
9 function assertTraps(code, msg) { 9 function assertTraps(code, msg) {
10 var threwException = true; 10 var threwException = true;
(...skipping 13 matching lines...) Expand all
24 } 24 }
25 // Success. 25 // Success.
26 return; 26 return;
27 } 27 }
28 throw new MjsUnitAssertionError("Did not throw exception"); 28 throw new MjsUnitAssertionError("Did not throw exception");
29 } 29 }
30 30
31 31
32 function makeDivRem(opcode) { 32 function makeDivRem(opcode) {
33 var kBodySize = 5; 33 var kBodySize = 5;
34 var kNameMainOffset = 6 + 11 + kBodySize + 1; 34 var kNameMainOffset = kHeaderSize + 6 + 11 + kBodySize + 1;
35 35
36 var data = bytes( 36 var data = bytesWithHeader(
37 // signatures 37 // signatures
38 kDeclSignatures, 1, 38 kDeclSignatures, 1,
39 2, kAstI32, kAstI32, kAstI32, // (int,int) -> int 39 2, kAstI32, kAstI32, kAstI32, // (int,int) -> int
40 // -- main function 40 // -- main function
41 kDeclFunctions, 1, 41 kDeclFunctions, 1,
42 kDeclFunctionName | kDeclFunctionExport, 42 kDeclFunctionName | kDeclFunctionExport,
43 0, 0, 43 0, 0,
44 kNameMainOffset, 0, 0, 0, // name offset 44 kNameMainOffset, 0, 0, 0, // name offset
45 kBodySize, 0, 45 kBodySize, 0,
46 // main body 46 // main body
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 assertEquals( 3, remu(-443, 10)); 88 assertEquals( 3, remu(-443, 10));
89 89
90 assertTraps(kTrapRemByZero, "rems(100, 0);"); 90 assertTraps(kTrapRemByZero, "rems(100, 0);");
91 assertTraps(kTrapRemByZero, "rems(-1009, 0);"); 91 assertTraps(kTrapRemByZero, "rems(-1009, 0);");
92 92
93 assertTraps(kTrapRemByZero, "remu(200, 0);"); 93 assertTraps(kTrapRemByZero, "remu(200, 0);");
94 assertTraps(kTrapRemByZero, "remu(-2009, 0);"); 94 assertTraps(kTrapRemByZero, "remu(-2009, 0);");
95 95
96 assertEquals(-2147483648, remu(0x80000000, -1)); 96 assertEquals(-2147483648, remu(0x80000000, -1));
97 assertEquals(0, rems(0x80000000, -1)); 97 assertEquals(0, rems(0x80000000, -1));
OLDNEW
« no previous file with comments | « test/mjsunit/wasm/calls.js ('k') | test/mjsunit/wasm/export-table.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698