OLD | NEW |
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-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; |
11 try { | 11 try { |
12 if (typeof code === 'function') { | 12 if (typeof code === 'function') { |
13 code(); | 13 code(); |
14 } else { | 14 } else { |
15 eval(code); | 15 eval(code); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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)); |
OLD | NEW |