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

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

Issue 59613005: Merge (x & y) == 0 pattern to emit a single test instruction. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
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" 5 #include "vm/globals.h"
6 #if defined(TARGET_ARCH_MIPS) 6 #if defined(TARGET_ARCH_MIPS)
7 7
8 #include "vm/cpu.h" 8 #include "vm/cpu.h"
9 #include "vm/debugger.h" 9 #include "vm/debugger.h"
10 #include "vm/instructions.h" 10 #include "vm/instructions.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 // Smash code with call instruction and target address. 50 // Smash code with call instruction and target address.
51 uword stub_addr = StubCode::BreakpointReturnEntryPoint(); 51 uword stub_addr = StubCode::BreakpointReturnEntryPoint();
52 uint16_t target_lo = stub_addr & 0xffff; 52 uint16_t target_lo = stub_addr & 0xffff;
53 uint16_t target_hi = stub_addr >> 16; 53 uint16_t target_hi = stub_addr >> 16;
54 54
55 // Unlike other architectures, the sequence we are patching in is shorter 55 // Unlike other architectures, the sequence we are patching in is shorter
56 // than the sequence we are replacing. We pad at the top with nops so that 56 // than the sequence we are replacing. We pad at the top with nops so that
57 // the end of the new sequence is lined up with the code descriptor. 57 // the end of the new sequence is lined up with the code descriptor.
58 instr1->SetInstructionBits(Instr::kNopInstruction); 58 instr1->SetInstructionBits(Instr::kNopInstruction);
59 instr2->SetImmInstrBits(LUI, ZR, TMP1, target_hi); 59 instr2->SetImmInstrBits(LUI, ZR, TMP, target_hi);
60 instr3->SetImmInstrBits(ORI, TMP1, TMP1, target_lo); 60 instr3->SetImmInstrBits(ORI, TMP, TMP, target_lo);
61 instr4->SetSpecialInstrBits(JALR, TMP1, ZR, RA); 61 instr4->SetSpecialInstrBits(JALR, TMP, ZR, RA);
62 instr5->SetInstructionBits(Instr::kNopInstruction); 62 instr5->SetInstructionBits(Instr::kNopInstruction);
63 63
64 CPU::FlushICache(pc_ - 5 * Instr::kInstrSize, 5 * Instr::kInstrSize); 64 CPU::FlushICache(pc_ - 5 * Instr::kInstrSize, 5 * Instr::kInstrSize);
65 } 65 }
66 66
67 67
68 void CodeBreakpoint::RestoreFunctionReturn() { 68 void CodeBreakpoint::RestoreFunctionReturn() {
69 Instr* instr1 = Instr::At(pc_ - 5 * Instr::kInstrSize); 69 Instr* instr1 = Instr::At(pc_ - 5 * Instr::kInstrSize);
70 Instr* instr2 = Instr::At(pc_ - 4 * Instr::kInstrSize); 70 Instr* instr2 = Instr::At(pc_ - 4 * Instr::kInstrSize);
71 Instr* instr3 = Instr::At(pc_ - 3 * Instr::kInstrSize); 71 Instr* instr3 = Instr::At(pc_ - 3 * Instr::kInstrSize);
72 Instr* instr4 = Instr::At(pc_ - 2 * Instr::kInstrSize); 72 Instr* instr4 = Instr::At(pc_ - 2 * Instr::kInstrSize);
73 Instr* instr5 = Instr::At(pc_ - 1 * Instr::kInstrSize); 73 Instr* instr5 = Instr::At(pc_ - 1 * Instr::kInstrSize);
74 74
75 ASSERT(instr2->OpcodeField() == LUI && instr2->RtField() == TMP1); 75 ASSERT(instr2->OpcodeField() == LUI && instr2->RtField() == TMP);
76 76
77 instr1->SetImmInstrBits(LW, SP, RA, 2 * kWordSize); 77 instr1->SetImmInstrBits(LW, SP, RA, 2 * kWordSize);
78 instr2->SetImmInstrBits(LW, SP, FP, 1 * kWordSize); 78 instr2->SetImmInstrBits(LW, SP, FP, 1 * kWordSize);
79 instr3->SetImmInstrBits(LW, SP, PP, 0 * kWordSize); 79 instr3->SetImmInstrBits(LW, SP, PP, 0 * kWordSize);
80 instr4->SetSpecialInstrBits(JR, RA, ZR, ZR); 80 instr4->SetSpecialInstrBits(JR, RA, ZR, ZR);
81 instr5->SetImmInstrBits(ADDIU, SP, SP, 4 * kWordSize); 81 instr5->SetImmInstrBits(ADDIU, SP, SP, 4 * kWordSize);
82 82
83 CPU::FlushICache(pc_ - 5 * Instr::kInstrSize, 5 * Instr::kInstrSize); 83 CPU::FlushICache(pc_ - 5 * Instr::kInstrSize, 5 * Instr::kInstrSize);
84 } 84 }
85 85
86 } // namespace dart 86 } // namespace dart
87 87
88 #endif // defined TARGET_ARCH_MIPS 88 #endif // defined TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698