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_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
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 1557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1568 __ Drop(argument_count); | 1568 __ Drop(argument_count); |
1569 if (!is_last_check) { | 1569 if (!is_last_check) { |
1570 assembler()->jmp(&match_found); | 1570 assembler()->jmp(&match_found); |
1571 } | 1571 } |
1572 assembler()->Bind(&next_test); | 1572 assembler()->Bind(&next_test); |
1573 } | 1573 } |
1574 assembler()->Bind(&match_found); | 1574 assembler()->Bind(&match_found); |
1575 } | 1575 } |
1576 | 1576 |
1577 | 1577 |
1578 FieldAddress FlowGraphCompiler::ElementAddressForIntIndex(intptr_t cid, | 1578 Address FlowGraphCompiler::ElementAddressForIntIndex(intptr_t cid, |
1579 intptr_t index_scale, | 1579 intptr_t index_scale, |
1580 Register array, | 1580 Register array, |
1581 intptr_t index) { | 1581 intptr_t index) { |
1582 const int64_t disp = | 1582 const int64_t disp = |
1583 static_cast<int64_t>(index) * index_scale + DataOffsetFor(cid); | 1583 static_cast<int64_t>(index) * index_scale + DataOffsetFor(cid); |
1584 ASSERT(Utils::IsInt(32, disp)); | 1584 ASSERT(Utils::IsInt(32, disp)); |
1585 return FieldAddress(array, static_cast<int32_t>(disp)); | 1585 return FieldAddress(array, static_cast<int32_t>(disp)); |
1586 } | 1586 } |
1587 | 1587 |
1588 | 1588 |
1589 static ScaleFactor ToScaleFactor(intptr_t index_scale) { | 1589 static ScaleFactor ToScaleFactor(intptr_t index_scale) { |
1590 // Note that index is expected smi-tagged, (i.e, times 2) for all arrays with | 1590 // Note that index is expected smi-tagged, (i.e, times 2) for all arrays with |
1591 // index scale factor > 1. E.g., for Uint8Array and OneByteString the index is | 1591 // index scale factor > 1. E.g., for Uint8Array and OneByteString the index is |
1592 // expected to be untagged before accessing. | 1592 // expected to be untagged before accessing. |
1593 ASSERT(kSmiTagShift == 1); | 1593 ASSERT(kSmiTagShift == 1); |
1594 switch (index_scale) { | 1594 switch (index_scale) { |
1595 case 1: return TIMES_1; | 1595 case 1: return TIMES_1; |
1596 case 2: return TIMES_1; | 1596 case 2: return TIMES_1; |
1597 case 4: return TIMES_2; | 1597 case 4: return TIMES_2; |
1598 case 8: return TIMES_4; | 1598 case 8: return TIMES_4; |
1599 case 16: return TIMES_8; | 1599 case 16: return TIMES_8; |
1600 default: | 1600 default: |
1601 UNREACHABLE(); | 1601 UNREACHABLE(); |
1602 return TIMES_1; | 1602 return TIMES_1; |
1603 } | 1603 } |
1604 } | 1604 } |
1605 | 1605 |
1606 | 1606 |
1607 FieldAddress FlowGraphCompiler::ElementAddressForRegIndex(intptr_t cid, | 1607 Address FlowGraphCompiler::ElementAddressForRegIndex(intptr_t cid, |
1608 intptr_t index_scale, | 1608 intptr_t index_scale, |
1609 Register array, | 1609 Register array, |
1610 Register index) { | 1610 Register index) { |
1611 return FieldAddress(array, | 1611 return FieldAddress(array, |
1612 index, | 1612 index, |
1613 ToScaleFactor(index_scale), | 1613 ToScaleFactor(index_scale), |
1614 DataOffsetFor(cid)); | 1614 DataOffsetFor(cid)); |
1615 } | 1615 } |
1616 | 1616 |
1617 | 1617 |
1618 Address FlowGraphCompiler::ExternalElementAddressForIntIndex( | 1618 Address FlowGraphCompiler::ExternalElementAddressForIntIndex( |
1619 intptr_t index_scale, | 1619 intptr_t index_scale, |
1620 Register array, | 1620 Register array, |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1841 __ movups(reg, Address(RSP, 0)); | 1841 __ movups(reg, Address(RSP, 0)); |
1842 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP); | 1842 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP); |
1843 } | 1843 } |
1844 | 1844 |
1845 | 1845 |
1846 #undef __ | 1846 #undef __ |
1847 | 1847 |
1848 } // namespace dart | 1848 } // namespace dart |
1849 | 1849 |
1850 #endif // defined TARGET_ARCH_X64 | 1850 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |