| OLD | NEW |
| 1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 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 27 matching lines...) Expand all Loading... |
| 38 // Only build the simulator if not compiling for real ARM hardware. | 38 // Only build the simulator if not compiling for real ARM hardware. |
| 39 namespace assembler { namespace arm { | 39 namespace assembler { namespace arm { |
| 40 | 40 |
| 41 using ::v8::internal::Object; | 41 using ::v8::internal::Object; |
| 42 using ::v8::internal::PrintF; | 42 using ::v8::internal::PrintF; |
| 43 using ::v8::internal::OS; | 43 using ::v8::internal::OS; |
| 44 using ::v8::internal::ReadLine; | 44 using ::v8::internal::ReadLine; |
| 45 using ::v8::internal::DeleteArray; | 45 using ::v8::internal::DeleteArray; |
| 46 | 46 |
| 47 | 47 |
| 48 DEFINE_bool(trace_sim, false, "trace simulator execution"); | |
| 49 | |
| 50 | |
| 51 // The Debugger class is used by the simulator while debugging simulated ARM | 48 // The Debugger class is used by the simulator while debugging simulated ARM |
| 52 // code. | 49 // code. |
| 53 class Debugger { | 50 class Debugger { |
| 54 public: | 51 public: |
| 55 explicit Debugger(Simulator* sim); | 52 explicit Debugger(Simulator* sim); |
| 56 ~Debugger(); | 53 ~Debugger(); |
| 57 | 54 |
| 58 void Stop(Instr* instr); | 55 void Stop(Instr* instr); |
| 59 void Debug(); | 56 void Debug(); |
| 60 | 57 |
| (...skipping 1325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1386 break; | 1383 break; |
| 1387 } | 1384 } |
| 1388 } | 1385 } |
| 1389 } | 1386 } |
| 1390 if (!pc_modified_) { | 1387 if (!pc_modified_) { |
| 1391 set_register(pc, reinterpret_cast<int32_t>(instr) + Instr::kInstrSize); | 1388 set_register(pc, reinterpret_cast<int32_t>(instr) + Instr::kInstrSize); |
| 1392 } | 1389 } |
| 1393 } | 1390 } |
| 1394 | 1391 |
| 1395 | 1392 |
| 1396 DEFINE_int(stop_sim_at, 0, "Simulator stop after x number of instructions"); | |
| 1397 | |
| 1398 | |
| 1399 // | 1393 // |
| 1400 void Simulator::execute() { | 1394 void Simulator::execute() { |
| 1401 // Get the PC to simulate. Cannot use the accessor here as we need the | 1395 // Get the PC to simulate. Cannot use the accessor here as we need the |
| 1402 // raw PC value and not the one used as input to arithmetic instructions. | 1396 // raw PC value and not the one used as input to arithmetic instructions. |
| 1403 int program_counter = get_pc(); | 1397 int program_counter = get_pc(); |
| 1404 | 1398 |
| 1405 if (FLAG_stop_sim_at == 0) { | 1399 if (FLAG_stop_sim_at == 0) { |
| 1406 // Fast version of the dispatch loop without checking whether the simulator | 1400 // Fast version of the dispatch loop without checking whether the simulator |
| 1407 // should be stopping at a particular executed instruction. | 1401 // should be stopping at a particular executed instruction. |
| 1408 while (program_counter != end_sim_pc) { | 1402 while (program_counter != end_sim_pc) { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1494 set_register(r10, r10_val); | 1488 set_register(r10, r10_val); |
| 1495 set_register(r11, r11_val); | 1489 set_register(r11, r11_val); |
| 1496 | 1490 |
| 1497 int result = get_register(r0); | 1491 int result = get_register(r0); |
| 1498 return reinterpret_cast<Object*>(result); | 1492 return reinterpret_cast<Object*>(result); |
| 1499 } | 1493 } |
| 1500 | 1494 |
| 1501 } } // namespace assembler::arm | 1495 } } // namespace assembler::arm |
| 1502 | 1496 |
| 1503 #endif // !defined(__arm__) | 1497 #endif // !defined(__arm__) |
| OLD | NEW |