| 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 public: | 138 public: |
| 139 static void InitOnce() { } | 139 static void InitOnce() { } |
| 140 static bool double_truncate_round_supported() { | 140 static bool double_truncate_round_supported() { |
| 141 return false; | 141 return false; |
| 142 } | 142 } |
| 143 }; | 143 }; |
| 144 | 144 |
| 145 | 145 |
| 146 class Assembler : public ValueObject { | 146 class Assembler : public ValueObject { |
| 147 public: | 147 public: |
| 148 Assembler() | 148 explicit Assembler(bool use_far_branches = false) |
| 149 : buffer_(), | 149 : buffer_(), |
| 150 object_pool_(GrowableObjectArray::Handle()), | 150 object_pool_(GrowableObjectArray::Handle()), |
| 151 prologue_offset_(-1), | 151 prologue_offset_(-1), |
| 152 use_far_branches_(use_far_branches), |
| 152 delay_slot_available_(false), | 153 delay_slot_available_(false), |
| 153 in_delay_slot_(false), | 154 in_delay_slot_(false), |
| 154 comments_() { } | 155 comments_() { } |
| 155 ~Assembler() { } | 156 ~Assembler() { } |
| 156 | 157 |
| 157 void PopRegister(Register r) { Pop(r); } | 158 void PopRegister(Register r) { Pop(r); } |
| 158 | 159 |
| 159 void Bind(Label* label); | 160 void Bind(Label* label); |
| 160 | 161 |
| 161 // Misc. functionality | 162 // Misc. functionality |
| 162 int CodeSize() const { return buffer_.Size(); } | 163 int CodeSize() const { return buffer_.Size(); } |
| 163 int prologue_offset() const { return prologue_offset_; } | 164 int prologue_offset() const { return prologue_offset_; } |
| 164 const ZoneGrowableArray<int>& GetPointerOffsets() const { | 165 const ZoneGrowableArray<int>& GetPointerOffsets() const { |
| 165 return buffer_.pointer_offsets(); | 166 return buffer_.pointer_offsets(); |
| 166 } | 167 } |
| 167 const GrowableObjectArray& object_pool() const { return object_pool_; } | 168 const GrowableObjectArray& object_pool() const { return object_pool_; } |
| 168 void FinalizeInstructions(const MemoryRegion& region) { | 169 void FinalizeInstructions(const MemoryRegion& region) { |
| 169 buffer_.FinalizeInstructions(region); | 170 buffer_.FinalizeInstructions(region); |
| 170 } | 171 } |
| 171 | 172 |
| 173 bool use_far_branches() const { |
| 174 return FLAG_use_far_branches || use_far_branches_; |
| 175 } |
| 176 |
| 172 // Set up a stub frame so that the stack traversal code can easily identify | 177 // Set up a stub frame so that the stack traversal code can easily identify |
| 173 // a stub frame. | 178 // a stub frame. |
| 174 void EnterStubFrame(bool uses_pp = false); | 179 void EnterStubFrame(bool uses_pp = false); |
| 175 void LeaveStubFrame(bool uses_pp = false); | 180 void LeaveStubFrame(bool uses_pp = false); |
| 176 // A separate macro for when a Ret immediately follows, so that we can use | 181 // A separate macro for when a Ret immediately follows, so that we can use |
| 177 // the branch delay slot. | 182 // the branch delay slot. |
| 178 void LeaveStubFrameAndReturn(Register ra = RA, bool uses_pp = false); | 183 void LeaveStubFrameAndReturn(Register ra = RA, bool uses_pp = false); |
| 179 | 184 |
| 180 // Instruction pattern from entrypoint is used in dart frame prologs | 185 // Instruction pattern from entrypoint is used in dart frame prologs |
| 181 // to set up the frame and save a PC which can be used to figure out the | 186 // to set up the frame and save a PC which can be used to figure out the |
| (...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1087 // Set up a Dart frame for a function compiled for on-stack replacement. | 1092 // Set up a Dart frame for a function compiled for on-stack replacement. |
| 1088 // The frame layout is a normal Dart frame, but the frame is partially set | 1093 // The frame layout is a normal Dart frame, but the frame is partially set |
| 1089 // up on entry (it is the frame of the unoptimized code). | 1094 // up on entry (it is the frame of the unoptimized code). |
| 1090 void EnterOsrFrame(intptr_t extra_size); | 1095 void EnterOsrFrame(intptr_t extra_size); |
| 1091 | 1096 |
| 1092 private: | 1097 private: |
| 1093 AssemblerBuffer buffer_; | 1098 AssemblerBuffer buffer_; |
| 1094 GrowableObjectArray& object_pool_; // Objects and patchable jump targets. | 1099 GrowableObjectArray& object_pool_; // Objects and patchable jump targets. |
| 1095 int prologue_offset_; | 1100 int prologue_offset_; |
| 1096 | 1101 |
| 1102 const bool use_far_branches_; |
| 1097 bool delay_slot_available_; | 1103 bool delay_slot_available_; |
| 1098 bool in_delay_slot_; | 1104 bool in_delay_slot_; |
| 1099 | 1105 |
| 1100 int32_t AddObject(const Object& obj); | 1106 int32_t AddObject(const Object& obj); |
| 1101 int32_t AddExternalLabel(const ExternalLabel* label); | 1107 int32_t AddExternalLabel(const ExternalLabel* label); |
| 1102 | 1108 |
| 1103 class CodeComment : public ZoneAllocated { | 1109 class CodeComment : public ZoneAllocated { |
| 1104 public: | 1110 public: |
| 1105 CodeComment(intptr_t pc_offset, const String& comment) | 1111 CodeComment(intptr_t pc_offset, const String& comment) |
| 1106 : pc_offset_(pc_offset), comment_(comment) { } | 1112 : pc_offset_(pc_offset), comment_(comment) { } |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1187 FRegister fd, | 1193 FRegister fd, |
| 1188 Cop1Function func) { | 1194 Cop1Function func) { |
| 1189 Emit(opcode << kOpcodeShift | | 1195 Emit(opcode << kOpcodeShift | |
| 1190 fmt << kFmtShift | | 1196 fmt << kFmtShift | |
| 1191 ft << kFtShift | | 1197 ft << kFtShift | |
| 1192 fs << kFsShift | | 1198 fs << kFsShift | |
| 1193 fd << kFdShift | | 1199 fd << kFdShift | |
| 1194 func << kCop1FnShift); | 1200 func << kCop1FnShift); |
| 1195 } | 1201 } |
| 1196 | 1202 |
| 1203 int32_t EncodeBranchOffset(int32_t offset, int32_t instr); |
| 1197 | 1204 |
| 1198 void EmitFarJump(int32_t offset, bool link); | 1205 void EmitFarJump(int32_t offset, bool link); |
| 1199 void EmitFarBranch(Opcode b, Register rs, Register rt, int32_t offset); | 1206 void EmitFarBranch(Opcode b, Register rs, Register rt, int32_t offset); |
| 1200 void EmitFarRegImmBranch(RtRegImm b, Register rs, int32_t offset); | 1207 void EmitFarRegImmBranch(RtRegImm b, Register rs, int32_t offset); |
| 1201 void EmitFarFpuBranch(bool kind, int32_t offset); | 1208 void EmitFarFpuBranch(bool kind, int32_t offset); |
| 1202 void EmitBranch(Opcode b, Register rs, Register rt, Label* label); | 1209 void EmitBranch(Opcode b, Register rs, Register rt, Label* label); |
| 1203 void EmitRegImmBranch(RtRegImm b, Register rs, Label* label); | 1210 void EmitRegImmBranch(RtRegImm b, Register rs, Label* label); |
| 1204 void EmitFpuBranch(bool kind, Label *label); | 1211 void EmitFpuBranch(bool kind, Label *label); |
| 1205 | 1212 |
| 1206 void EmitBranchDelayNop() { | 1213 void EmitBranchDelayNop() { |
| 1207 Emit(Instr::kNopInstruction); // Branch delay NOP. | 1214 Emit(Instr::kNopInstruction); // Branch delay NOP. |
| 1208 delay_slot_available_ = true; | 1215 delay_slot_available_ = true; |
| 1209 } | 1216 } |
| 1210 | 1217 |
| 1211 void StoreIntoObjectFilter(Register object, Register value, Label* no_update); | 1218 void StoreIntoObjectFilter(Register object, Register value, Label* no_update); |
| 1212 | 1219 |
| 1213 // Shorter filtering sequence that assumes that value is not a smi. | 1220 // Shorter filtering sequence that assumes that value is not a smi. |
| 1214 void StoreIntoObjectFilterNoSmi(Register object, | 1221 void StoreIntoObjectFilterNoSmi(Register object, |
| 1215 Register value, | 1222 Register value, |
| 1216 Label* no_update); | 1223 Label* no_update); |
| 1217 | 1224 |
| 1218 DISALLOW_ALLOCATION(); | 1225 DISALLOW_ALLOCATION(); |
| 1219 DISALLOW_COPY_AND_ASSIGN(Assembler); | 1226 DISALLOW_COPY_AND_ASSIGN(Assembler); |
| 1220 }; | 1227 }; |
| 1221 | 1228 |
| 1222 } // namespace dart | 1229 } // namespace dart |
| 1223 | 1230 |
| 1224 #endif // VM_ASSEMBLER_MIPS_H_ | 1231 #endif // VM_ASSEMBLER_MIPS_H_ |
| OLD | NEW |