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: --validate-asm --allow-natives-syntax | 5 // Flags: --validate-asm --allow-natives-syntax |
6 | 6 |
7 var stdlib = this; | 7 var stdlib = this; |
8 | 8 |
9 function assertValidAsm(func) { | 9 function assertValidAsm(func) { |
10 assertTrue(%IsAsmWasmCode(func)); | 10 assertTrue(%IsAsmWasmCode(func)); |
(...skipping 1563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1574 } while (0xffffffff); | 1574 } while (0xffffffff); |
1575 if ((val>>>0) == 2147483668) { | 1575 if ((val>>>0) == 2147483668) { |
1576 return 323; | 1576 return 323; |
1577 } | 1577 } |
1578 return 0; | 1578 return 0; |
1579 } | 1579 } |
1580 return {caller:main}; | 1580 return {caller:main}; |
1581 } | 1581 } |
1582 | 1582 |
1583 assertWasm(323, TestLoopsWithUnsigned); | 1583 assertWasm(323, TestLoopsWithUnsigned); |
| 1584 |
| 1585 |
| 1586 function TestSingleFunctionModule() { |
| 1587 "use asm"; |
| 1588 function add(a, b) { |
| 1589 a = a | 0; |
| 1590 b = b | 0; |
| 1591 return (a + b) | 0; |
| 1592 } |
| 1593 return add; |
| 1594 } |
| 1595 |
| 1596 assertEquals(7, TestSingleFunctionModule()(3, 4)); |
OLD | NEW |