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

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

Issue 12218008: Inline getters of byte array view in the optimized flow graph. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: updated vm.status with new test Created 7 years, 10 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 "lib/error.h" 10 #include "lib/error.h"
(...skipping 1490 matching lines...) Expand 10 before | Expand all | Expand 10 after
1501 case ABOVE: return unsigned_left > unsigned_right; 1501 case ABOVE: return unsigned_left > unsigned_right;
1502 case ABOVE_EQUAL: return unsigned_left >= unsigned_right; 1502 case ABOVE_EQUAL: return unsigned_left >= unsigned_right;
1503 default: 1503 default:
1504 UNIMPLEMENTED(); 1504 UNIMPLEMENTED();
1505 return false; 1505 return false;
1506 } 1506 }
1507 } 1507 }
1508 1508
1509 1509
1510 FieldAddress FlowGraphCompiler::ElementAddressForIntIndex(intptr_t cid, 1510 FieldAddress FlowGraphCompiler::ElementAddressForIntIndex(intptr_t cid,
1511 intptr_t index_scale,
1511 Register array, 1512 Register array,
1512 intptr_t index) { 1513 intptr_t index) {
1513 const int64_t disp = 1514 const int64_t disp =
1514 static_cast<int64_t>(index) * ElementSizeFor(cid) + DataOffsetFor(cid); 1515 static_cast<int64_t>(index) * index_scale + DataOffsetFor(cid);
1515 ASSERT(Utils::IsInt(32, disp)); 1516 ASSERT(Utils::IsInt(32, disp));
1516 return FieldAddress(array, static_cast<int32_t>(disp)); 1517 return FieldAddress(array, static_cast<int32_t>(disp));
1517 } 1518 }
1518 1519
1519 1520
1520 FieldAddress FlowGraphCompiler::ElementAddressForRegIndex(intptr_t cid, 1521 static ScaleFactor ToScaleFactor(intptr_t index_scale) {
1521 Register array, 1522 // Note that index is expected smi-tagged, (i.e, times 2) for all arrays with
1522 Register index) { 1523 // index scale factor > 1. E.g., for Uint8Array and OneByteString the index is
1523 // Note that index is smi-tagged, (i.e, times 2) for all arrays with element 1524 // expected to be untagged before accessing.
1524 // size > 1. For Uint8Array and OneByteString the index is expected to be
1525 // untagged before accessing.
1526 ASSERT(kSmiTagShift == 1); 1525 ASSERT(kSmiTagShift == 1);
1527 switch (cid) { 1526 switch (index_scale) {
1528 case kArrayCid: 1527 case 1: return TIMES_1;
1529 case kImmutableArrayCid: 1528 case 2: return TIMES_1;
1530 return FieldAddress( 1529 case 4: return TIMES_2;
1531 array, index, TIMES_HALF_WORD_SIZE, Array::data_offset()); 1530 case 8: return TIMES_4;
1532 case kFloat32ArrayCid:
1533 return FieldAddress(array, index, TIMES_2, Float32Array::data_offset());
1534 case kFloat64ArrayCid:
1535 return FieldAddress(array, index, TIMES_4, Float64Array::data_offset());
1536 case kInt8ArrayCid:
1537 return FieldAddress(array, index, TIMES_1, Int8Array::data_offset());
1538 case kUint8ArrayCid:
1539 return FieldAddress(array, index, TIMES_1, Uint8Array::data_offset());
1540 case kUint8ClampedArrayCid:
1541 return
1542 FieldAddress(array, index, TIMES_1, Uint8ClampedArray::data_offset());
1543 case kInt16ArrayCid:
1544 return FieldAddress(array, index, TIMES_1, Int16Array::data_offset());
1545 case kUint16ArrayCid:
1546 return FieldAddress(array, index, TIMES_1, Uint16Array::data_offset());
1547 case kInt32ArrayCid:
1548 return FieldAddress(array, index, TIMES_2, Int32Array::data_offset());
1549 case kUint32ArrayCid:
1550 return FieldAddress(array, index, TIMES_2, Uint32Array::data_offset());
1551 case kOneByteStringCid:
1552 return FieldAddress(array, index, TIMES_1, OneByteString::data_offset());
1553 case kTwoByteStringCid:
1554 return FieldAddress(array, index, TIMES_1, TwoByteString::data_offset());
1555 default: 1531 default:
1556 UNIMPLEMENTED(); 1532 UNREACHABLE();
1557 return FieldAddress(SPREG, 0); 1533 return TIMES_1;
1558 } 1534 }
1559 } 1535 }
1560 1536
1561 1537
1562 Address FlowGraphCompiler::ExternalElementAddressForIntIndex(intptr_t cid, 1538 FieldAddress FlowGraphCompiler::ElementAddressForRegIndex(intptr_t cid,
1563 Register array, 1539 intptr_t index_scale,
1564 intptr_t index) { 1540 Register array,
1565 return Address(array, index * ElementSizeFor(cid)); 1541 Register index) {
1542 return FieldAddress(array,
1543 index,
1544 ToScaleFactor(index_scale),
1545 DataOffsetFor(cid));
1566 } 1546 }
1567 1547
1568 1548
1569 Address FlowGraphCompiler::ExternalElementAddressForRegIndex(intptr_t cid, 1549 Address FlowGraphCompiler::ExternalElementAddressForIntIndex(
1570 Register array, 1550 intptr_t cid,
1571 Register index) { 1551 intptr_t index_scale,
1552 Register array,
1553 intptr_t index) {
1554 return Address(array, index * index_scale);
1555 }
1556
1557
1558 Address FlowGraphCompiler::ExternalElementAddressForRegIndex(
1559 intptr_t cid,
1560 intptr_t index_scale,
1561 Register array,
1562 Register index) {
1572 switch (cid) { 1563 switch (cid) {
1573 case kExternalUint8ArrayCid: 1564 case kExternalUint8ArrayCid:
1574 return Address(array, index, TIMES_1, 0); 1565 return Address(array, index, ToScaleFactor(index_scale), 0);
1575 default: 1566 default:
1576 UNIMPLEMENTED(); 1567 UNIMPLEMENTED();
1577 return Address(SPREG, 0); 1568 return Address(SPREG, 0);
1578 } 1569 }
1579 } 1570 }
1580 1571
1581 1572
1582 #undef __ 1573 #undef __
1583 #define __ compiler_->assembler()-> 1574 #define __ compiler_->assembler()->
1584 1575
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
1708 void ParallelMoveResolver::Exchange(const Address& mem1, const Address& mem2) { 1699 void ParallelMoveResolver::Exchange(const Address& mem1, const Address& mem2) {
1709 __ Exchange(mem1, mem2); 1700 __ Exchange(mem1, mem2);
1710 } 1701 }
1711 1702
1712 1703
1713 #undef __ 1704 #undef __
1714 1705
1715 } // namespace dart 1706 } // namespace dart
1716 1707
1717 #endif // defined TARGET_ARCH_X64 1708 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698