Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(118)

Side by Side Diff: runtime/vm/instructions_mips.cc

Issue 2380403003: Lazy deopt without code patching. (Closed)
Patch Set: remove tracing register assignment Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/instructions_mips.h ('k') | runtime/vm/instructions_x64.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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" // Needed here to get TARGET_ARCH_MIPS. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS.
6 #if defined(TARGET_ARCH_MIPS) 6 #if defined(TARGET_ARCH_MIPS)
7 7
8 #include "vm/constants_mips.h" 8 #include "vm/constants_mips.h"
9 #include "vm/cpu.h" 9 #include "vm/cpu.h"
10 #include "vm/instructions.h" 10 #include "vm/instructions.h"
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 object_pool_.RawValueAt(native_function_pool_index_)); 210 object_pool_.RawValueAt(native_function_pool_index_));
211 } 211 }
212 212
213 213
214 void NativeCallPattern::set_native_function(NativeFunction func) const { 214 void NativeCallPattern::set_native_function(NativeFunction func) const {
215 object_pool_.SetRawValueAt(native_function_pool_index_, 215 object_pool_.SetRawValueAt(native_function_pool_index_,
216 reinterpret_cast<uword>(func)); 216 reinterpret_cast<uword>(func));
217 } 217 }
218 218
219 219
220 void CallPattern::InsertDeoptCallAt(uword pc, uword target_address) {
221 Instr* lui = Instr::At(pc + (0 * Instr::kInstrSize));
222 Instr* ori = Instr::At(pc + (1 * Instr::kInstrSize));
223 Instr* jr = Instr::At(pc + (2 * Instr::kInstrSize));
224 Instr* nop = Instr::At(pc + (3 * Instr::kInstrSize));
225 uint16_t target_lo = target_address & 0xffff;
226 uint16_t target_hi = target_address >> 16;
227
228 lui->SetImmInstrBits(LUI, ZR, T9, target_hi);
229 ori->SetImmInstrBits(ORI, T9, T9, target_lo);
230 jr->SetSpecialInstrBits(JALR, T9, ZR, RA);
231 nop->SetInstructionBits(Instr::kNopInstruction);
232
233 ASSERT(kDeoptCallLengthInBytes == 4 * Instr::kInstrSize);
234 CPU::FlushICache(pc, kDeoptCallLengthInBytes);
235 }
236
237
238 SwitchableCallPattern::SwitchableCallPattern(uword pc, const Code& code) 220 SwitchableCallPattern::SwitchableCallPattern(uword pc, const Code& code)
239 : object_pool_(ObjectPool::Handle(code.GetObjectPool())), 221 : object_pool_(ObjectPool::Handle(code.GetObjectPool())),
240 data_pool_index_(-1), 222 data_pool_index_(-1),
241 target_pool_index_(-1) { 223 target_pool_index_(-1) {
242 ASSERT(code.ContainsInstructionAt(pc)); 224 ASSERT(code.ContainsInstructionAt(pc));
243 // Last instruction: jalr t9. 225 // Last instruction: jalr t9.
244 ASSERT(*(reinterpret_cast<uword*>(pc) - 1) == 0); // Delay slot. 226 ASSERT(*(reinterpret_cast<uword*>(pc) - 1) == 0); // Delay slot.
245 ASSERT(*(reinterpret_cast<uword*>(pc) - 2) == 0x0320f809); 227 ASSERT(*(reinterpret_cast<uword*>(pc) - 2) == 0x0320f809);
246 228
247 Register reg; 229 Register reg;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 bool ReturnPattern::IsValid() const { 270 bool ReturnPattern::IsValid() const {
289 Instr* jr = Instr::At(pc_); 271 Instr* jr = Instr::At(pc_);
290 return (jr->OpcodeField() == SPECIAL) && 272 return (jr->OpcodeField() == SPECIAL) &&
291 (jr->FunctionField() == JR) && 273 (jr->FunctionField() == JR) &&
292 (jr->RsField() == RA); 274 (jr->RsField() == RA);
293 } 275 }
294 276
295 } // namespace dart 277 } // namespace dart
296 278
297 #endif // defined TARGET_ARCH_MIPS 279 #endif // defined TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « runtime/vm/instructions_mips.h ('k') | runtime/vm/instructions_x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698