Chromium Code Reviews| Index: runtime/vm/assembler_mips.cc |
| =================================================================== |
| --- runtime/vm/assembler_mips.cc (revision 20488) |
| +++ runtime/vm/assembler_mips.cc (working copy) |
| @@ -56,6 +56,53 @@ |
| return (((instr & kBranchOffsetMask) << 16) >> 14); |
| } |
| + |
| +void Assembler::LoadWordFromPoolOffset(Register rd, int32_t offset) { |
| + ASSERT(rd != PP); |
| + if (Address::CanHoldOffset(offset)) { |
| + lw(rd, Address(PP, offset)); |
| + } else { |
| + LoadImmediate(rd, offset); |
| + addu(rd, rd, PP); |
| + lw(rd, Address(rd)); |
| + } |
| +} |
| + |
| + |
| +int32_t Assembler::AddObject(const Object& obj) { |
| + ASSERT(obj.IsNotTemporaryScopedHandle()); |
| + ASSERT(obj.IsOld()); |
| + if (object_pool_.IsNull()) { |
| + // The object pool cannot be used in the vm isolate. |
| + ASSERT(Isolate::Current() != Dart::vm_isolate()); |
| + object_pool_ = GrowableObjectArray::New(); |
|
regis
2013/03/25 23:03:40
You should sync. You will notice that we allocate
zra
2013/03/25 23:39:17
Done.
|
| + } |
| + for (int i = 0; i < object_pool_.Length(); i++) { |
| + if (object_pool_.At(i) == obj.raw()) { |
| + return i; |
| + } |
| + } |
| + object_pool_.Add(obj); |
|
regis
2013/03/25 23:03:40
ditto
zra
2013/03/25 23:39:17
Done.
|
| + return object_pool_.Length() - 1; |
| +} |
| + |
| + |
| +int32_t Assembler::AddExternalLabel(const ExternalLabel* label) { |
| + if (object_pool_.IsNull()) { |
| + // The object pool cannot be used in the vm isolate. |
| + ASSERT(Isolate::Current() != Dart::vm_isolate()); |
| + object_pool_ = GrowableObjectArray::New(); |
|
regis
2013/03/25 23:03:40
ditto
zra
2013/03/25 23:39:17
Done.
|
| + } |
| + const word address = label->address(); |
| + ASSERT(Utils::IsAligned(address, 4)); |
| + // The address is stored in the object array as a RawSmi. |
| + const Smi& smi = Smi::Handle(Smi::New(address >> kSmiTagShift)); |
| + // Do not reuse an existing entry, since each reference may be patched |
| + // independently. |
| + object_pool_.Add(smi); |
|
regis
2013/03/25 23:03:40
ditto
zra
2013/03/25 23:39:17
Done.
|
| + return object_pool_.Length() - 1; |
| +} |
| + |
| } // namespace dart |
| #endif // defined TARGET_ARCH_MIPS |