Chromium Code Reviews| 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, int32_t value) { | |
| 569 if (Utils::IsInt(kImmBits, value)) { | |
| 570 addiu(rd, rd, Immediate(value)); | |
| 571 } else { | |
| 572 LoadImmediate(TMP1, value); | |
| 573 addu(rd, rd, TMP1); | |
| 574 } | |
|
regis
2013/04/10 20:53:00
You could forward to AddImmediate(rd, rd, value).
zra
2013/04/10 21:59:05
Done.
| |
| 575 } | |
| 576 | |
| 577 void AddImmediate(Register rd, Register rs, int32_t value) { | |
| 578 if (Utils::IsInt(kImmBits, value)) { | |
| 579 addiu(rd, rs, Immediate(value)); | |
| 580 } else { | |
| 581 LoadImmediate(TMP1, value); | |
| 582 addu(rd, rs, TMP1); | |
| 583 } | |
| 584 } | |
| 585 | |
| 568 void BranchEqual(Register rd, int32_t value, Label* l) { | 586 void BranchEqual(Register rd, int32_t value, Label* l) { |
| 569 LoadImmediate(TMP1, value); | 587 LoadImmediate(TMP1, value); |
| 570 beq(rd, TMP1, l); | 588 beq(rd, TMP1, l); |
| 571 } | 589 } |
| 572 | 590 |
| 573 void BranchEqual(Register rd, const Object& object, Label* l) { | 591 void BranchEqual(Register rd, const Object& object, Label* l) { |
| 574 LoadObject(TMP1, object); | 592 LoadObject(TMP1, object); |
| 575 beq(rd, TMP1, l); | 593 beq(rd, TMP1, l); |
| 576 } | 594 } |
| 577 | 595 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 670 void SmiUntag(Register reg) { | 688 void SmiUntag(Register reg) { |
| 671 sra(reg, reg, kSmiTagSize); | 689 sra(reg, reg, kSmiTagSize); |
| 672 } | 690 } |
| 673 | 691 |
| 674 void ReserveAlignedFrameSpace(intptr_t frame_space); | 692 void ReserveAlignedFrameSpace(intptr_t frame_space); |
| 675 | 693 |
| 676 void LoadWordFromPoolOffset(Register rd, int32_t offset); | 694 void LoadWordFromPoolOffset(Register rd, int32_t offset); |
| 677 void LoadObject(Register rd, const Object& object); | 695 void LoadObject(Register rd, const Object& object); |
| 678 void PushObject(const Object& object); | 696 void PushObject(const Object& object); |
| 679 | 697 |
| 698 // Branch if a comparison with a result already in rd satisfies the | |
| 699 // Condition c. | |
| 700 void BranchOnCondition(Register rd, Label* l, Condition c); | |
|
regis
2013/04/10 20:53:00
It would be more natural to have the condition as
| |
| 701 | |
| 680 // Sets register rd to zero if the object is equal to register rn, | 702 // Sets register rd to zero if the object is equal to register rn, |
| 681 // set to non-zero otherwise. | 703 // sets it to non-zero otherwise. |
| 682 void CompareObject(Register rd, Register rn, const Object& object); | 704 void CompareObject(Register rd, Register rn, const Object& object); |
| 683 | 705 |
| 684 void LoadClassId(Register result, Register object); | 706 void LoadClassId(Register result, Register object); |
| 685 void LoadClassById(Register result, Register class_id); | 707 void LoadClassById(Register result, Register class_id); |
| 686 void LoadClass(Register result, Register object); | 708 void LoadClass(Register result, Register object); |
| 687 | 709 |
| 688 void CallRuntime(const RuntimeEntry& entry); | 710 void CallRuntime(const RuntimeEntry& entry); |
| 689 | 711 |
| 690 // Set up a Dart frame on entry with a frame pointer and PC information to | 712 // 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 | 713 // 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; | 837 delay_slot_available_ = true; |
| 816 } | 838 } |
| 817 | 839 |
| 818 DISALLOW_ALLOCATION(); | 840 DISALLOW_ALLOCATION(); |
| 819 DISALLOW_COPY_AND_ASSIGN(Assembler); | 841 DISALLOW_COPY_AND_ASSIGN(Assembler); |
| 820 }; | 842 }; |
| 821 | 843 |
| 822 } // namespace dart | 844 } // namespace dart |
| 823 | 845 |
| 824 #endif // VM_ASSEMBLER_MIPS_H_ | 846 #endif // VM_ASSEMBLER_MIPS_H_ |
| OLD | NEW |