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 { return use_far_branches_; } | |
174 | |
172 // Set up a stub frame so that the stack traversal code can easily identify | 175 // Set up a stub frame so that the stack traversal code can easily identify |
173 // a stub frame. | 176 // a stub frame. |
174 void EnterStubFrame(bool uses_pp = false); | 177 void EnterStubFrame(bool uses_pp = false); |
175 void LeaveStubFrame(bool uses_pp = false); | 178 void LeaveStubFrame(bool uses_pp = false); |
176 // A separate macro for when a Ret immediately follows, so that we can use | 179 // A separate macro for when a Ret immediately follows, so that we can use |
177 // the branch delay slot. | 180 // the branch delay slot. |
178 void LeaveStubFrameAndReturn(Register ra = RA, bool uses_pp = false); | 181 void LeaveStubFrameAndReturn(Register ra = RA, bool uses_pp = false); |
179 | 182 |
180 // Instruction pattern from entrypoint is used in dart frame prologs | 183 // 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 | 184 // 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. | 1090 // 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 | 1091 // 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). | 1092 // up on entry (it is the frame of the unoptimized code). |
1090 void EnterOsrFrame(intptr_t extra_size); | 1093 void EnterOsrFrame(intptr_t extra_size); |
1091 | 1094 |
1092 private: | 1095 private: |
1093 AssemblerBuffer buffer_; | 1096 AssemblerBuffer buffer_; |
1094 GrowableObjectArray& object_pool_; // Objects and patchable jump targets. | 1097 GrowableObjectArray& object_pool_; // Objects and patchable jump targets. |
1095 int prologue_offset_; | 1098 int prologue_offset_; |
1096 | 1099 |
1100 bool use_far_branches_; | |
srdjan
2013/07/31 22:52:27
const
zra
2013/08/01 00:28:32
Done.
| |
1097 bool delay_slot_available_; | 1101 bool delay_slot_available_; |
1098 bool in_delay_slot_; | 1102 bool in_delay_slot_; |
1099 | 1103 |
1100 int32_t AddObject(const Object& obj); | 1104 int32_t AddObject(const Object& obj); |
1101 int32_t AddExternalLabel(const ExternalLabel* label); | 1105 int32_t AddExternalLabel(const ExternalLabel* label); |
1102 | 1106 |
1103 class CodeComment : public ZoneAllocated { | 1107 class CodeComment : public ZoneAllocated { |
1104 public: | 1108 public: |
1105 CodeComment(intptr_t pc_offset, const String& comment) | 1109 CodeComment(intptr_t pc_offset, const String& comment) |
1106 : pc_offset_(pc_offset), comment_(comment) { } | 1110 : pc_offset_(pc_offset), comment_(comment) { } |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1187 FRegister fd, | 1191 FRegister fd, |
1188 Cop1Function func) { | 1192 Cop1Function func) { |
1189 Emit(opcode << kOpcodeShift | | 1193 Emit(opcode << kOpcodeShift | |
1190 fmt << kFmtShift | | 1194 fmt << kFmtShift | |
1191 ft << kFtShift | | 1195 ft << kFtShift | |
1192 fs << kFsShift | | 1196 fs << kFsShift | |
1193 fd << kFdShift | | 1197 fd << kFdShift | |
1194 func << kCop1FnShift); | 1198 func << kCop1FnShift); |
1195 } | 1199 } |
1196 | 1200 |
1201 int32_t EncodeBranchOffset(int32_t offset, int32_t instr); | |
1197 | 1202 |
1198 void EmitFarJump(int32_t offset, bool link); | 1203 void EmitFarJump(int32_t offset, bool link); |
1199 void EmitFarBranch(Opcode b, Register rs, Register rt, int32_t offset); | 1204 void EmitFarBranch(Opcode b, Register rs, Register rt, int32_t offset); |
1200 void EmitFarRegImmBranch(RtRegImm b, Register rs, int32_t offset); | 1205 void EmitFarRegImmBranch(RtRegImm b, Register rs, int32_t offset); |
1201 void EmitFarFpuBranch(bool kind, int32_t offset); | 1206 void EmitFarFpuBranch(bool kind, int32_t offset); |
1202 void EmitBranch(Opcode b, Register rs, Register rt, Label* label); | 1207 void EmitBranch(Opcode b, Register rs, Register rt, Label* label); |
1203 void EmitRegImmBranch(RtRegImm b, Register rs, Label* label); | 1208 void EmitRegImmBranch(RtRegImm b, Register rs, Label* label); |
1204 void EmitFpuBranch(bool kind, Label *label); | 1209 void EmitFpuBranch(bool kind, Label *label); |
1205 | 1210 |
1206 void EmitBranchDelayNop() { | 1211 void EmitBranchDelayNop() { |
1207 Emit(Instr::kNopInstruction); // Branch delay NOP. | 1212 Emit(Instr::kNopInstruction); // Branch delay NOP. |
1208 delay_slot_available_ = true; | 1213 delay_slot_available_ = true; |
1209 } | 1214 } |
1210 | 1215 |
1211 void StoreIntoObjectFilter(Register object, Register value, Label* no_update); | 1216 void StoreIntoObjectFilter(Register object, Register value, Label* no_update); |
1212 | 1217 |
1213 // Shorter filtering sequence that assumes that value is not a smi. | 1218 // Shorter filtering sequence that assumes that value is not a smi. |
1214 void StoreIntoObjectFilterNoSmi(Register object, | 1219 void StoreIntoObjectFilterNoSmi(Register object, |
1215 Register value, | 1220 Register value, |
1216 Label* no_update); | 1221 Label* no_update); |
1217 | 1222 |
1218 DISALLOW_ALLOCATION(); | 1223 DISALLOW_ALLOCATION(); |
1219 DISALLOW_COPY_AND_ASSIGN(Assembler); | 1224 DISALLOW_COPY_AND_ASSIGN(Assembler); |
1220 }; | 1225 }; |
1221 | 1226 |
1222 } // namespace dart | 1227 } // namespace dart |
1223 | 1228 |
1224 #endif // VM_ASSEMBLER_MIPS_H_ | 1229 #endif // VM_ASSEMBLER_MIPS_H_ |
OLD | NEW |