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 1466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1477 return (x & y) | 0; | 1477 return (x & y) | 0; |
1478 } | 1478 } |
1479 return {func: func}; | 1479 return {func: func}; |
1480 } | 1480 } |
1481 | 1481 |
1482 Module(stdlib); | 1482 Module(stdlib); |
1483 assertTrue(%IsNotAsmWasmCode(Module)); | 1483 assertTrue(%IsNotAsmWasmCode(Module)); |
1484 })(); | 1484 })(); |
1485 | 1485 |
1486 | 1486 |
| 1487 (function TestBadExportKey() { |
| 1488 function Module() { |
| 1489 "use asm"; |
| 1490 function func() { |
| 1491 } |
| 1492 return {123: func}; |
| 1493 } |
| 1494 |
| 1495 Module(stdlib); |
| 1496 assertTrue(%IsNotAsmWasmCode(Module)); |
| 1497 })(); |
| 1498 |
| 1499 |
1487 function TestAndIntAndHeapValue(stdlib, foreign, buffer) { | 1500 function TestAndIntAndHeapValue(stdlib, foreign, buffer) { |
1488 "use asm"; | 1501 "use asm"; |
1489 var HEAP32 = new stdlib.Int32Array(buffer); | 1502 var HEAP32 = new stdlib.Int32Array(buffer); |
1490 function func() { | 1503 function func() { |
1491 var x = 0; | 1504 var x = 0; |
1492 x = HEAP32[0] & -1; | 1505 x = HEAP32[0] & -1; |
1493 return x | 0; | 1506 return x | 0; |
1494 } | 1507 } |
1495 return {caller: func}; | 1508 return {caller: func}; |
1496 } | 1509 } |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1708 "use asm"; | 1721 "use asm"; |
1709 function foo() { | 1722 function foo() { |
1710 return 42; | 1723 return 42; |
1711 } | 1724 } |
1712 return {bar: foo, baz: foo}; | 1725 return {bar: foo, baz: foo}; |
1713 } | 1726 } |
1714 var m = asmModule(); | 1727 var m = asmModule(); |
1715 assertEquals(42, m.bar()); | 1728 assertEquals(42, m.bar()); |
1716 assertEquals(42, m.baz()); | 1729 assertEquals(42, m.baz()); |
1717 })(); | 1730 })(); |
OLD | NEW |