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

Side by Side Diff: src/ppc/simulator-ppc.cc

Issue 1381383002: PPC: Remove register index/code indirection (Closed) Base URL: https://chromium.googlesource.com/v8/v8.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
« no previous file with comments | « src/ppc/macro-assembler-ppc.cc ('k') | src/register-configuration.cc » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stdarg.h> 5 #include <stdarg.h>
6 #include <stdlib.h> 6 #include <stdlib.h>
7 #include <cmath> 7 #include <cmath>
8 8
9 #if V8_TARGET_ARCH_PPC 9 #if V8_TARGET_ARCH_PPC
10 10
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 } else { 157 } else {
158 return SScanF(desc, "%" V8PRIuPTR, reinterpret_cast<uintptr_t*>(value)) == 158 return SScanF(desc, "%" V8PRIuPTR, reinterpret_cast<uintptr_t*>(value)) ==
159 1; 159 1;
160 } 160 }
161 } 161 }
162 return false; 162 return false;
163 } 163 }
164 164
165 165
166 bool PPCDebugger::GetFPDoubleValue(const char* desc, double* value) { 166 bool PPCDebugger::GetFPDoubleValue(const char* desc, double* value) {
167 int regnum = FPRegisters::Number(desc); 167 int regnum = DoubleRegisters::Number(desc);
168 if (regnum != kNoRegister) { 168 if (regnum != kNoRegister) {
169 *value = sim_->get_double_from_d_register(regnum); 169 *value = sim_->get_double_from_d_register(regnum);
170 return true; 170 return true;
171 } 171 }
172 return false; 172 return false;
173 } 173 }
174 174
175 175
176 bool PPCDebugger::SetBreakpoint(Instruction* break_pc) { 176 bool PPCDebugger::SetBreakpoint(Instruction* break_pc) {
177 // Check if a breakpoint can be set. If not return without any side-effects. 177 // Check if a breakpoint can be set. If not return without any side-effects.
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 } 306 }
307 // Leave the debugger shell. 307 // Leave the debugger shell.
308 done = true; 308 done = true;
309 } else if ((strcmp(cmd, "p") == 0) || (strcmp(cmd, "print") == 0)) { 309 } else if ((strcmp(cmd, "p") == 0) || (strcmp(cmd, "print") == 0)) {
310 if (argc == 2 || (argc == 3 && strcmp(arg2, "fp") == 0)) { 310 if (argc == 2 || (argc == 3 && strcmp(arg2, "fp") == 0)) {
311 intptr_t value; 311 intptr_t value;
312 double dvalue; 312 double dvalue;
313 if (strcmp(arg1, "all") == 0) { 313 if (strcmp(arg1, "all") == 0) {
314 for (int i = 0; i < kNumRegisters; i++) { 314 for (int i = 0; i < kNumRegisters; i++) {
315 value = GetRegisterValue(i); 315 value = GetRegisterValue(i);
316 PrintF(" %3s: %08" V8PRIxPTR, Registers::Name(i), value); 316 PrintF(" %3s: %08" V8PRIxPTR,
317 Register::from_code(i).ToString(), value);
317 if ((argc == 3 && strcmp(arg2, "fp") == 0) && i < 8 && 318 if ((argc == 3 && strcmp(arg2, "fp") == 0) && i < 8 &&
318 (i % 2) == 0) { 319 (i % 2) == 0) {
319 dvalue = GetRegisterPairDoubleValue(i); 320 dvalue = GetRegisterPairDoubleValue(i);
320 PrintF(" (%f)\n", dvalue); 321 PrintF(" (%f)\n", dvalue);
321 } else if (i != 0 && !((i + 1) & 3)) { 322 } else if (i != 0 && !((i + 1) & 3)) {
322 PrintF("\n"); 323 PrintF("\n");
323 } 324 }
324 } 325 }
325 PrintF(" pc: %08" V8PRIxPTR " lr: %08" V8PRIxPTR 326 PrintF(" pc: %08" V8PRIxPTR " lr: %08" V8PRIxPTR
326 " " 327 " "
327 "ctr: %08" V8PRIxPTR " xer: %08x cr: %08x\n", 328 "ctr: %08" V8PRIxPTR " xer: %08x cr: %08x\n",
328 sim_->special_reg_pc_, sim_->special_reg_lr_, 329 sim_->special_reg_pc_, sim_->special_reg_lr_,
329 sim_->special_reg_ctr_, sim_->special_reg_xer_, 330 sim_->special_reg_ctr_, sim_->special_reg_xer_,
330 sim_->condition_reg_); 331 sim_->condition_reg_);
331 } else if (strcmp(arg1, "alld") == 0) { 332 } else if (strcmp(arg1, "alld") == 0) {
332 for (int i = 0; i < kNumRegisters; i++) { 333 for (int i = 0; i < kNumRegisters; i++) {
333 value = GetRegisterValue(i); 334 value = GetRegisterValue(i);
334 PrintF(" %3s: %08" V8PRIxPTR " %11" V8PRIdPTR, 335 PrintF(" %3s: %08" V8PRIxPTR " %11" V8PRIdPTR,
335 Registers::Name(i), value, value); 336 Register::from_code(i).ToString(), value, value);
336 if ((argc == 3 && strcmp(arg2, "fp") == 0) && i < 8 && 337 if ((argc == 3 && strcmp(arg2, "fp") == 0) && i < 8 &&
337 (i % 2) == 0) { 338 (i % 2) == 0) {
338 dvalue = GetRegisterPairDoubleValue(i); 339 dvalue = GetRegisterPairDoubleValue(i);
339 PrintF(" (%f)\n", dvalue); 340 PrintF(" (%f)\n", dvalue);
340 } else if (!((i + 1) % 2)) { 341 } else if (!((i + 1) % 2)) {
341 PrintF("\n"); 342 PrintF("\n");
342 } 343 }
343 } 344 }
344 PrintF(" pc: %08" V8PRIxPTR " lr: %08" V8PRIxPTR 345 PrintF(" pc: %08" V8PRIxPTR " lr: %08" V8PRIxPTR
345 " " 346 " "
346 "ctr: %08" V8PRIxPTR " xer: %08x cr: %08x\n", 347 "ctr: %08" V8PRIxPTR " xer: %08x cr: %08x\n",
347 sim_->special_reg_pc_, sim_->special_reg_lr_, 348 sim_->special_reg_pc_, sim_->special_reg_lr_,
348 sim_->special_reg_ctr_, sim_->special_reg_xer_, 349 sim_->special_reg_ctr_, sim_->special_reg_xer_,
349 sim_->condition_reg_); 350 sim_->condition_reg_);
350 } else if (strcmp(arg1, "allf") == 0) { 351 } else if (strcmp(arg1, "allf") == 0) {
351 for (int i = 0; i < DoubleRegister::kNumRegisters; i++) { 352 for (int i = 0; i < DoubleRegister::kNumRegisters; i++) {
352 dvalue = GetFPDoubleRegisterValue(i); 353 dvalue = GetFPDoubleRegisterValue(i);
353 uint64_t as_words = bit_cast<uint64_t>(dvalue); 354 uint64_t as_words = bit_cast<uint64_t>(dvalue);
354 PrintF("%3s: %f 0x%08x %08x\n", FPRegisters::Name(i), dvalue, 355 PrintF("%3s: %f 0x%08x %08x\n",
356 DoubleRegister::from_code(i).ToString(), dvalue,
355 static_cast<uint32_t>(as_words >> 32), 357 static_cast<uint32_t>(as_words >> 32),
356 static_cast<uint32_t>(as_words & 0xffffffff)); 358 static_cast<uint32_t>(as_words & 0xffffffff));
357 } 359 }
358 } else if (arg1[0] == 'r' && 360 } else if (arg1[0] == 'r' &&
359 (arg1[1] >= '0' && arg1[1] <= '9' && 361 (arg1[1] >= '0' && arg1[1] <= '9' &&
360 (arg1[2] == '\0' || (arg1[2] >= '0' && arg1[2] <= '9' && 362 (arg1[2] == '\0' || (arg1[2] >= '0' && arg1[2] <= '9' &&
361 arg1[3] == '\0')))) { 363 arg1[3] == '\0')))) {
362 int regnum = strtoul(&arg1[1], 0, 10); 364 int regnum = strtoul(&arg1[1], 0, 10);
363 if (regnum != kNoRegister) { 365 if (regnum != kNoRegister) {
364 value = GetRegisterValue(regnum); 366 value = GetRegisterValue(regnum);
(...skipping 3528 matching lines...) Expand 10 before | Expand all | Expand 10 after
3893 uintptr_t* stack_slot = reinterpret_cast<uintptr_t*>(current_sp); 3895 uintptr_t* stack_slot = reinterpret_cast<uintptr_t*>(current_sp);
3894 uintptr_t address = *stack_slot; 3896 uintptr_t address = *stack_slot;
3895 set_register(sp, current_sp + sizeof(uintptr_t)); 3897 set_register(sp, current_sp + sizeof(uintptr_t));
3896 return address; 3898 return address;
3897 } 3899 }
3898 } // namespace internal 3900 } // namespace internal
3899 } // namespace v8 3901 } // namespace v8
3900 3902
3901 #endif // USE_SIMULATOR 3903 #endif // USE_SIMULATOR
3902 #endif // V8_TARGET_ARCH_PPC 3904 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « src/ppc/macro-assembler-ppc.cc ('k') | src/register-configuration.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698