| 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 #include "vm/globals.h" | 5 #include "vm/globals.h" |
| 6 #if defined(TARGET_ARCH_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
| 7 | 7 |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/runtime_entry.h" |
| 10 #include "vm/simulator.h" |
| 11 #include "vm/stub_code.h" |
| 9 | 12 |
| 10 namespace dart { | 13 namespace dart { |
| 11 | 14 |
| 12 DEFINE_FLAG(bool, print_stop_message, false, "Print stop message."); | 15 DEFINE_FLAG(bool, print_stop_message, false, "Print stop message."); |
| 13 | 16 |
| 14 | 17 |
| 15 void Assembler::InitializeMemoryWithBreakpoints(uword data, int length) { | 18 void Assembler::InitializeMemoryWithBreakpoints(uword data, int length) { |
| 16 ASSERT(Utils::IsAligned(data, 4)); | 19 ASSERT(Utils::IsAligned(data, 4)); |
| 17 ASSERT(Utils::IsAligned(length, 4)); | 20 ASSERT(Utils::IsAligned(length, 4)); |
| 18 const uword end = data + length; | 21 const uword end = data + length; |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 | 141 |
| 139 | 142 |
| 140 void Assembler::LeaveStubFrame() { | 143 void Assembler::LeaveStubFrame() { |
| 141 mov(SP, FP); | 144 mov(SP, FP); |
| 142 lw(RA, Address(SP, 1 * kWordSize)); | 145 lw(RA, Address(SP, 1 * kWordSize)); |
| 143 lw(FP, Address(SP, 0 * kWordSize)); | 146 lw(FP, Address(SP, 0 * kWordSize)); |
| 144 addiu(SP, SP, Immediate(3 * kWordSize)); | 147 addiu(SP, SP, Immediate(3 * kWordSize)); |
| 145 } | 148 } |
| 146 | 149 |
| 147 | 150 |
| 151 void Assembler::CallRuntime(const RuntimeEntry& entry) { |
| 152 entry.Call(this); |
| 153 } |
| 154 |
| 155 |
| 148 void Assembler::EnterDartFrame(intptr_t frame_size) { | 156 void Assembler::EnterDartFrame(intptr_t frame_size) { |
| 149 const intptr_t offset = CodeSize(); | 157 const intptr_t offset = CodeSize(); |
| 150 | 158 |
| 151 addiu(SP, SP, Immediate(-4 * kWordSize)); | 159 addiu(SP, SP, Immediate(-4 * kWordSize)); |
| 152 sw(RA, Address(SP, 2 * kWordSize)); | 160 sw(RA, Address(SP, 2 * kWordSize)); |
| 153 sw(FP, Address(SP, 1 * kWordSize)); | 161 sw(FP, Address(SP, 1 * kWordSize)); |
| 154 sw(PP, Address(SP, 0 * kWordSize)); | 162 sw(PP, Address(SP, 0 * kWordSize)); |
| 155 | 163 |
| 156 Label next; | 164 Label next; |
| 157 // Branch and link to the instruction after the delay slot to get the PC. | 165 // Branch and link to the instruction after the delay slot to get the PC. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 | 202 |
| 195 lw(RA, Address(SP, 2 * kWordSize)); | 203 lw(RA, Address(SP, 2 * kWordSize)); |
| 196 lw(FP, Address(SP, 1 * kWordSize)); | 204 lw(FP, Address(SP, 1 * kWordSize)); |
| 197 lw(PP, Address(SP, 0 * kWordSize)); | 205 lw(PP, Address(SP, 0 * kWordSize)); |
| 198 | 206 |
| 199 // Adjust SP for PC pushed in EnterDartFrame. | 207 // Adjust SP for PC pushed in EnterDartFrame. |
| 200 addiu(SP, SP, Immediate(4 * kWordSize)); | 208 addiu(SP, SP, Immediate(4 * kWordSize)); |
| 201 } | 209 } |
| 202 | 210 |
| 203 | 211 |
| 212 void Assembler::ReserveAlignedFrameSpace(intptr_t frame_space) { |
| 213 // Reserve space for arguments and align frame before entering |
| 214 // the C++ world. |
| 215 addiu(SP, SP, Immediate(-frame_space)); |
| 216 if (OS::ActivationFrameAlignment() > 0) { |
| 217 LoadImmediate(TMP, ~(OS::ActivationFrameAlignment() - 1)); |
| 218 and_(SP, SP, TMP); |
| 219 } |
| 220 } |
| 221 |
| 222 |
| 204 int32_t Assembler::AddExternalLabel(const ExternalLabel* label) { | 223 int32_t Assembler::AddExternalLabel(const ExternalLabel* label) { |
| 205 if (object_pool_.IsNull()) { | 224 if (object_pool_.IsNull()) { |
| 206 // The object pool cannot be used in the vm isolate. | 225 // The object pool cannot be used in the vm isolate. |
| 207 ASSERT(Isolate::Current() != Dart::vm_isolate()); | 226 ASSERT(Isolate::Current() != Dart::vm_isolate()); |
| 208 object_pool_ = GrowableObjectArray::New(Heap::kOld); | 227 object_pool_ = GrowableObjectArray::New(Heap::kOld); |
| 209 } | 228 } |
| 210 const word address = label->address(); | 229 const word address = label->address(); |
| 211 ASSERT(Utils::IsAligned(address, 4)); | 230 ASSERT(Utils::IsAligned(address, 4)); |
| 212 // The address is stored in the object array as a RawSmi. | 231 // The address is stored in the object array as a RawSmi. |
| 213 const Smi& smi = Smi::Handle(Smi::New(address >> kSmiTagShift)); | 232 const Smi& smi = Smi::Handle(Smi::New(address >> kSmiTagShift)); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 226 b(&stop); | 245 b(&stop); |
| 227 Emit(reinterpret_cast<int32_t>(message)); | 246 Emit(reinterpret_cast<int32_t>(message)); |
| 228 Bind(&stop); | 247 Bind(&stop); |
| 229 break_(Instr::kStopMessageCode); | 248 break_(Instr::kStopMessageCode); |
| 230 } | 249 } |
| 231 | 250 |
| 232 } // namespace dart | 251 } // namespace dart |
| 233 | 252 |
| 234 #endif // defined TARGET_ARCH_MIPS | 253 #endif // defined TARGET_ARCH_MIPS |
| 235 | 254 |
| OLD | NEW |