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

Side by Side Diff: runtime/vm/flow_graph_compiler_ia32.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_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 "lib/error.h" 10 #include "lib/error.h"
(...skipping 1486 matching lines...) Expand 10 before | Expand all | Expand 10 after
1497 case ABOVE: return unsigned_left > unsigned_right; 1497 case ABOVE: return unsigned_left > unsigned_right;
1498 case ABOVE_EQUAL: return unsigned_left >= unsigned_right; 1498 case ABOVE_EQUAL: return unsigned_left >= unsigned_right;
1499 default: 1499 default:
1500 UNIMPLEMENTED(); 1500 UNIMPLEMENTED();
1501 return false; 1501 return false;
1502 } 1502 }
1503 } 1503 }
1504 1504
1505 1505
1506 FieldAddress FlowGraphCompiler::ElementAddressForIntIndex(intptr_t cid, 1506 FieldAddress FlowGraphCompiler::ElementAddressForIntIndex(intptr_t cid,
1507 intptr_t index_scale,
1507 Register array, 1508 Register array,
1508 intptr_t index) { 1509 intptr_t index) {
1509 const int64_t disp = 1510 const int64_t disp =
1510 static_cast<int64_t>(index) * ElementSizeFor(cid) + DataOffsetFor(cid); 1511 static_cast<int64_t>(index) * index_scale + DataOffsetFor(cid);
1511 ASSERT(Utils::IsInt(32, disp)); 1512 ASSERT(Utils::IsInt(32, disp));
1512 return FieldAddress(array, static_cast<int32_t>(disp)); 1513 return FieldAddress(array, static_cast<int32_t>(disp));
1513 } 1514 }
1514 1515
1515 1516
1516 FieldAddress FlowGraphCompiler::ElementAddressForRegIndex(intptr_t cid, 1517 static ScaleFactor ToScaleFactor(intptr_t index_scale) {
srdjan 2013/02/06 17:11:16 I understand this function but find it confusing (
Florian Schneider 2013/02/14 12:20:51 It is indeed a little subtle. The code before had
srdjan 2013/02/14 16:36:35 No :-(.
1517 Register array, 1518 // Note that index is expected smi-tagged, (i.e, times 2) for all arrays with
1518 Register index) { 1519 // index scale factor > 1. E.g., for Uint8Array and OneByteString the index is
1519 // Note that index is smi-tagged, (i.e, times 2) for all arrays with element 1520 // expected to be untagged before accessing.
1520 // size > 1. For Uint8Array and OneByteString the index is expected to be
1521 // untagged before accessing.
1522 ASSERT(kSmiTagShift == 1); 1521 ASSERT(kSmiTagShift == 1);
1523 switch (cid) { 1522 switch (index_scale) {
1524 case kArrayCid: 1523 case 1: return TIMES_1;
1525 case kImmutableArrayCid: 1524 case 2: return TIMES_1;
1526 return FieldAddress( 1525 case 4: return TIMES_2;
1527 array, index, TIMES_HALF_WORD_SIZE, Array::data_offset()); 1526 case 8: return TIMES_4;
1528 case kFloat32ArrayCid:
1529 return FieldAddress(array, index, TIMES_2, Float32Array::data_offset());
1530 case kFloat64ArrayCid:
1531 return FieldAddress(array, index, TIMES_4, Float64Array::data_offset());
1532 case kInt8ArrayCid:
1533 return FieldAddress(array, index, TIMES_1, Int8Array::data_offset());
1534 case kUint8ArrayCid:
1535 return FieldAddress(array, index, TIMES_1, Uint8Array::data_offset());
1536 case kUint8ClampedArrayCid:
1537 return
1538 FieldAddress(array, index, TIMES_1, Uint8ClampedArray::data_offset());
1539 case kInt16ArrayCid:
1540 return FieldAddress(array, index, TIMES_1, Int16Array::data_offset());
1541 case kUint16ArrayCid:
1542 return FieldAddress(array, index, TIMES_1, Uint16Array::data_offset());
1543 case kInt32ArrayCid:
1544 return FieldAddress(array, index, TIMES_2, Int32Array::data_offset());
1545 case kUint32ArrayCid:
1546 return FieldAddress(array, index, TIMES_2, Uint32Array::data_offset());
1547 case kOneByteStringCid:
1548 return FieldAddress(array, index, TIMES_1, OneByteString::data_offset());
1549 case kTwoByteStringCid:
1550 return FieldAddress(array, index, TIMES_1, TwoByteString::data_offset());
1551 default: 1527 default:
1552 UNIMPLEMENTED(); 1528 UNREACHABLE();
1553 return FieldAddress(SPREG, 0); 1529 return TIMES_1;
1554 } 1530 }
1555 } 1531 }
1556 1532
1557 1533
1558 Address FlowGraphCompiler::ExternalElementAddressForIntIndex(intptr_t cid, 1534 FieldAddress FlowGraphCompiler::ElementAddressForRegIndex(intptr_t cid,
1559 Register array, 1535 intptr_t index_scale,
1560 intptr_t index) { 1536 Register array,
1561 return Address(array, index * ElementSizeFor(cid)); 1537 Register index) {
1538 return FieldAddress(array,
1539 index,
1540 ToScaleFactor(index_scale),
1541 DataOffsetFor(cid));
1562 } 1542 }
1563 1543
1564 1544
1565 Address FlowGraphCompiler::ExternalElementAddressForRegIndex(intptr_t cid, 1545 Address FlowGraphCompiler::ExternalElementAddressForIntIndex(
1566 Register array, 1546 intptr_t cid,
1567 Register index) { 1547 intptr_t index_scale,
1548 Register array,
1549 intptr_t index) {
1550 return Address(array, index * index_scale);
1551 }
1552
1553
1554 Address FlowGraphCompiler::ExternalElementAddressForRegIndex(
1555 intptr_t cid,
1556 intptr_t index_scale,
1557 Register array,
1558 Register index) {
1568 switch (cid) { 1559 switch (cid) {
1569 case kExternalUint8ArrayCid: 1560 case kExternalUint8ArrayCid:
1570 return Address(array, index, TIMES_1, 0); 1561 return Address(array, index, ToScaleFactor(index_scale), 0);
1571 default: 1562 default:
1572 UNIMPLEMENTED(); 1563 UNIMPLEMENTED();
1573 return Address(SPREG, 0); 1564 return Address(SPREG, 0);
1574 } 1565 }
1575 } 1566 }
1576 1567
1577 1568
1578 #undef __ 1569 #undef __
1579 #define __ compiler_->assembler()-> 1570 #define __ compiler_->assembler()->
1580 1571
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
1730 __ popl(ECX); 1721 __ popl(ECX);
1731 __ popl(EAX); 1722 __ popl(EAX);
1732 } 1723 }
1733 1724
1734 1725
1735 #undef __ 1726 #undef __
1736 1727
1737 } // namespace dart 1728 } // namespace dart
1738 1729
1739 #endif // defined TARGET_ARCH_IA32 1730 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698