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

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

Issue 13473010: Adds native/leaf runtime call stub and redirection on MIPS. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 8 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 | 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" // 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/instructions.h" 9 #include "vm/instructions.h"
10 #include "vm/object.h" 10 #include "vm/object.h"
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 const Smi& smi = Smi::Handle(reinterpret_cast<RawSmi*>(target_address)); 155 const Smi& smi = Smi::Handle(reinterpret_cast<RawSmi*>(target_address));
156 object_pool_.SetAt(target_address_pool_index_, smi); 156 object_pool_.SetAt(target_address_pool_index_, smi);
157 // No need to flush the instruction cache, since the code is not modified. 157 // No need to flush the instruction cache, since the code is not modified.
158 } 158 }
159 159
160 160
161 JumpPattern::JumpPattern(uword pc) : pc_(pc) { } 161 JumpPattern::JumpPattern(uword pc) : pc_(pc) { }
162 162
163 163
164 bool JumpPattern::IsValid() const { 164 bool JumpPattern::IsValid() const {
165 UNIMPLEMENTED(); 165 Instr* lui = Instr::At(pc_ + (0 * Instr::kInstrSize));
166 return false; 166 Instr* ori = Instr::At(pc_ + (1 * Instr::kInstrSize));
167 Instr* jr = Instr::At(pc_ + (2 * Instr::kInstrSize));
168 Instr* nop = Instr::At(pc_ + (3 * Instr::kInstrSize));
169 return (lui->OpcodeField() == LUI) &&
170 (ori->OpcodeField() == ORI) &&
171 (jr->OpcodeField() == SPECIAL) &&
172 (jr->FunctionField() == JR) &&
173 (nop->InstructionBits() == Instr::kNopInstruction);
167 } 174 }
168 175
169 176
170 uword JumpPattern::TargetAddress() const { 177 uword JumpPattern::TargetAddress() const {
171 UNIMPLEMENTED(); 178 Instr* lui = Instr::At(pc_ + (0 * Instr::kInstrSize));
172 return 0; 179 Instr* ori = Instr::At(pc_ + (1 * Instr::kInstrSize));
180 const uint16_t target_lo = ori->UImmField();
181 const uint16_t target_hi = lui->UImmField();
182 return (target_hi << 16) | target_lo;
173 } 183 }
174 184
175 185
176 void JumpPattern::SetTargetAddress(uword target_address) const { 186 void JumpPattern::SetTargetAddress(uword target_address) const {
177 UNIMPLEMENTED(); 187 Instr* lui = Instr::At(pc_ + (0 * Instr::kInstrSize));
188 Instr* ori = Instr::At(pc_ + (1 * Instr::kInstrSize));
189 const int32_t lui_bits = lui->InstructionBits();
190 const int32_t ori_bits = ori->InstructionBits();
191 const uint16_t target_lo = target_address & 0xffff;
192 const uint16_t target_hi = target_address >> 16;
193
194 lui->SetInstructionBits((lui_bits & 0xffff0000) | target_hi);
195 ori->SetInstructionBits((ori_bits & 0xffff0000) | target_lo);
178 } 196 }
179 197
180 } // namespace dart 198 } // namespace dart
181 199
182 #endif // defined TARGET_ARCH_MIPS 200 #endif // defined TARGET_ARCH_MIPS
183 201
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698