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

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

Issue 886173003: VM: Align implementations of assembler constant pools. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: fixed ARM debug assert Created 5 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" // NOLINT 5 #include "vm/globals.h" // NOLINT
6 #if defined(TARGET_ARCH_MIPS) 6 #if defined(TARGET_ARCH_MIPS)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/longjump.h" 9 #include "vm/longjump.h"
10 #include "vm/runtime_entry.h" 10 #include "vm/runtime_entry.h"
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 // Make sure that class CallPattern is able to decode this load immediate. 465 // Make sure that class CallPattern is able to decode this load immediate.
466 int32_t object_raw = reinterpret_cast<int32_t>(object.raw()); 466 int32_t object_raw = reinterpret_cast<int32_t>(object.raw());
467 const uint16_t object_low = Utils::Low16Bits(object_raw); 467 const uint16_t object_low = Utils::Low16Bits(object_raw);
468 const uint16_t object_high = Utils::High16Bits(object_raw); 468 const uint16_t object_high = Utils::High16Bits(object_raw);
469 lui(rd, Immediate(object_high)); 469 lui(rd, Immediate(object_high));
470 ori(rd, rd, Immediate(object_low)); 470 ori(rd, rd, Immediate(object_low));
471 } else { 471 } else {
472 // Make sure that class CallPattern is able to decode this load from the 472 // Make sure that class CallPattern is able to decode this load from the
473 // object pool. 473 // object pool.
474 const int32_t offset = 474 const int32_t offset =
475 Array::data_offset() + 4*AddObject(object) - kHeapObjectTag; 475 Array::element_offset(object_pool_.FindObject(object, kNotPatchable));
476 LoadWordFromPoolOffset(rd, offset); 476 LoadWordFromPoolOffset(rd, offset - kHeapObjectTag);
477 } 477 }
478 } 478 }
479 479
480 480
481 int32_t Assembler::AddObject(const Object& obj) {
482 ASSERT(obj.IsNotTemporaryScopedHandle());
483 ASSERT(obj.IsOld());
484 if (object_pool_.IsNull()) {
485 // The object pool cannot be used in the vm isolate.
486 ASSERT(Isolate::Current() != Dart::vm_isolate());
487 object_pool_ = GrowableObjectArray::New(Heap::kOld);
488 }
489
490 intptr_t index = object_pool_index_table_.Lookup(&obj);
491 if (index != ObjIndexPair::kNoIndex) {
492 return index;
493 }
494
495 object_pool_.Add(obj, Heap::kOld);
496 object_pool_index_table_.Insert(
497 ObjIndexPair(&obj, object_pool_.Length() - 1));
498 return object_pool_.Length() - 1;
499 }
500
501
502 void Assembler::PushObject(const Object& object) { 481 void Assembler::PushObject(const Object& object) {
503 ASSERT(!in_delay_slot_); 482 ASSERT(!in_delay_slot_);
504 LoadObject(TMP, object); 483 LoadObject(TMP, object);
505 Push(TMP); 484 Push(TMP);
506 } 485 }
507 486
508 487
509 // Preserves object and value registers. 488 // Preserves object and value registers.
510 void Assembler::StoreIntoObjectFilterNoSmi(Register object, 489 void Assembler::StoreIntoObjectFilterNoSmi(Register object,
511 Register value, 490 Register value,
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after
1149 // These go above the volatile CPU registers. 1128 // These go above the volatile CPU registers.
1150 const int slot = 1129 const int slot =
1151 (i - kDartFirstVolatileFpuReg) + kDartVolatileCpuRegCount + 2; 1130 (i - kDartFirstVolatileFpuReg) + kDartVolatileCpuRegCount + 2;
1152 FRegister reg = static_cast<FRegister>(i); 1131 FRegister reg = static_cast<FRegister>(i);
1153 lwc1(reg, Address(SP, slot * kWordSize)); 1132 lwc1(reg, Address(SP, slot * kWordSize));
1154 } 1133 }
1155 addiu(SP, SP, Immediate(kPushedRegistersSize)); 1134 addiu(SP, SP, Immediate(kPushedRegistersSize));
1156 } 1135 }
1157 1136
1158 1137
1159 int32_t Assembler::AddExternalLabel(const ExternalLabel* label) {
1160 if (object_pool_.IsNull()) {
1161 // The object pool cannot be used in the vm isolate.
1162 ASSERT(Isolate::Current() != Dart::vm_isolate());
1163 object_pool_ = GrowableObjectArray::New(Heap::kOld);
1164 }
1165 const word address = label->address();
1166 ASSERT(Utils::IsAligned(address, 4));
1167 // The address is stored in the object array as a RawSmi.
1168 const Smi& smi = Smi::Handle(Smi::New(address >> kSmiTagShift));
1169 // Do not reuse an existing entry, since each reference may be patched
1170 // independently.
1171 object_pool_.Add(smi, Heap::kOld);
1172 return object_pool_.Length() - 1;
1173 }
1174
1175
1176 Address Assembler::ElementAddressForIntIndex(bool is_external, 1138 Address Assembler::ElementAddressForIntIndex(bool is_external,
1177 intptr_t cid, 1139 intptr_t cid,
1178 intptr_t index_scale, 1140 intptr_t index_scale,
1179 Register array, 1141 Register array,
1180 intptr_t index) const { 1142 intptr_t index) const {
1181 const int64_t offset = index * index_scale + 1143 const int64_t offset = index * index_scale +
1182 (is_external ? 0 : (Instance::DataOffsetFor(cid) - kHeapObjectTag)); 1144 (is_external ? 0 : (Instance::DataOffsetFor(cid) - kHeapObjectTag));
1183 ASSERT(Utils::IsInt(32, offset)); 1145 ASSERT(Utils::IsInt(32, offset));
1184 ASSERT(Address::CanHoldOffset(offset)); 1146 ASSERT(Address::CanHoldOffset(offset));
1185 return Address(array, static_cast<int32_t>(offset)); 1147 return Address(array, static_cast<int32_t>(offset));
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1262 Emit(reinterpret_cast<int32_t>(message)); 1224 Emit(reinterpret_cast<int32_t>(message));
1263 Bind(&msg); 1225 Bind(&msg);
1264 break_(Instr::kSimulatorMessageCode); 1226 break_(Instr::kSimulatorMessageCode);
1265 } 1227 }
1266 #endif 1228 #endif
1267 } 1229 }
1268 1230
1269 } // namespace dart 1231 } // namespace dart
1270 1232
1271 #endif // defined TARGET_ARCH_MIPS 1233 #endif // defined TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698