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 1423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1434 var a = fround(1.0); | 1434 var a = fround(1.0); |
1435 var b = fround(2.0); | 1435 var b = fround(2.0); |
1436 HEAPF32[0] = a + b; | 1436 HEAPF32[0] = a + b; |
1437 return +HEAPF32[0]; | 1437 return +HEAPF32[0]; |
1438 } | 1438 } |
1439 return {func: func}; | 1439 return {func: func}; |
1440 } | 1440 } |
1441 | 1441 |
1442 var m = _WASMEXP_.instantiateModuleFromAsm(Module.toString()); | 1442 var m = _WASMEXP_.instantiateModuleFromAsm(Module.toString()); |
1443 assertEquals(3, m.func()); | 1443 assertEquals(3, m.func()); |
1444 }) // TODO(bradnelson): Enable when Math.fround implementation lands. | 1444 }); // TODO(bradnelson): Enable when Math.fround implementation lands. |
| 1445 |
| 1446 |
| 1447 (function TestIntegerMultiplyBothWays() { |
| 1448 function Module(stdlib, foreign, heap) { |
| 1449 "use asm"; |
| 1450 function func() { |
| 1451 var a = 1; |
| 1452 return ((a * 3) + (4 * a)) | 0; |
| 1453 } |
| 1454 return {func: func}; |
| 1455 } |
| 1456 |
| 1457 var m = _WASMEXP_.instantiateModuleFromAsm(Module.toString()); |
| 1458 assertEquals(7, m.func()); |
| 1459 })(); |
| 1460 |
| 1461 |
| 1462 (function TestBadMultiplyIntish() { |
| 1463 function Module(stdlib, foreign, heap) { |
| 1464 "use asm"; |
| 1465 function func() { |
| 1466 var a = 1; |
| 1467 return ((a + a) * 4) | 0; |
| 1468 } |
| 1469 return {func: func}; |
| 1470 } |
| 1471 assertThrows(function() { |
| 1472 _WASMEXP_.instantiateModuleFromAsm(Module.toString()); |
| 1473 }); |
| 1474 })(); |
OLD | NEW |