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

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

Issue 1419223003: Re-assign registers on ARM so PP and CODE_REG are below R7 (FP on iOS). (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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
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_ARM. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM.
6 #if defined(TARGET_ARCH_ARM) 6 #if defined(TARGET_ARCH_ARM)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/constants_arm.h" 9 #include "vm/constants_arm.h"
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 Register reg; 59 Register reg;
60 uword native_function_load_end = 60 uword native_function_load_end =
61 InstructionPattern::DecodeLoadWordFromPool(end_ - 2 * Instr::kInstrSize, 61 InstructionPattern::DecodeLoadWordFromPool(end_ - 2 * Instr::kInstrSize,
62 &reg, 62 &reg,
63 &target_code_pool_index_); 63 &target_code_pool_index_);
64 ASSERT(reg == CODE_REG); 64 ASSERT(reg == CODE_REG);
65 InstructionPattern::DecodeLoadWordFromPool(native_function_load_end, 65 InstructionPattern::DecodeLoadWordFromPool(native_function_load_end,
66 &reg, 66 &reg,
67 &native_function_pool_index_); 67 &native_function_pool_index_);
68 ASSERT(reg == R5); 68 ASSERT(reg == R9);
69 } 69 }
70 70
71 71
72 RawCode* NativeCallPattern::target() const { 72 RawCode* NativeCallPattern::target() const {
73 return reinterpret_cast<RawCode*>( 73 return reinterpret_cast<RawCode*>(
74 object_pool_.ObjectAt(target_code_pool_index_)); 74 object_pool_.ObjectAt(target_code_pool_index_));
75 } 75 }
76 76
77 77
78 void NativeCallPattern::set_target(const Code& new_target) const { 78 void NativeCallPattern::set_target(const Code& new_target) const {
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 // sequence is the instruction before the one at end). Returns a pointer to 173 // sequence is the instruction before the one at end). Returns a pointer to
174 // the first instruction in the sequence. Returns the register being loaded 174 // the first instruction in the sequence. Returns the register being loaded
175 // and the index in the pool being read from in the output parameters 'reg' 175 // and the index in the pool being read from in the output parameters 'reg'
176 // and 'index' respectively. 176 // and 'index' respectively.
177 uword InstructionPattern::DecodeLoadWordFromPool(uword end, 177 uword InstructionPattern::DecodeLoadWordFromPool(uword end,
178 Register* reg, 178 Register* reg,
179 intptr_t* index) { 179 intptr_t* index) {
180 uword start = end - Instr::kInstrSize; 180 uword start = end - Instr::kInstrSize;
181 int32_t instr = Instr::At(start)->InstructionBits(); 181 int32_t instr = Instr::At(start)->InstructionBits();
182 intptr_t offset = 0; 182 intptr_t offset = 0;
183 if ((instr & 0xffff0000) == 0xe5990000) { // ldr reg, [pp, #+offset] 183 if ((instr & 0xffff0000) == 0xe5950000) { // ldr reg, [pp, #+offset]
Florian Schneider 2015/10/26 17:12:31 I remember these as easy to forget to change, but
rmacnak 2015/10/26 18:01:50 Sounds fine.
184 offset = instr & 0xfff; 184 offset = instr & 0xfff;
185 *reg = static_cast<Register>((instr & 0xf000) >> 12); 185 *reg = static_cast<Register>((instr & 0xf000) >> 12);
186 } else { 186 } else {
187 ASSERT((instr & 0xfff00000) == 0xe5900000); // ldr reg, [reg, #+offset] 187 ASSERT((instr & 0xfff00000) == 0xe5900000); // ldr reg, [reg, #+offset]
188 offset = instr & 0xfff; 188 offset = instr & 0xfff;
189 start -= Instr::kInstrSize; 189 start -= Instr::kInstrSize;
190 instr = Instr::At(start)->InstructionBits(); 190 instr = Instr::At(start)->InstructionBits();
191 if ((instr & 0xffff0000) == 0xe2890000) { // add reg, pp, operand 191 if ((instr & 0xffff0000) == 0xe2850000) { // add reg, pp, operand
192 const intptr_t rot = (instr & 0xf00) >> 7; 192 const intptr_t rot = (instr & 0xf00) >> 7;
193 const intptr_t imm8 = instr & 0xff; 193 const intptr_t imm8 = instr & 0xff;
194 offset += (imm8 >> rot) | (imm8 << (32 - rot)); 194 offset += (imm8 >> rot) | (imm8 << (32 - rot));
195 *reg = static_cast<Register>((instr & 0xf000) >> 12); 195 *reg = static_cast<Register>((instr & 0xf000) >> 12);
196 } else { 196 } else {
197 ASSERT((instr & 0xffff0000) == 0xe0890000); // add reg, pp, reg 197 ASSERT((instr & 0xffff0000) == 0xe0850000); // add reg, pp, reg
198 end = DecodeLoadWordImmediate(end, reg, &offset); 198 end = DecodeLoadWordImmediate(end, reg, &offset);
199 } 199 }
200 } 200 }
201 *index = ObjectPool::IndexFromOffset(offset); 201 *index = ObjectPool::IndexFromOffset(offset);
202 return start; 202 return start;
203 } 203 }
204 204
205 205
206 RawICData* CallPattern::IcData() { 206 RawICData* CallPattern::IcData() {
207 if (ic_data_.IsNull()) { 207 if (ic_data_.IsNull()) {
208 Register reg; 208 Register reg;
209 InstructionPattern::DecodeLoadObject(ic_data_load_end_, 209 InstructionPattern::DecodeLoadObject(ic_data_load_end_,
210 object_pool_, 210 object_pool_,
211 &reg, 211 &reg,
212 &ic_data_); 212 &ic_data_);
213 ASSERT(reg == R5); 213 ASSERT(reg == R9);
214 } 214 }
215 return ic_data_.raw(); 215 return ic_data_.raw();
216 } 216 }
217 217
218 218
219 RawCode* CallPattern::TargetCode() const { 219 RawCode* CallPattern::TargetCode() const {
220 return reinterpret_cast<RawCode*>( 220 return reinterpret_cast<RawCode*>(
221 object_pool_.ObjectAt(target_code_pool_index_)); 221 object_pool_.ObjectAt(target_code_pool_index_));
222 } 222 }
223 223
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 } else { 289 } else {
290 ASSERT(version == ARMv7); 290 ASSERT(version == ARMv7);
291 return bx_lr->InstructionBits() == instruction; 291 return bx_lr->InstructionBits() == instruction;
292 } 292 }
293 return false; 293 return false;
294 } 294 }
295 295
296 } // namespace dart 296 } // namespace dart
297 297
298 #endif // defined TARGET_ARCH_ARM 298 #endif // defined TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698