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 FieldAddress FlowGraphCompiler::ElementAddressForIntIndex(intptr_t cid, | 1542 Address FlowGraphCompiler::ElementAddressForIntIndex(intptr_t cid, |
1543 intptr_t index_scale, | 1543 intptr_t index_scale, |
1544 Register array, | 1544 Register array, |
1545 intptr_t index) { | 1545 intptr_t index) { |
1546 const int64_t disp = | 1546 const int64_t disp = |
1547 static_cast<int64_t>(index) * index_scale + DataOffsetFor(cid); | 1547 static_cast<int64_t>(index) * index_scale + DataOffsetFor(cid); |
1548 ASSERT(Utils::IsInt(32, disp)); | 1548 ASSERT(Utils::IsInt(32, disp)); |
1549 return FieldAddress(array, static_cast<int32_t>(disp)); | 1549 return FieldAddress(array, static_cast<int32_t>(disp)); |
1550 } | 1550 } |
1551 | 1551 |
1552 | 1552 |
1553 static ScaleFactor ToScaleFactor(intptr_t index_scale) { | 1553 static ScaleFactor ToScaleFactor(intptr_t index_scale) { |
1554 // Note that index is expected smi-tagged, (i.e, times 2) for all arrays with | 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 | 1555 // index scale factor > 1. E.g., for Uint8Array and OneByteString the index is |
1556 // expected to be untagged before accessing. | 1556 // expected to be untagged before accessing. |
1557 ASSERT(kSmiTagShift == 1); | 1557 ASSERT(kSmiTagShift == 1); |
1558 switch (index_scale) { | 1558 switch (index_scale) { |
1559 case 1: return TIMES_1; | 1559 case 1: return TIMES_1; |
1560 case 2: return TIMES_1; | 1560 case 2: return TIMES_1; |
1561 case 4: return TIMES_2; | 1561 case 4: return TIMES_2; |
1562 case 8: return TIMES_4; | 1562 case 8: return TIMES_4; |
1563 case 16: return TIMES_8; | 1563 case 16: return TIMES_8; |
1564 default: | 1564 default: |
1565 UNREACHABLE(); | 1565 UNREACHABLE(); |
1566 return TIMES_1; | 1566 return TIMES_1; |
1567 } | 1567 } |
1568 } | 1568 } |
1569 | 1569 |
1570 | 1570 |
1571 FieldAddress FlowGraphCompiler::ElementAddressForRegIndex(intptr_t cid, | 1571 Address FlowGraphCompiler::ElementAddressForRegIndex(intptr_t cid, |
1572 intptr_t index_scale, | 1572 intptr_t index_scale, |
1573 Register array, | 1573 Register array, |
1574 Register index) { | 1574 Register index) { |
1575 return FieldAddress(array, | 1575 return FieldAddress(array, |
1576 index, | 1576 index, |
1577 ToScaleFactor(index_scale), | 1577 ToScaleFactor(index_scale), |
1578 DataOffsetFor(cid)); | 1578 DataOffsetFor(cid)); |
1579 } | 1579 } |
1580 | 1580 |
1581 | 1581 |
1582 Address FlowGraphCompiler::ExternalElementAddressForIntIndex( | 1582 Address FlowGraphCompiler::ExternalElementAddressForIntIndex( |
1583 intptr_t index_scale, | 1583 intptr_t index_scale, |
1584 Register array, | 1584 Register array, |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1837 __ movups(reg, Address(ESP, 0)); | 1837 __ movups(reg, Address(ESP, 0)); |
1838 __ addl(ESP, Immediate(kFpuRegisterSize)); | 1838 __ addl(ESP, Immediate(kFpuRegisterSize)); |
1839 } | 1839 } |
1840 | 1840 |
1841 | 1841 |
1842 #undef __ | 1842 #undef __ |
1843 | 1843 |
1844 } // namespace dart | 1844 } // namespace dart |
1845 | 1845 |
1846 #endif // defined TARGET_ARCH_IA32 | 1846 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |