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

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

Issue 12301042: Implement ARM disassembler. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: 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
« no previous file with comments | « runtime/tests/vm/vm.status ('k') | runtime/vm/disassembler_arm.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" 5 #include "vm/globals.h"
6 #if defined(TARGET_ARCH_ARM) 6 #if defined(TARGET_ARCH_ARM)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 9
10 #include "vm/stub_code.h" 10 #include "vm/stub_code.h"
(...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1169 } 1169 }
1170 1170
1171 1171
1172 void Assembler::BranchLink(const ExternalLabel* label) { 1172 void Assembler::BranchLink(const ExternalLabel* label) {
1173 LoadImmediate(IP, label->address()); // Target address is never patched. 1173 LoadImmediate(IP, label->address()); // Target address is never patched.
1174 blx(IP); // Use blx instruction so that the return branch prediction works. 1174 blx(IP); // Use blx instruction so that the return branch prediction works.
1175 } 1175 }
1176 1176
1177 1177
1178 void Assembler::BranchLinkPatchable(const ExternalLabel* label) { 1178 void Assembler::BranchLinkPatchable(const ExternalLabel* label) {
1179 // TODO(regis): Make sure that CodePatcher is able to patch the label referred 1179 // Make sure that class CallPattern is able to patch the label referred
1180 // to by this code sequence. 1180 // to by this code sequence.
1181 // For added code robustness, use 'blx lr' in a patchable sequence and 1181 // For added code robustness, use 'blx lr' in a patchable sequence and
1182 // use 'blx ip' in a non-patchable sequence (see other BranchLink flavors). 1182 // use 'blx ip' in a non-patchable sequence (see other BranchLink flavors).
1183 const int32_t offset = 1183 const int32_t offset =
1184 Array::data_offset() + 4*AddExternalLabel(label) - kHeapObjectTag; 1184 Array::data_offset() + 4*AddExternalLabel(label) - kHeapObjectTag;
1185 if (Address::CanHoldLoadOffset(kLoadWord, offset)) { 1185 if (Address::CanHoldLoadOffset(kLoadWord, offset)) {
1186 ldr(LR, Address(PP, offset)); 1186 ldr(LR, Address(PP, offset));
1187 } else { 1187 } else {
1188 int32_t offset12_hi = offset & ~kOffset12Mask; // signed 1188 int32_t offset12_hi = offset & ~kOffset12Mask; // signed
1189 uint32_t offset12_lo = offset & kOffset12Mask; // unsigned 1189 uint32_t offset12_lo = offset & kOffset12Mask; // unsigned
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
1550 // The object pool cannot be used in the vm isolate. 1550 // The object pool cannot be used in the vm isolate.
1551 ASSERT(Isolate::Current() != Dart::vm_isolate()); 1551 ASSERT(Isolate::Current() != Dart::vm_isolate());
1552 object_pool_ = GrowableObjectArray::New(); 1552 object_pool_ = GrowableObjectArray::New();
1553 } 1553 }
1554 for (int i = 0; i < object_pool_.Length(); i++) { 1554 for (int i = 0; i < object_pool_.Length(); i++) {
1555 if (object_pool_.At(i) == obj.raw()) { 1555 if (object_pool_.At(i) == obj.raw()) {
1556 return i; 1556 return i;
1557 } 1557 }
1558 } 1558 }
1559 object_pool_.Add(obj); 1559 object_pool_.Add(obj);
1560 return object_pool_.Length(); 1560 return object_pool_.Length() - 1;
1561 } 1561 }
1562 1562
1563 1563
1564 int32_t Assembler::AddExternalLabel(const ExternalLabel* label) { 1564 int32_t Assembler::AddExternalLabel(const ExternalLabel* label) {
1565 if (object_pool_.IsNull()) { 1565 if (object_pool_.IsNull()) {
1566 // The object pool cannot be used in the vm isolate. 1566 // The object pool cannot be used in the vm isolate.
1567 ASSERT(Isolate::Current() != Dart::vm_isolate()); 1567 ASSERT(Isolate::Current() != Dart::vm_isolate());
1568 object_pool_ = GrowableObjectArray::New(); 1568 object_pool_ = GrowableObjectArray::New();
1569 } 1569 }
1570 const word address = label->address(); 1570 const word address = label->address();
1571 ASSERT(Utils::IsAligned(address, 4)); 1571 ASSERT(Utils::IsAligned(address, 4));
1572 // The address is stored in the object array as a RawSmi. 1572 // The address is stored in the object array as a RawSmi.
1573 const Smi& smi = Smi::Handle(Smi::New(address >> kSmiTagShift)); 1573 const Smi& smi = Smi::Handle(Smi::New(address >> kSmiTagShift));
1574 // Do not reuse an existing entry, since each reference may be patched 1574 // Do not reuse an existing entry, since each reference may be patched
1575 // independently. 1575 // independently.
1576 object_pool_.Add(smi); 1576 object_pool_.Add(smi);
1577 return object_pool_.Length(); 1577 return object_pool_.Length() - 1;
1578 } 1578 }
1579 1579
1580 } // namespace dart 1580 } // namespace dart
1581 1581
1582 #endif // defined TARGET_ARCH_ARM 1582 #endif // defined TARGET_ARCH_ARM
1583 1583
OLDNEW
« no previous file with comments | « runtime/tests/vm/vm.status ('k') | runtime/vm/disassembler_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698