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

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

Issue 1763433002: [wasm] Rework encoding of local declarations. (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
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 12 matching lines...) Expand all
23 assertEquals(e.type, cause_opt); 23 assertEquals(e.type, cause_opt);
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 = 6;
34 var kNameMainOffset = kHeaderSize + 6 + 11 + kBodySize + 1; 34 var kNameMainOffset = kHeaderSize + 6 + 11 + kBodySize + 1;
35 35
36 var data = bytesWithHeader( 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
47 kDeclNoLocals,
47 opcode, // -- 48 opcode, // --
48 kExprGetLocal, 0, // -- 49 kExprGetLocal, 0, // --
49 kExprGetLocal, 1, // -- 50 kExprGetLocal, 1, // --
50 // names 51 // names
51 kDeclEnd, 52 kDeclEnd,
52 'm', 'a', 'i', 'n', 0 // -- 53 'm', 'a', 'i', 'n', 0 // --
53 ); 54 );
54 55
55 var module = _WASMEXP_.instantiateModule(data); 56 var module = _WASMEXP_.instantiateModule(data);
56 57
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 assertEquals( 3, remu(-443, 10)); 89 assertEquals( 3, remu(-443, 10));
89 90
90 assertTraps(kTrapRemByZero, "rems(100, 0);"); 91 assertTraps(kTrapRemByZero, "rems(100, 0);");
91 assertTraps(kTrapRemByZero, "rems(-1009, 0);"); 92 assertTraps(kTrapRemByZero, "rems(-1009, 0);");
92 93
93 assertTraps(kTrapRemByZero, "remu(200, 0);"); 94 assertTraps(kTrapRemByZero, "remu(200, 0);");
94 assertTraps(kTrapRemByZero, "remu(-2009, 0);"); 95 assertTraps(kTrapRemByZero, "remu(-2009, 0);");
95 96
96 assertEquals(-2147483648, remu(0x80000000, -1)); 97 assertEquals(-2147483648, remu(0x80000000, -1));
97 assertEquals(0, rems(0x80000000, -1)); 98 assertEquals(0, rems(0x80000000, -1));
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698