Chromium Code Reviews| 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, | 1542 Address FlowGraphCompiler::ElementAddressForIntIndex(bool is_load, |
|
Florian Schneider
2014/05/23 07:54:16
I don't see is_load used anywhere.
regis
2014/05/23 14:51:05
You will see it being used on ARM in my next cl.
U
| |
| 1543 bool is_external, | |
| 1544 intptr_t cid, | |
| 1543 intptr_t index_scale, | 1545 intptr_t index_scale, |
| 1544 Register array, | 1546 Register array, |
| 1545 intptr_t index) { | 1547 intptr_t index) { |
| 1546 const int64_t disp = | 1548 if (is_external) { |
| 1547 static_cast<int64_t>(index) * index_scale + DataOffsetFor(cid); | 1549 return Address(array, index * index_scale); |
| 1548 ASSERT(Utils::IsInt(32, disp)); | 1550 } else { |
| 1549 return FieldAddress(array, static_cast<int32_t>(disp)); | 1551 const int64_t disp = |
| 1552 static_cast<int64_t>(index) * index_scale + DataOffsetFor(cid); | |
| 1553 ASSERT(Utils::IsInt(32, disp)); | |
| 1554 return FieldAddress(array, static_cast<int32_t>(disp)); | |
| 1555 } | |
| 1550 } | 1556 } |
| 1551 | 1557 |
| 1552 | 1558 |
| 1553 static ScaleFactor ToScaleFactor(intptr_t index_scale) { | 1559 static ScaleFactor ToScaleFactor(intptr_t index_scale) { |
| 1554 // Note that index is expected smi-tagged, (i.e, times 2) for all arrays with | 1560 // 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 | 1561 // index scale factor > 1. E.g., for Uint8Array and OneByteString the index is |
| 1556 // expected to be untagged before accessing. | 1562 // expected to be untagged before accessing. |
| 1557 ASSERT(kSmiTagShift == 1); | 1563 ASSERT(kSmiTagShift == 1); |
| 1558 switch (index_scale) { | 1564 switch (index_scale) { |
| 1559 case 1: return TIMES_1; | 1565 case 1: return TIMES_1; |
| 1560 case 2: return TIMES_1; | 1566 case 2: return TIMES_1; |
| 1561 case 4: return TIMES_2; | 1567 case 4: return TIMES_2; |
| 1562 case 8: return TIMES_4; | 1568 case 8: return TIMES_4; |
| 1563 case 16: return TIMES_8; | 1569 case 16: return TIMES_8; |
| 1564 default: | 1570 default: |
| 1565 UNREACHABLE(); | 1571 UNREACHABLE(); |
| 1566 return TIMES_1; | 1572 return TIMES_1; |
| 1567 } | 1573 } |
| 1568 } | 1574 } |
| 1569 | 1575 |
| 1570 | 1576 |
| 1571 Address FlowGraphCompiler::ElementAddressForRegIndex(intptr_t cid, | 1577 Address FlowGraphCompiler::ElementAddressForRegIndex(bool is_load, |
| 1578 bool is_external, | |
| 1579 intptr_t cid, | |
| 1572 intptr_t index_scale, | 1580 intptr_t index_scale, |
| 1573 Register array, | 1581 Register array, |
| 1574 Register index) { | 1582 Register index) { |
| 1575 return FieldAddress(array, | 1583 if (is_external) { |
| 1576 index, | 1584 return Address(array, index, ToScaleFactor(index_scale), 0); |
| 1577 ToScaleFactor(index_scale), | 1585 } else { |
| 1578 DataOffsetFor(cid)); | 1586 return FieldAddress(array, |
| 1579 } | 1587 index, |
| 1580 | 1588 ToScaleFactor(index_scale), |
| 1581 | 1589 DataOffsetFor(cid)); |
| 1582 Address FlowGraphCompiler::ExternalElementAddressForIntIndex( | 1590 } |
| 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 } | 1591 } |
| 1596 | 1592 |
| 1597 | 1593 |
| 1598 #undef __ | 1594 #undef __ |
| 1599 #define __ compiler_->assembler()-> | 1595 #define __ compiler_->assembler()-> |
| 1600 | 1596 |
| 1601 | 1597 |
| 1602 void ParallelMoveResolver::EmitMove(int index) { | 1598 void ParallelMoveResolver::EmitMove(int index) { |
| 1603 MoveOperands* move = moves_[index]; | 1599 MoveOperands* move = moves_[index]; |
| 1604 const Location source = move->src(); | 1600 const Location source = move->src(); |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1837 __ movups(reg, Address(ESP, 0)); | 1833 __ movups(reg, Address(ESP, 0)); |
| 1838 __ addl(ESP, Immediate(kFpuRegisterSize)); | 1834 __ addl(ESP, Immediate(kFpuRegisterSize)); |
| 1839 } | 1835 } |
| 1840 | 1836 |
| 1841 | 1837 |
| 1842 #undef __ | 1838 #undef __ |
| 1843 | 1839 |
| 1844 } // namespace dart | 1840 } // namespace dart |
| 1845 | 1841 |
| 1846 #endif // defined TARGET_ARCH_IA32 | 1842 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |