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: %lf \n", arg1, dvalue); | 297 PrintF("%s: %f \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", cur, *cur, *cur); | 352 PrintF(" 0x%08x: 0x%08x %10d\n", |
| 353 reinterpret_cast<intptr_t>(cur), *cur, *cur); |
353 cur++; | 354 cur++; |
354 } | 355 } |
355 } else if (strcmp(cmd, "disasm") == 0) { | 356 } else if (strcmp(cmd, "disasm") == 0) { |
356 disasm::NameConverter converter; | 357 disasm::NameConverter converter; |
357 disasm::Disassembler dasm(converter); | 358 disasm::Disassembler dasm(converter); |
358 // use a reasonably large buffer | 359 // use a reasonably large buffer |
359 v8::internal::EmbeddedVector<char, 256> buffer; | 360 v8::internal::EmbeddedVector<char, 256> buffer; |
360 | 361 |
361 byte* cur = NULL; | 362 byte* cur = NULL; |
362 byte* end = NULL; | 363 byte* end = NULL; |
(...skipping 12 matching lines...) Expand all Loading... |
375 int32_t value1; | 376 int32_t value1; |
376 int32_t value2; | 377 int32_t value2; |
377 if (GetValue(arg1, &value1) && GetValue(arg2, &value2)) { | 378 if (GetValue(arg1, &value1) && GetValue(arg2, &value2)) { |
378 cur = reinterpret_cast<byte*>(value1); | 379 cur = reinterpret_cast<byte*>(value1); |
379 end = cur + (value2 * Instr::kInstrSize); | 380 end = cur + (value2 * Instr::kInstrSize); |
380 } | 381 } |
381 } | 382 } |
382 | 383 |
383 while (cur < end) { | 384 while (cur < end) { |
384 dasm.InstructionDecode(buffer, cur); | 385 dasm.InstructionDecode(buffer, cur); |
385 PrintF(" 0x%08x %s\n", cur, buffer.start()); | 386 PrintF(" 0x%08x %s\n", |
| 387 reinterpret_cast<intptr_t>(cur), buffer.start()); |
386 cur += Instr::kInstrSize; | 388 cur += Instr::kInstrSize; |
387 } | 389 } |
388 } else if (strcmp(cmd, "gdb") == 0) { | 390 } else if (strcmp(cmd, "gdb") == 0) { |
389 PrintF("relinquishing control to gdb\n"); | 391 PrintF("relinquishing control to gdb\n"); |
390 v8::internal::OS::DebugBreak(); | 392 v8::internal::OS::DebugBreak(); |
391 PrintF("regaining control from gdb\n"); | 393 PrintF("regaining control from gdb\n"); |
392 } else if (strcmp(cmd, "break") == 0) { | 394 } else if (strcmp(cmd, "break") == 0) { |
393 if (argc == 2) { | 395 if (argc == 2) { |
394 int32_t value; | 396 int32_t value; |
395 if (GetValue(arg1, &value)) { | 397 if (GetValue(arg1, &value)) { |
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1054 uintptr_t Simulator::StackLimit() const { | 1056 uintptr_t Simulator::StackLimit() const { |
1055 // Leave a safety margin of 256 bytes to prevent overrunning the stack when | 1057 // Leave a safety margin of 256 bytes to prevent overrunning the stack when |
1056 // pushing values. | 1058 // pushing values. |
1057 return reinterpret_cast<uintptr_t>(stack_) + 256; | 1059 return reinterpret_cast<uintptr_t>(stack_) + 256; |
1058 } | 1060 } |
1059 | 1061 |
1060 | 1062 |
1061 // Unsupported instructions use Format to print an error and stop execution. | 1063 // Unsupported instructions use Format to print an error and stop execution. |
1062 void Simulator::Format(Instr* instr, const char* format) { | 1064 void Simulator::Format(Instr* instr, const char* format) { |
1063 PrintF("Simulator found unsupported instruction:\n 0x%08x: %s\n", | 1065 PrintF("Simulator found unsupported instruction:\n 0x%08x: %s\n", |
1064 instr, format); | 1066 reinterpret_cast<intptr_t>(instr), format); |
1065 UNIMPLEMENTED(); | 1067 UNIMPLEMENTED(); |
1066 } | 1068 } |
1067 | 1069 |
1068 | 1070 |
1069 // Checks if the current instruction should be executed based on its | 1071 // Checks if the current instruction should be executed based on its |
1070 // condition bits. | 1072 // condition bits. |
1071 bool Simulator::ConditionallyExecute(Instr* instr) { | 1073 bool Simulator::ConditionallyExecute(Instr* instr) { |
1072 switch (instr->ConditionField()) { | 1074 switch (instr->ConditionField()) { |
1073 case EQ: return z_flag_; | 1075 case EQ: return z_flag_; |
1074 case NE: return !z_flag_; | 1076 case NE: return !z_flag_; |
(...skipping 1568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2643 CheckICache(instr); | 2645 CheckICache(instr); |
2644 } | 2646 } |
2645 pc_modified_ = false; | 2647 pc_modified_ = false; |
2646 if (::v8::internal::FLAG_trace_sim) { | 2648 if (::v8::internal::FLAG_trace_sim) { |
2647 disasm::NameConverter converter; | 2649 disasm::NameConverter converter; |
2648 disasm::Disassembler dasm(converter); | 2650 disasm::Disassembler dasm(converter); |
2649 // use a reasonably large buffer | 2651 // use a reasonably large buffer |
2650 v8::internal::EmbeddedVector<char, 256> buffer; | 2652 v8::internal::EmbeddedVector<char, 256> buffer; |
2651 dasm.InstructionDecode(buffer, | 2653 dasm.InstructionDecode(buffer, |
2652 reinterpret_cast<byte*>(instr)); | 2654 reinterpret_cast<byte*>(instr)); |
2653 PrintF(" 0x%08x %s\n", instr, buffer.start()); | 2655 PrintF(" 0x%08x %s\n", reinterpret_cast<intptr_t>(instr), buffer.start()); |
2654 } | 2656 } |
2655 if (instr->ConditionField() == special_condition) { | 2657 if (instr->ConditionField() == special_condition) { |
2656 DecodeUnconditional(instr); | 2658 DecodeUnconditional(instr); |
2657 } else if (ConditionallyExecute(instr)) { | 2659 } else if (ConditionallyExecute(instr)) { |
2658 switch (instr->TypeField()) { | 2660 switch (instr->TypeField()) { |
2659 case 0: | 2661 case 0: |
2660 case 1: { | 2662 case 1: { |
2661 DecodeType01(instr); | 2663 DecodeType01(instr); |
2662 break; | 2664 break; |
2663 } | 2665 } |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2834 uintptr_t address = *stack_slot; | 2836 uintptr_t address = *stack_slot; |
2835 set_register(sp, current_sp + sizeof(uintptr_t)); | 2837 set_register(sp, current_sp + sizeof(uintptr_t)); |
2836 return address; | 2838 return address; |
2837 } | 2839 } |
2838 | 2840 |
2839 } } // namespace assembler::arm | 2841 } } // namespace assembler::arm |
2840 | 2842 |
2841 #endif // __arm__ | 2843 #endif // __arm__ |
2842 | 2844 |
2843 #endif // V8_TARGET_ARCH_ARM | 2845 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |