Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 <math.h> // for isnan. | 5 #include <math.h> // for isnan. |
| 6 #include <setjmp.h> | 6 #include <setjmp.h> |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 | 8 |
| 9 #include "vm/globals.h" | 9 #include "vm/globals.h" |
| 10 #if defined(TARGET_ARCH_ARM) | 10 #if defined(TARGET_ARCH_ARM) |
| 11 | 11 |
| 12 // Only build the simulator if not compiling for real ARM hardware. | 12 // Only build the simulator if not compiling for real ARM hardware. |
| 13 #if !defined(HOST_ARCH_ARM) | 13 #if !defined(HOST_ARCH_ARM) |
| 14 | 14 |
| 15 #include "vm/simulator.h" | 15 #include "vm/simulator.h" |
| 16 | 16 |
| 17 #include "vm/assembler.h" | 17 #include "vm/assembler.h" |
| 18 #include "vm/constants_arm.h" | 18 #include "vm/constants_arm.h" |
| 19 #include "vm/disassembler.h" | 19 #include "vm/disassembler.h" |
| 20 #include "vm/native_arguments.h" | 20 #include "vm/native_arguments.h" |
| 21 #include "vm/thread.h" | 21 #include "vm/thread.h" |
| 22 | 22 |
| 23 namespace dart { | 23 namespace dart { |
| 24 | 24 |
| 25 DEFINE_FLAG(bool, trace_sim, false, "Trace simulator execution."); | 25 DEFINE_FLAG(bool, trace_sim, false, "Trace simulator execution."); |
| 26 DEFINE_FLAG(int, stop_sim_at, 0, "Address to stop simulator at."); | 26 DEFINE_FLAG(int, stop_sim_at, 0, "Address to stop simulator at."); |
| 27 DEFINE_FLAG(bool, sim_has_int_div, false, "Simulator implements sdiv and udiv"); | |
|
regis
2013/03/04 21:54:52
not necessary.
| |
| 27 | 28 |
| 28 | 29 |
| 29 // This macro provides a platform independent use of sscanf. The reason for | 30 // This macro provides a platform independent use of sscanf. The reason for |
| 30 // SScanF not being implemented in a platform independent way through | 31 // SScanF not being implemented in a platform independent way through |
| 31 // OS in the same way as SNPrint is that the Windows C Run-Time | 32 // OS in the same way as SNPrint is that the Windows C Run-Time |
| 32 // Library does not provide vsscanf. | 33 // Library does not provide vsscanf. |
| 33 #define SScanF sscanf // NOLINT | 34 #define SScanF sscanf // NOLINT |
| 34 | 35 |
| 35 | 36 |
| 36 // Unimplemented counter class for debugging and measurement purposes. | 37 // Unimplemented counter class for debugging and measurement purposes. |
| (...skipping 2541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2578 (instr->Bits(12, 4) == 0xf)) { | 2579 (instr->Bits(12, 4) == 0xf)) { |
| 2579 // Format(instr, "vmstat'cond"); | 2580 // Format(instr, "vmstat'cond"); |
| 2580 n_flag_ = fp_n_flag_; | 2581 n_flag_ = fp_n_flag_; |
| 2581 z_flag_ = fp_z_flag_; | 2582 z_flag_ = fp_z_flag_; |
| 2582 c_flag_ = fp_c_flag_; | 2583 c_flag_ = fp_c_flag_; |
| 2583 v_flag_ = fp_v_flag_; | 2584 v_flag_ = fp_v_flag_; |
| 2584 } else { | 2585 } else { |
| 2585 UNIMPLEMENTED(); | 2586 UNIMPLEMENTED(); |
| 2586 } | 2587 } |
| 2587 } | 2588 } |
| 2589 } else if (instr->IsMrcIdIsar0()) { | |
| 2590 // mrc of ID_ISAR0 | |
| 2591 Register rd = instr->RdField(); | |
| 2592 if (FLAG_sim_has_int_div) { | |
|
regis
2013/03/04 21:54:52
Test CPUFeatures instead.
| |
| 2593 set_register(rd, 0x02100010); // sim has sdiv, udiv, bkpt and clz | |
| 2594 } else { | |
| 2595 set_register(rd, 0x00100010); // simulator has only bkpt and clz | |
| 2596 } | |
| 2588 } else { | 2597 } else { |
| 2589 UNIMPLEMENTED(); | 2598 UNIMPLEMENTED(); |
| 2590 } | 2599 } |
| 2591 } | 2600 } |
| 2592 | 2601 |
| 2593 | 2602 |
| 2594 // Executes the current instruction. | 2603 // Executes the current instruction. |
| 2595 void Simulator::InstructionDecode(Instr* instr) { | 2604 void Simulator::InstructionDecode(Instr* instr) { |
| 2596 pc_modified_ = false; | 2605 pc_modified_ = false; |
| 2597 if (FLAG_trace_sim) { | 2606 if (FLAG_trace_sim) { |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2800 // isolate->ChangeStateToGeneratedCode(); | 2809 // isolate->ChangeStateToGeneratedCode(); |
| 2801 set_register(kExceptionObjectReg, bit_cast<int32_t>(object.raw())); | 2810 set_register(kExceptionObjectReg, bit_cast<int32_t>(object.raw())); |
| 2802 buf->Longjmp(); | 2811 buf->Longjmp(); |
| 2803 } | 2812 } |
| 2804 | 2813 |
| 2805 } // namespace dart | 2814 } // namespace dart |
| 2806 | 2815 |
| 2807 #endif // !defined(HOST_ARCH_ARM) | 2816 #endif // !defined(HOST_ARCH_ARM) |
| 2808 | 2817 |
| 2809 #endif // defined TARGET_ARCH_ARM | 2818 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |