| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 for (int i = 0; i < kNumRegisters; i++) { | 287 for (int i = 0; i < kNumRegisters; i++) { |
| 288 value = GetRegisterValue(i); | 288 value = GetRegisterValue(i); |
| 289 PrintF("%3s: 0x%08x %10d\n", Registers::Name(i), value, value); | 289 PrintF("%3s: 0x%08x %10d\n", Registers::Name(i), value, value); |
| 290 } | 290 } |
| 291 } else { | 291 } else { |
| 292 if (GetValue(arg1, &value)) { | 292 if (GetValue(arg1, &value)) { |
| 293 PrintF("%s: 0x%08x %d \n", arg1, value, value); | 293 PrintF("%s: 0x%08x %d \n", arg1, value, value); |
| 294 } else if (GetVFPSingleValue(arg1, &svalue)) { | 294 } else if (GetVFPSingleValue(arg1, &svalue)) { |
| 295 PrintF("%s: %f \n", arg1, svalue); | 295 PrintF("%s: %f \n", arg1, svalue); |
| 296 } else if (GetVFPDoubleValue(arg1, &dvalue)) { | 296 } else if (GetVFPDoubleValue(arg1, &dvalue)) { |
| 297 PrintF("%s: %f \n", arg1, dvalue); | 297 PrintF("%s: %lf \n", arg1, dvalue); |
| 298 } else { | 298 } else { |
| 299 PrintF("%s unrecognized\n", arg1); | 299 PrintF("%s unrecognized\n", arg1); |
| 300 } | 300 } |
| 301 } | 301 } |
| 302 } else { | 302 } else { |
| 303 PrintF("print <register>\n"); | 303 PrintF("print <register>\n"); |
| 304 } | 304 } |
| 305 } else if ((strcmp(cmd, "po") == 0) | 305 } else if ((strcmp(cmd, "po") == 0) |
| 306 || (strcmp(cmd, "printobject") == 0)) { | 306 || (strcmp(cmd, "printobject") == 0)) { |
| 307 if (argc == 2) { | 307 if (argc == 2) { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 if (argc == next_arg) { | 342 if (argc == next_arg) { |
| 343 words = 10; | 343 words = 10; |
| 344 } else if (argc == next_arg + 1) { | 344 } else if (argc == next_arg + 1) { |
| 345 if (!GetValue(argv[next_arg], &words)) { | 345 if (!GetValue(argv[next_arg], &words)) { |
| 346 words = 10; | 346 words = 10; |
| 347 } | 347 } |
| 348 } | 348 } |
| 349 end = cur + words; | 349 end = cur + words; |
| 350 | 350 |
| 351 while (cur < end) { | 351 while (cur < end) { |
| 352 PrintF(" 0x%08x: 0x%08x %10d\n", | 352 PrintF(" 0x%08x: 0x%08x %10d\n", cur, *cur, *cur); |
| 353 reinterpret_cast<intptr_t>(cur), *cur, *cur); | |
| 354 cur++; | 353 cur++; |
| 355 } | 354 } |
| 356 } else if (strcmp(cmd, "disasm") == 0) { | 355 } else if (strcmp(cmd, "disasm") == 0) { |
| 357 disasm::NameConverter converter; | 356 disasm::NameConverter converter; |
| 358 disasm::Disassembler dasm(converter); | 357 disasm::Disassembler dasm(converter); |
| 359 // use a reasonably large buffer | 358 // use a reasonably large buffer |
| 360 v8::internal::EmbeddedVector<char, 256> buffer; | 359 v8::internal::EmbeddedVector<char, 256> buffer; |
| 361 | 360 |
| 362 byte* cur = NULL; | 361 byte* cur = NULL; |
| 363 byte* end = NULL; | 362 byte* end = NULL; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 376 int32_t value1; | 375 int32_t value1; |
| 377 int32_t value2; | 376 int32_t value2; |
| 378 if (GetValue(arg1, &value1) && GetValue(arg2, &value2)) { | 377 if (GetValue(arg1, &value1) && GetValue(arg2, &value2)) { |
| 379 cur = reinterpret_cast<byte*>(value1); | 378 cur = reinterpret_cast<byte*>(value1); |
| 380 end = cur + (value2 * Instr::kInstrSize); | 379 end = cur + (value2 * Instr::kInstrSize); |
| 381 } | 380 } |
| 382 } | 381 } |
| 383 | 382 |
| 384 while (cur < end) { | 383 while (cur < end) { |
| 385 dasm.InstructionDecode(buffer, cur); | 384 dasm.InstructionDecode(buffer, cur); |
| 386 PrintF(" 0x%08x %s\n", | 385 PrintF(" 0x%08x %s\n", cur, buffer.start()); |
| 387 reinterpret_cast<intptr_t>(cur), buffer.start()); | |
| 388 cur += Instr::kInstrSize; | 386 cur += Instr::kInstrSize; |
| 389 } | 387 } |
| 390 } else if (strcmp(cmd, "gdb") == 0) { | 388 } else if (strcmp(cmd, "gdb") == 0) { |
| 391 PrintF("relinquishing control to gdb\n"); | 389 PrintF("relinquishing control to gdb\n"); |
| 392 v8::internal::OS::DebugBreak(); | 390 v8::internal::OS::DebugBreak(); |
| 393 PrintF("regaining control from gdb\n"); | 391 PrintF("regaining control from gdb\n"); |
| 394 } else if (strcmp(cmd, "break") == 0) { | 392 } else if (strcmp(cmd, "break") == 0) { |
| 395 if (argc == 2) { | 393 if (argc == 2) { |
| 396 int32_t value; | 394 int32_t value; |
| 397 if (GetValue(arg1, &value)) { | 395 if (GetValue(arg1, &value)) { |
| (...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1056 uintptr_t Simulator::StackLimit() const { | 1054 uintptr_t Simulator::StackLimit() const { |
| 1057 // Leave a safety margin of 256 bytes to prevent overrunning the stack when | 1055 // Leave a safety margin of 256 bytes to prevent overrunning the stack when |
| 1058 // pushing values. | 1056 // pushing values. |
| 1059 return reinterpret_cast<uintptr_t>(stack_) + 256; | 1057 return reinterpret_cast<uintptr_t>(stack_) + 256; |
| 1060 } | 1058 } |
| 1061 | 1059 |
| 1062 | 1060 |
| 1063 // Unsupported instructions use Format to print an error and stop execution. | 1061 // Unsupported instructions use Format to print an error and stop execution. |
| 1064 void Simulator::Format(Instr* instr, const char* format) { | 1062 void Simulator::Format(Instr* instr, const char* format) { |
| 1065 PrintF("Simulator found unsupported instruction:\n 0x%08x: %s\n", | 1063 PrintF("Simulator found unsupported instruction:\n 0x%08x: %s\n", |
| 1066 reinterpret_cast<intptr_t>(instr), format); | 1064 instr, format); |
| 1067 UNIMPLEMENTED(); | 1065 UNIMPLEMENTED(); |
| 1068 } | 1066 } |
| 1069 | 1067 |
| 1070 | 1068 |
| 1071 // Checks if the current instruction should be executed based on its | 1069 // Checks if the current instruction should be executed based on its |
| 1072 // condition bits. | 1070 // condition bits. |
| 1073 bool Simulator::ConditionallyExecute(Instr* instr) { | 1071 bool Simulator::ConditionallyExecute(Instr* instr) { |
| 1074 switch (instr->ConditionField()) { | 1072 switch (instr->ConditionField()) { |
| 1075 case EQ: return z_flag_; | 1073 case EQ: return z_flag_; |
| 1076 case NE: return !z_flag_; | 1074 case NE: return !z_flag_; |
| (...skipping 1568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2645 CheckICache(instr); | 2643 CheckICache(instr); |
| 2646 } | 2644 } |
| 2647 pc_modified_ = false; | 2645 pc_modified_ = false; |
| 2648 if (::v8::internal::FLAG_trace_sim) { | 2646 if (::v8::internal::FLAG_trace_sim) { |
| 2649 disasm::NameConverter converter; | 2647 disasm::NameConverter converter; |
| 2650 disasm::Disassembler dasm(converter); | 2648 disasm::Disassembler dasm(converter); |
| 2651 // use a reasonably large buffer | 2649 // use a reasonably large buffer |
| 2652 v8::internal::EmbeddedVector<char, 256> buffer; | 2650 v8::internal::EmbeddedVector<char, 256> buffer; |
| 2653 dasm.InstructionDecode(buffer, | 2651 dasm.InstructionDecode(buffer, |
| 2654 reinterpret_cast<byte*>(instr)); | 2652 reinterpret_cast<byte*>(instr)); |
| 2655 PrintF(" 0x%08x %s\n", reinterpret_cast<intptr_t>(instr), buffer.start()); | 2653 PrintF(" 0x%08x %s\n", instr, buffer.start()); |
| 2656 } | 2654 } |
| 2657 if (instr->ConditionField() == special_condition) { | 2655 if (instr->ConditionField() == special_condition) { |
| 2658 DecodeUnconditional(instr); | 2656 DecodeUnconditional(instr); |
| 2659 } else if (ConditionallyExecute(instr)) { | 2657 } else if (ConditionallyExecute(instr)) { |
| 2660 switch (instr->TypeField()) { | 2658 switch (instr->TypeField()) { |
| 2661 case 0: | 2659 case 0: |
| 2662 case 1: { | 2660 case 1: { |
| 2663 DecodeType01(instr); | 2661 DecodeType01(instr); |
| 2664 break; | 2662 break; |
| 2665 } | 2663 } |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2836 uintptr_t address = *stack_slot; | 2834 uintptr_t address = *stack_slot; |
| 2837 set_register(sp, current_sp + sizeof(uintptr_t)); | 2835 set_register(sp, current_sp + sizeof(uintptr_t)); |
| 2838 return address; | 2836 return address; |
| 2839 } | 2837 } |
| 2840 | 2838 |
| 2841 } } // namespace assembler::arm | 2839 } } // namespace assembler::arm |
| 2842 | 2840 |
| 2843 #endif // __arm__ | 2841 #endif // __arm__ |
| 2844 | 2842 |
| 2845 #endif // V8_TARGET_ARCH_ARM | 2843 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |