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

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
« no previous file with comments | « runtime/vm/flow_graph_compiler_mips.cc ('k') | runtime/vm/flow_graph_optimizer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1532 matching lines...) Expand 10 before | Expand all | Expand 10 after
1543 SortICDataByCount(ic_data, &sorted); 1543 SortICDataByCount(ic_data, &sorted);
1544 ASSERT(class_id_reg != R10); 1544 ASSERT(class_id_reg != R10);
1545 ASSERT(len > 0); // Why bother otherwise. 1545 ASSERT(len > 0); // Why bother otherwise.
1546 const Array& arguments_descriptor = 1546 const Array& arguments_descriptor =
1547 Array::ZoneHandle(ArgumentsDescriptor::New(argument_count, 1547 Array::ZoneHandle(ArgumentsDescriptor::New(argument_count,
1548 argument_names)); 1548 argument_names));
1549 __ LoadObject(R10, arguments_descriptor, PP); 1549 __ LoadObject(R10, arguments_descriptor, PP);
1550 for (intptr_t i = 0; i < len; i++) { 1550 for (intptr_t i = 0; i < len; i++) {
1551 const bool is_last_check = (i == (len - 1)); 1551 const bool is_last_check = (i == (len - 1));
1552 Label next_test; 1552 Label next_test;
1553 assembler()->cmpl(class_id_reg, Immediate(sorted[i].cid)); 1553 __ cmpl(class_id_reg, Immediate(sorted[i].cid));
1554 if (is_last_check) { 1554 if (is_last_check) {
1555 assembler()->j(NOT_EQUAL, deopt); 1555 __ j(NOT_EQUAL, deopt);
1556 } else { 1556 } else {
1557 assembler()->j(NOT_EQUAL, &next_test); 1557 __ j(NOT_EQUAL, &next_test);
1558 } 1558 }
1559 // Do not use the code from the function, but let the code be patched so 1559 // Do not use the code from the function, but let the code be patched so
1560 // that we can record the outgoing edges to other code. 1560 // that we can record the outgoing edges to other code.
1561 GenerateDartCall(deopt_id, 1561 GenerateDartCall(deopt_id,
1562 token_index, 1562 token_index,
1563 &StubCode::CallStaticFunctionLabel(), 1563 &StubCode::CallStaticFunctionLabel(),
1564 PcDescriptors::kOptStaticCall, 1564 PcDescriptors::kOptStaticCall,
1565 locs); 1565 locs);
1566 const Function& function = *sorted[i].target; 1566 const Function& function = *sorted[i].target;
1567 AddStaticCallTarget(function); 1567 AddStaticCallTarget(function);
1568 __ Drop(argument_count); 1568 __ Drop(argument_count);
1569 if (!is_last_check) { 1569 if (!is_last_check) {
1570 assembler()->jmp(&match_found); 1570 __ jmp(&match_found);
1571 } 1571 }
1572 assembler()->Bind(&next_test); 1572 __ Bind(&next_test);
1573 } 1573 }
1574 assembler()->Bind(&match_found); 1574 __ Bind(&match_found);
1575 }
1576
1577
1578 Address FlowGraphCompiler::ElementAddressForIntIndex(intptr_t cid,
1579 intptr_t index_scale,
1580 Register array,
1581 intptr_t index) {
1582 const int64_t disp =
1583 static_cast<int64_t>(index) * index_scale + DataOffsetFor(cid);
1584 ASSERT(Utils::IsInt(32, disp));
1585 return FieldAddress(array, static_cast<int32_t>(disp));
1586 }
1587
1588
1589 static ScaleFactor ToScaleFactor(intptr_t index_scale) {
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
1592 // expected to be untagged before accessing.
1593 ASSERT(kSmiTagShift == 1);
1594 switch (index_scale) {
1595 case 1: return TIMES_1;
1596 case 2: return TIMES_1;
1597 case 4: return TIMES_2;
1598 case 8: return TIMES_4;
1599 case 16: return TIMES_8;
1600 default:
1601 UNREACHABLE();
1602 return TIMES_1;
1603 }
1604 }
1605
1606
1607 Address FlowGraphCompiler::ElementAddressForRegIndex(intptr_t cid,
1608 intptr_t index_scale,
1609 Register array,
1610 Register index) {
1611 return FieldAddress(array,
1612 index,
1613 ToScaleFactor(index_scale),
1614 DataOffsetFor(cid));
1615 }
1616
1617
1618 Address FlowGraphCompiler::ExternalElementAddressForIntIndex(
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 } 1575 }
1632 1576
1633 1577
1634 #undef __ 1578 #undef __
1635 #define __ compiler_->assembler()-> 1579 #define __ compiler_->assembler()->
1636 1580
1637 1581
1638 void ParallelMoveResolver::EmitMove(int index) { 1582 void ParallelMoveResolver::EmitMove(int index) {
1639 MoveOperands* move = moves_[index]; 1583 MoveOperands* move = moves_[index];
1640 const Location source = move->src(); 1584 const Location source = move->src();
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
1841 __ movups(reg, Address(RSP, 0)); 1785 __ movups(reg, Address(RSP, 0));
1842 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP); 1786 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP);
1843 } 1787 }
1844 1788
1845 1789
1846 #undef __ 1790 #undef __
1847 1791
1848 } // namespace dart 1792 } // namespace dart
1849 1793
1850 #endif // defined TARGET_ARCH_X64 1794 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_mips.cc ('k') | runtime/vm/flow_graph_optimizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698