| Index: runtime/vm/assembler_mips.h
|
| ===================================================================
|
| --- runtime/vm/assembler_mips.h (revision 19668)
|
| +++ runtime/vm/assembler_mips.h (working copy)
|
| @@ -133,6 +133,8 @@
|
| : buffer_(),
|
| object_pool_(GrowableObjectArray::Handle()),
|
| prologue_offset_(-1),
|
| + delay_slot_available_(false),
|
| + in_delay_slot_(false),
|
| comments_() { }
|
| ~Assembler() { }
|
|
|
| @@ -206,6 +208,17 @@
|
| return NULL;
|
| }
|
|
|
| + // A utility to be able to assemble an instruction into the delay slot.
|
| + Assembler* delay_slot() {
|
| + ASSERT(delay_slot_available_);
|
| + ASSERT(buffer_.Load<int32_t>(buffer_.GetPosition() - sizeof(int32_t)) ==
|
| + Instr::kNopInstruction);
|
| + buffer_.Remit<int32_t>();
|
| + delay_slot_available_ = false;
|
| + in_delay_slot_ = true;
|
| + return this;
|
| + }
|
| +
|
| // CPU instructions.
|
| void ori(Register rt, Register rs, const Immediate& imm) {
|
| ASSERT(Utils::IsUint(16, imm.value()));
|
| @@ -214,8 +227,10 @@
|
| }
|
|
|
| void jr(Register rs) {
|
| + ASSERT(!in_delay_slot_); // Jump within a delay slot is not supported.
|
| EmitRType(SPECIAL, rs, R0, R0, 0, JR);
|
| - Emit(0); // Branch delay NOP.
|
| + Emit(Instr::kNopInstruction); // Branch delay NOP.
|
| + delay_slot_available_ = true;
|
| }
|
|
|
| private:
|
| @@ -223,6 +238,9 @@
|
| GrowableObjectArray& object_pool_; // Objects and patchable jump targets.
|
| int prologue_offset_;
|
|
|
| + bool delay_slot_available_;
|
| + bool in_delay_slot_;
|
| +
|
| class CodeComment : public ZoneAllocated {
|
| public:
|
| CodeComment(intptr_t pc_offset, const String& comment)
|
| @@ -241,6 +259,9 @@
|
| GrowableArray<CodeComment*> comments_;
|
|
|
| void Emit(int32_t value) {
|
| + // Emitting an instruction clears the delay slot state.
|
| + in_delay_slot_ = false;
|
| + delay_slot_available_ = false;
|
| AssemblerBuffer::EnsureCapacity ensured(&buffer_);
|
| buffer_.Emit<int32_t>(value);
|
| }
|
|
|