Chromium Code Reviews| Index: runtime/vm/assembler_mips.h |
| =================================================================== |
| --- runtime/vm/assembler_mips.h (revision 20488) |
| +++ runtime/vm/assembler_mips.h (working copy) |
| @@ -58,6 +58,10 @@ |
| return (base_ << kRsShift) | imm_value; |
| } |
| + static bool CanHoldOffset(int32_t offset) { |
| + return Utils::IsInt(16, offset); |
| + } |
| + |
| private: |
| Register base_; |
| int32_t offset_; |
| @@ -143,9 +147,7 @@ |
| comments_() { } |
| ~Assembler() { } |
| - void PopRegister(Register r) { |
| - UNIMPLEMENTED(); |
| - } |
| + void PopRegister(Register r) { Pop(r); } |
| void Bind(Label* label); |
| @@ -190,7 +192,6 @@ |
| } |
| // Debugging and bringup support. |
| - void Stop(const char* message) { UNIMPLEMENTED(); } |
| void Unimplemented(const char* message); |
| void Untested(const char* message); |
| void Unreachable(const char* message); |
| @@ -503,6 +504,50 @@ |
| } |
| // Macros in alphabetical order. |
| + |
| + void Branch(const ExternalLabel* label) { |
| + // Doesn't need to be patchable, so use the delay slot. |
| + if (Utils::IsInt(16, label->address())) { |
| + jr(TMP); |
| + delay_slot()->addiu(TMP, ZR, Immediate(label->address())); |
| + } else { |
| + lui(TMP, Immediate((label->address() >> 16) & 0xffff)); |
|
regis
2013/03/25 23:03:40
It would be a bit more readable to use Utils::Low1
zra
2013/03/25 23:39:17
Okay. So you've got to cast the result of High16Bi
|
| + jr(TMP); |
| + delay_slot()->ori(TMP, TMP, Immediate(label->address() & 0xffff)); |
| + } |
| + } |
| + |
| + void BranchLink(const ExternalLabel* label) { |
| + // Doesn't need to be patchable, so use the delay slot. |
| + if (Utils::IsInt(16, label->address())) { |
| + jalr(TMP); |
| + delay_slot()->addiu(TMP, ZR, Immediate(label->address())); |
| + } else { |
| + lui(TMP, Immediate((label->address() >> 16) & 0xffff)); |
| + jalr(TMP); |
| + delay_slot()->ori(TMP, TMP, Immediate(label->address() & 0xffff)); |
| + } |
| + } |
| + |
| + void BranchLinkPatchable(const ExternalLabel* label) { |
| + const int32_t offset = |
| + Array::data_offset() + 4*AddExternalLabel(label) - kHeapObjectTag; |
| + LoadWordFromPoolOffset(TMP, offset); |
| + jalr(TMP); |
| + } |
| + |
| + void BranchPatchable(const ExternalLabel* label) { |
| + LoadImmediate(TMP, label->address()); |
| + jr(TMP); |
| + } |
| + |
| + void Drop(intptr_t stack_elements) { |
| + ASSERT(stack_elements >= 0); |
| + if (stack_elements > 0) { |
| + addiu(SP, SP, Immediate(stack_elements * kWordSize)); |
| + } |
| + } |
| + |
| void LoadImmediate(Register rd, int32_t value) { |
| if (Utils::IsInt(16, value)) { |
| addiu(rd, ZR, Immediate(value)); |
| @@ -512,6 +557,35 @@ |
| } |
| } |
| + void Push(Register rt) { |
| + addiu(SP, SP, Immediate(-kWordSize)); |
| + sw(rt, Address(SP)); |
| + } |
| + |
| + void Pop(Register rt) { |
| + lw(rt, Address(SP)); |
| + addiu(SP, SP, Immediate(kWordSize)); |
| + } |
| + |
| + void Ret() { |
| + jr(RA); |
| + } |
| + |
| + void Stop(const char* message) { |
|
regis
2013/03/25 23:03:40
I would not implement this in the header.
zra
2013/03/25 23:39:17
Done.
|
| + Label stop; |
|
regis
2013/03/25 23:03:40
You are missing support for FLAG_print_stop_messag
zra
2013/03/25 23:39:17
Done.
|
| + b(&stop); |
| + Emit(reinterpret_cast<int32_t>(message)); |
| + Bind(&stop); |
| + break_(Instr::kStopMessageCode); |
| + } |
| + |
| + void LoadWordFromPoolOffset(Register rd, int32_t offset); |
| + void LoadObject(Register rd, const Object& object); |
| + void PushObject(const Object& object); |
| + |
| + // Subtracts rn from location of object and places result in rd. |
| + void CompareObject(Register rd, Register rn, const Object& object); |
| + |
| private: |
| AssemblerBuffer buffer_; |
| GrowableObjectArray& object_pool_; // Objects and patchable jump targets. |
| @@ -520,6 +594,9 @@ |
| bool delay_slot_available_; |
| bool in_delay_slot_; |
| + int32_t AddObject(const Object& obj); |
| + int32_t AddExternalLabel(const ExternalLabel* label); |
| + |
| class CodeComment : public ZoneAllocated { |
| public: |
| CodeComment(intptr_t pc_offset, const String& comment) |