| OLD | NEW |
| 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 #ifndef VM_ASSEMBLER_MIPS_H_ | 5 #ifndef VM_ASSEMBLER_MIPS_H_ |
| 6 #define VM_ASSEMBLER_MIPS_H_ | 6 #define VM_ASSEMBLER_MIPS_H_ |
| 7 | 7 |
| 8 #ifndef VM_ASSEMBLER_H_ | 8 #ifndef VM_ASSEMBLER_H_ |
| 9 #error Do not include assembler_mips.h directly; use assembler.h instead. | 9 #error Do not include assembler_mips.h directly; use assembler.h instead. |
| 10 #endif | 10 #endif |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 const ZoneGrowableArray<int>& GetPointerOffsets() const { | 162 const ZoneGrowableArray<int>& GetPointerOffsets() const { |
| 163 return buffer_.pointer_offsets(); | 163 return buffer_.pointer_offsets(); |
| 164 } | 164 } |
| 165 const GrowableObjectArray& object_pool() const { return object_pool_; } | 165 const GrowableObjectArray& object_pool() const { return object_pool_; } |
| 166 void FinalizeInstructions(const MemoryRegion& region) { | 166 void FinalizeInstructions(const MemoryRegion& region) { |
| 167 buffer_.FinalizeInstructions(region); | 167 buffer_.FinalizeInstructions(region); |
| 168 } | 168 } |
| 169 | 169 |
| 170 // Set up a stub frame so that the stack traversal code can easily identify | 170 // Set up a stub frame so that the stack traversal code can easily identify |
| 171 // a stub frame. | 171 // a stub frame. |
| 172 void EnterStubFrame(); | 172 void EnterStubFrame(bool uses_pp = false); |
| 173 void LeaveStubFrame(); | 173 void LeaveStubFrame(bool uses_pp = false); |
| 174 | 174 |
| 175 // Instruction pattern from entrypoint is used in dart frame prologs | 175 // Instruction pattern from entrypoint is used in dart frame prologs |
| 176 // to set up the frame and save a PC which can be used to figure out the | 176 // to set up the frame and save a PC which can be used to figure out the |
| 177 // RawInstruction object corresponding to the code running in the frame. | 177 // RawInstruction object corresponding to the code running in the frame. |
| 178 // See EnterDartFrame. There are 6 instructions before we know the PC. | 178 // See EnterDartFrame. There are 6 instructions before we know the PC. |
| 179 static const intptr_t kOffsetOfSavedPCfromEntrypoint = 6 * Instr::kInstrSize; | 179 static const intptr_t kOffsetOfSavedPCfromEntrypoint = 6 * Instr::kInstrSize; |
| 180 | 180 |
| 181 // Inlined allocation of an instance of class 'cls', code has no runtime | 181 // Inlined allocation of an instance of class 'cls', code has no runtime |
| 182 // calls. Jump to 'failure' if the instance cannot be allocated here. | 182 // calls. Jump to 'failure' if the instance cannot be allocated here. |
| 183 // Allocated instance is returned in 'instance_reg'. | 183 // Allocated instance is returned in 'instance_reg'. |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 if (Utils::IsInt(kImmBits, value)) { | 558 if (Utils::IsInt(kImmBits, value)) { |
| 559 addiu(rd, ZR, Immediate(value)); | 559 addiu(rd, ZR, Immediate(value)); |
| 560 } else { | 560 } else { |
| 561 const uint16_t low = Utils::Low16Bits(value); | 561 const uint16_t low = Utils::Low16Bits(value); |
| 562 const uint16_t high = Utils::High16Bits(value); | 562 const uint16_t high = Utils::High16Bits(value); |
| 563 lui(rd, Immediate(high)); | 563 lui(rd, Immediate(high)); |
| 564 ori(rd, rd, Immediate(low)); | 564 ori(rd, rd, Immediate(low)); |
| 565 } | 565 } |
| 566 } | 566 } |
| 567 | 567 |
| 568 void AddImmediate(Register rd, Register rs, int32_t value) { |
| 569 if (Utils::IsInt(kImmBits, value)) { |
| 570 addiu(rd, rs, Immediate(value)); |
| 571 } else { |
| 572 LoadImmediate(TMP1, value); |
| 573 addu(rd, rs, TMP1); |
| 574 } |
| 575 } |
| 576 |
| 577 void AddImmediate(Register rd, int32_t value) { |
| 578 AddImmediate(rd, rd, value); |
| 579 } |
| 580 |
| 568 void BranchEqual(Register rd, int32_t value, Label* l) { | 581 void BranchEqual(Register rd, int32_t value, Label* l) { |
| 569 LoadImmediate(TMP1, value); | 582 LoadImmediate(TMP1, value); |
| 570 beq(rd, TMP1, l); | 583 beq(rd, TMP1, l); |
| 571 } | 584 } |
| 572 | 585 |
| 573 void BranchEqual(Register rd, const Object& object, Label* l) { | 586 void BranchEqual(Register rd, const Object& object, Label* l) { |
| 574 LoadObject(TMP1, object); | 587 LoadObject(TMP1, object); |
| 575 beq(rd, TMP1, l); | 588 beq(rd, TMP1, l); |
| 576 } | 589 } |
| 577 | 590 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 671 sra(reg, reg, kSmiTagSize); | 684 sra(reg, reg, kSmiTagSize); |
| 672 } | 685 } |
| 673 | 686 |
| 674 void ReserveAlignedFrameSpace(intptr_t frame_space); | 687 void ReserveAlignedFrameSpace(intptr_t frame_space); |
| 675 | 688 |
| 676 void LoadWordFromPoolOffset(Register rd, int32_t offset); | 689 void LoadWordFromPoolOffset(Register rd, int32_t offset); |
| 677 void LoadObject(Register rd, const Object& object); | 690 void LoadObject(Register rd, const Object& object); |
| 678 void PushObject(const Object& object); | 691 void PushObject(const Object& object); |
| 679 | 692 |
| 680 // Sets register rd to zero if the object is equal to register rn, | 693 // Sets register rd to zero if the object is equal to register rn, |
| 681 // set to non-zero otherwise. | 694 // sets it to non-zero otherwise. |
| 682 void CompareObject(Register rd, Register rn, const Object& object); | 695 void CompareObject(Register rd, Register rn, const Object& object); |
| 683 | 696 |
| 684 void LoadClassId(Register result, Register object); | 697 void LoadClassId(Register result, Register object); |
| 685 void LoadClassById(Register result, Register class_id); | 698 void LoadClassById(Register result, Register class_id); |
| 686 void LoadClass(Register result, Register object); | 699 void LoadClass(Register result, Register object); |
| 687 | 700 |
| 688 void CallRuntime(const RuntimeEntry& entry); | 701 void CallRuntime(const RuntimeEntry& entry); |
| 689 | 702 |
| 690 // Set up a Dart frame on entry with a frame pointer and PC information to | 703 // Set up a Dart frame on entry with a frame pointer and PC information to |
| 691 // enable easy access to the RawInstruction object of code corresponding | 704 // enable easy access to the RawInstruction object of code corresponding |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 815 delay_slot_available_ = true; | 828 delay_slot_available_ = true; |
| 816 } | 829 } |
| 817 | 830 |
| 818 DISALLOW_ALLOCATION(); | 831 DISALLOW_ALLOCATION(); |
| 819 DISALLOW_COPY_AND_ASSIGN(Assembler); | 832 DISALLOW_COPY_AND_ASSIGN(Assembler); |
| 820 }; | 833 }; |
| 821 | 834 |
| 822 } // namespace dart | 835 } // namespace dart |
| 823 | 836 |
| 824 #endif // VM_ASSEMBLER_MIPS_H_ | 837 #endif // VM_ASSEMBLER_MIPS_H_ |
| OLD | NEW |