Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(238)

Side by Side Diff: runtime/vm/flow_graph_compiler_x64.cc

Issue 294223003: Last cross-platform cleanup in preparation of improved ARM code for indexed (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 Address FlowGraphCompiler::ElementAddressForIntIndex(intptr_t cid, 1578 Address FlowGraphCompiler::ElementAddressForIntIndex(bool is_load,
1579 bool is_external,
1580 intptr_t cid,
1579 intptr_t index_scale, 1581 intptr_t index_scale,
1580 Register array, 1582 Register array,
1581 intptr_t index) { 1583 intptr_t index) {
1582 const int64_t disp = 1584 if (is_external) {
1583 static_cast<int64_t>(index) * index_scale + DataOffsetFor(cid); 1585 return Address(array, index * index_scale);
1584 ASSERT(Utils::IsInt(32, disp)); 1586 } else {
1585 return FieldAddress(array, static_cast<int32_t>(disp)); 1587 const int64_t disp =
1588 static_cast<int64_t>(index) * index_scale + DataOffsetFor(cid);
1589 ASSERT(Utils::IsInt(32, disp));
1590 return FieldAddress(array, static_cast<int32_t>(disp));
1591 }
1586 } 1592 }
1587 1593
1588 1594
1589 static ScaleFactor ToScaleFactor(intptr_t index_scale) { 1595 static ScaleFactor ToScaleFactor(intptr_t index_scale) {
1590 // Note that index is expected smi-tagged, (i.e, times 2) for all arrays with 1596 // 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 1597 // index scale factor > 1. E.g., for Uint8Array and OneByteString the index is
1592 // expected to be untagged before accessing. 1598 // expected to be untagged before accessing.
1593 ASSERT(kSmiTagShift == 1); 1599 ASSERT(kSmiTagShift == 1);
1594 switch (index_scale) { 1600 switch (index_scale) {
1595 case 1: return TIMES_1; 1601 case 1: return TIMES_1;
1596 case 2: return TIMES_1; 1602 case 2: return TIMES_1;
1597 case 4: return TIMES_2; 1603 case 4: return TIMES_2;
1598 case 8: return TIMES_4; 1604 case 8: return TIMES_4;
1599 case 16: return TIMES_8; 1605 case 16: return TIMES_8;
1600 default: 1606 default:
1601 UNREACHABLE(); 1607 UNREACHABLE();
1602 return TIMES_1; 1608 return TIMES_1;
1603 } 1609 }
1604 } 1610 }
1605 1611
1606 1612
1607 Address FlowGraphCompiler::ElementAddressForRegIndex(intptr_t cid, 1613 Address FlowGraphCompiler::ElementAddressForRegIndex(bool is_load,
1614 bool is_external,
1615 intptr_t cid,
1608 intptr_t index_scale, 1616 intptr_t index_scale,
1609 Register array, 1617 Register array,
1610 Register index) { 1618 Register index) {
1611 return FieldAddress(array, 1619 if (is_external) {
1612 index, 1620 return Address(array, index, ToScaleFactor(index_scale), 0);
1613 ToScaleFactor(index_scale), 1621 } else {
1614 DataOffsetFor(cid)); 1622 return FieldAddress(array,
1615 } 1623 index,
1616 1624 ToScaleFactor(index_scale),
1617 1625 DataOffsetFor(cid));
1618 Address FlowGraphCompiler::ExternalElementAddressForIntIndex( 1626 }
1619 intptr_t index_scale,
1620 Register array,
1621 intptr_t index) {
1622 return Address(array, index * index_scale);
1623 }
1624
1625
1626 Address FlowGraphCompiler::ExternalElementAddressForRegIndex(
1627 intptr_t index_scale,
1628 Register array,
1629 Register index) {
1630 return Address(array, index, ToScaleFactor(index_scale), 0);
1631 } 1627 }
1632 1628
1633 1629
1634 #undef __ 1630 #undef __
1635 #define __ compiler_->assembler()-> 1631 #define __ compiler_->assembler()->
1636 1632
1637 1633
1638 void ParallelMoveResolver::EmitMove(int index) { 1634 void ParallelMoveResolver::EmitMove(int index) {
1639 MoveOperands* move = moves_[index]; 1635 MoveOperands* move = moves_[index];
1640 const Location source = move->src(); 1636 const Location source = move->src();
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
1841 __ movups(reg, Address(RSP, 0)); 1837 __ movups(reg, Address(RSP, 0));
1842 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP); 1838 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP);
1843 } 1839 }
1844 1840
1845 1841
1846 #undef __ 1842 #undef __
1847 1843
1848 } // namespace dart 1844 } // namespace dart
1849 1845
1850 #endif // defined TARGET_ARCH_X64 1846 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698