| 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 1479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1490 function func() { | 1490 function func() { |
| 1491 } | 1491 } |
| 1492 return {123: func}; | 1492 return {123: func}; |
| 1493 } | 1493 } |
| 1494 | 1494 |
| 1495 Module(stdlib); | 1495 Module(stdlib); |
| 1496 assertTrue(%IsNotAsmWasmCode(Module)); | 1496 assertTrue(%IsNotAsmWasmCode(Module)); |
| 1497 })(); | 1497 })(); |
| 1498 | 1498 |
| 1499 | 1499 |
| 1500 (function TestUnicodeExportKey() { |
| 1501 function Module() { |
| 1502 "use asm"; |
| 1503 function func() { |
| 1504 return 42; |
| 1505 } |
| 1506 return {"\u00d1\u00e6": func}; |
| 1507 } |
| 1508 |
| 1509 var m = Module(stdlib); |
| 1510 assertEquals(42, m.Ñæ()); |
| 1511 assertValidAsm(Module); |
| 1512 })(); |
| 1513 |
| 1514 |
| 1500 function TestAndIntAndHeapValue(stdlib, foreign, buffer) { | 1515 function TestAndIntAndHeapValue(stdlib, foreign, buffer) { |
| 1501 "use asm"; | 1516 "use asm"; |
| 1502 var HEAP32 = new stdlib.Int32Array(buffer); | 1517 var HEAP32 = new stdlib.Int32Array(buffer); |
| 1503 function func() { | 1518 function func() { |
| 1504 var x = 0; | 1519 var x = 0; |
| 1505 x = HEAP32[0] & -1; | 1520 x = HEAP32[0] & -1; |
| 1506 return x | 0; | 1521 return x | 0; |
| 1507 } | 1522 } |
| 1508 return {caller: func}; | 1523 return {caller: func}; |
| 1509 } | 1524 } |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1721 "use asm"; | 1736 "use asm"; |
| 1722 function foo() { | 1737 function foo() { |
| 1723 return 42; | 1738 return 42; |
| 1724 } | 1739 } |
| 1725 return {bar: foo, baz: foo}; | 1740 return {bar: foo, baz: foo}; |
| 1726 } | 1741 } |
| 1727 var m = asmModule(); | 1742 var m = asmModule(); |
| 1728 assertEquals(42, m.bar()); | 1743 assertEquals(42, m.bar()); |
| 1729 assertEquals(42, m.baz()); | 1744 assertEquals(42, m.baz()); |
| 1730 })(); | 1745 })(); |
| OLD | NEW |