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-wasm | 5 // Flags: --expose-wasm |
6 | 6 |
7 function EmptyTest() { | 7 function EmptyTest() { |
8 "use asm"; | 8 "use asm"; |
9 function caller() { | 9 function caller() { |
10 empty(); | 10 empty(); |
(...skipping 1454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1465 function func() { | 1465 function func() { |
1466 var a = 1; | 1466 var a = 1; |
1467 return ((a + a) * 4) | 0; | 1467 return ((a + a) * 4) | 0; |
1468 } | 1468 } |
1469 return {func: func}; | 1469 return {func: func}; |
1470 } | 1470 } |
1471 assertThrows(function() { | 1471 assertThrows(function() { |
1472 _WASMEXP_.instantiateModuleFromAsm(Module.toString()); | 1472 _WASMEXP_.instantiateModuleFromAsm(Module.toString()); |
1473 }); | 1473 }); |
1474 })(); | 1474 })(); |
| 1475 |
| 1476 |
| 1477 (function TestAndNegative() { |
| 1478 function Module() { |
| 1479 "use asm"; |
| 1480 function func() { |
| 1481 var x = 1; |
| 1482 var y = 2; |
| 1483 var z = 0; |
| 1484 z = x + y & -1; |
| 1485 return z | 0; |
| 1486 } |
| 1487 return {func: func}; |
| 1488 } |
| 1489 |
| 1490 var m = _WASMEXP_.instantiateModuleFromAsm(Module.toString()); |
| 1491 assertEquals(3, m.func()); |
| 1492 })(); |
| 1493 |
| 1494 |
| 1495 (function TestNegativeDouble() { |
| 1496 function Module() { |
| 1497 "use asm"; |
| 1498 function func() { |
| 1499 var x = -(34359738368.25); |
| 1500 var y = -2.5; |
| 1501 return +(x + y); |
| 1502 } |
| 1503 return {func: func}; |
| 1504 } |
| 1505 |
| 1506 var m = _WASMEXP_.instantiateModuleFromAsm(Module.toString()); |
| 1507 assertEquals(-34359738370.75, m.func()); |
| 1508 })(); |
| 1509 |
| 1510 |
| 1511 (function TestBadAndDouble() { |
| 1512 function Module() { |
| 1513 "use asm"; |
| 1514 function func() { |
| 1515 var x = 1.0; |
| 1516 var y = 2.0; |
| 1517 return (x & y) | 0; |
| 1518 } |
| 1519 return {func: func}; |
| 1520 } |
| 1521 |
| 1522 assertThrows(function() { |
| 1523 _WASMEXP_.instantiateModuleFromAsm(Module.toString()); |
| 1524 }); |
| 1525 })(); |
OLD | NEW |