OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
7 | 7 |
8 #include "vm/flow_graph_compiler.h" | 8 #include "vm/flow_graph_compiler.h" |
9 | 9 |
10 #include "vm/ast_printer.h" | 10 #include "vm/ast_printer.h" |
(...skipping 1521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1532 __ Drop(argument_count); | 1532 __ Drop(argument_count); |
1533 if (!is_last_check) { | 1533 if (!is_last_check) { |
1534 assembler()->jmp(&match_found); | 1534 assembler()->jmp(&match_found); |
1535 } | 1535 } |
1536 assembler()->Bind(&next_test); | 1536 assembler()->Bind(&next_test); |
1537 } | 1537 } |
1538 assembler()->Bind(&match_found); | 1538 assembler()->Bind(&match_found); |
1539 } | 1539 } |
1540 | 1540 |
1541 | 1541 |
1542 Address FlowGraphCompiler::ElementAddressForIntIndex(intptr_t cid, | |
1543 intptr_t index_scale, | |
1544 Register array, | |
1545 intptr_t index) { | |
1546 const int64_t disp = | |
1547 static_cast<int64_t>(index) * index_scale + DataOffsetFor(cid); | |
1548 ASSERT(Utils::IsInt(32, disp)); | |
1549 return FieldAddress(array, static_cast<int32_t>(disp)); | |
1550 } | |
1551 | |
1552 | |
1553 static ScaleFactor ToScaleFactor(intptr_t index_scale) { | |
1554 // Note that index is expected smi-tagged, (i.e, times 2) for all arrays with | |
1555 // index scale factor > 1. E.g., for Uint8Array and OneByteString the index is | |
1556 // expected to be untagged before accessing. | |
1557 ASSERT(kSmiTagShift == 1); | |
1558 switch (index_scale) { | |
1559 case 1: return TIMES_1; | |
1560 case 2: return TIMES_1; | |
1561 case 4: return TIMES_2; | |
1562 case 8: return TIMES_4; | |
1563 case 16: return TIMES_8; | |
1564 default: | |
1565 UNREACHABLE(); | |
1566 return TIMES_1; | |
1567 } | |
1568 } | |
1569 | |
1570 | |
1571 Address FlowGraphCompiler::ElementAddressForRegIndex(intptr_t cid, | |
1572 intptr_t index_scale, | |
1573 Register array, | |
1574 Register index) { | |
1575 return FieldAddress(array, | |
1576 index, | |
1577 ToScaleFactor(index_scale), | |
1578 DataOffsetFor(cid)); | |
1579 } | |
1580 | |
1581 | |
1582 Address FlowGraphCompiler::ExternalElementAddressForIntIndex( | |
1583 intptr_t index_scale, | |
1584 Register array, | |
1585 intptr_t index) { | |
1586 return Address(array, index * index_scale); | |
1587 } | |
1588 | |
1589 | |
1590 Address FlowGraphCompiler::ExternalElementAddressForRegIndex( | |
1591 intptr_t index_scale, | |
1592 Register array, | |
1593 Register index) { | |
1594 return Address(array, index, ToScaleFactor(index_scale), 0); | |
1595 } | |
1596 | |
1597 | |
1598 #undef __ | 1542 #undef __ |
1599 #define __ compiler_->assembler()-> | 1543 #define __ compiler_->assembler()-> |
1600 | 1544 |
1601 | 1545 |
1602 void ParallelMoveResolver::EmitMove(int index) { | 1546 void ParallelMoveResolver::EmitMove(int index) { |
1603 MoveOperands* move = moves_[index]; | 1547 MoveOperands* move = moves_[index]; |
1604 const Location source = move->src(); | 1548 const Location source = move->src(); |
1605 const Location destination = move->dest(); | 1549 const Location destination = move->dest(); |
1606 | 1550 |
1607 if (source.IsRegister()) { | 1551 if (source.IsRegister()) { |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1837 __ movups(reg, Address(ESP, 0)); | 1781 __ movups(reg, Address(ESP, 0)); |
1838 __ addl(ESP, Immediate(kFpuRegisterSize)); | 1782 __ addl(ESP, Immediate(kFpuRegisterSize)); |
1839 } | 1783 } |
1840 | 1784 |
1841 | 1785 |
1842 #undef __ | 1786 #undef __ |
1843 | 1787 |
1844 } // namespace dart | 1788 } // namespace dart |
1845 | 1789 |
1846 #endif // defined TARGET_ARCH_IA32 | 1790 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |