| 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 // Declares a Simulator for MIPS instructions if we are not generating a native | 5 // Declares a Simulator for MIPS instructions if we are not generating a native |
| 6 // MIPS binary. This Simulator allows us to run and debug MIPS code generation | 6 // MIPS binary. This Simulator allows us to run and debug MIPS code generation |
| 7 // on regular desktop machines. | 7 // on regular desktop machines. |
| 8 // Dart calls into generated code by "calling" the InvokeDartCode stub, | 8 // Dart calls into generated code by "calling" the InvokeDartCode stub, |
| 9 // which will start execution in the Simulator or forwards to the real entry | 9 // which will start execution in the Simulator or forwards to the real entry |
| 10 // on a MIPS HW platform. | 10 // on a MIPS HW platform. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 // Accessors for hi, lo registers. | 49 // Accessors for hi, lo registers. |
| 50 void set_hi_register(int32_t value) { hi_reg_ = value; } | 50 void set_hi_register(int32_t value) { hi_reg_ = value; } |
| 51 void set_lo_register(int32_t value) { lo_reg_ = value; } | 51 void set_lo_register(int32_t value) { lo_reg_ = value; } |
| 52 int32_t get_hi_register() const { return hi_reg_; } | 52 int32_t get_hi_register() const { return hi_reg_; } |
| 53 int32_t get_lo_register() const { return lo_reg_; } | 53 int32_t get_lo_register() const { return lo_reg_; } |
| 54 | 54 |
| 55 // Accessor to the internal simulator stack top. | 55 // Accessor to the internal simulator stack top. |
| 56 uword StackTop() const; | 56 uword StackTop() const; |
| 57 | 57 |
| 58 // The isolate's top_exit_frame_info refers to a Dart frame in the simulator |
| 59 // stack. The simulator's top_exit_frame_info refers to a C++ frame in the |
| 60 // native stack. |
| 61 uword top_exit_frame_info() const { return top_exit_frame_info_; } |
| 62 void set_top_exit_frame_info(uword value) { top_exit_frame_info_ = value; } |
| 63 |
| 58 // Call on program start. | 64 // Call on program start. |
| 59 static void InitOnce(); | 65 static void InitOnce(); |
| 60 | 66 |
| 61 // Dart generally calls into generated code with 5 parameters. This is a | 67 // Dart generally calls into generated code with 5 parameters. This is a |
| 62 // convenience function, which sets up the simulator state and grabs the | 68 // convenience function, which sets up the simulator state and grabs the |
| 63 // result on return. | 69 // result on return. |
| 64 int64_t Call(int32_t entry, | 70 int64_t Call(int32_t entry, |
| 65 int32_t parameter0, | 71 int32_t parameter0, |
| 66 int32_t parameter1, | 72 int32_t parameter1, |
| 67 int32_t parameter2, | 73 int32_t parameter2, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 88 | 94 |
| 89 int32_t registers_[kNumberOfCpuRegisters]; | 95 int32_t registers_[kNumberOfCpuRegisters]; |
| 90 double fregisters_[kNumberOfFRegisters]; | 96 double fregisters_[kNumberOfFRegisters]; |
| 91 uword pc_; | 97 uword pc_; |
| 92 | 98 |
| 93 // Simulator support. | 99 // Simulator support. |
| 94 char* stack_; | 100 char* stack_; |
| 95 int icount_; | 101 int icount_; |
| 96 bool delay_slot_; | 102 bool delay_slot_; |
| 97 SimulatorSetjmpBuffer* last_setjmp_buffer_; | 103 SimulatorSetjmpBuffer* last_setjmp_buffer_; |
| 104 uword top_exit_frame_info_; |
| 98 | 105 |
| 99 // Registered breakpoints. | 106 // Registered breakpoints. |
| 100 Instr* break_pc_; | 107 Instr* break_pc_; |
| 101 int32_t break_instr_; | 108 int32_t break_instr_; |
| 102 | 109 |
| 103 // Illegal memory access support. | 110 // Illegal memory access support. |
| 104 static bool IsIllegalAddress(uword addr) { | 111 static bool IsIllegalAddress(uword addr) { |
| 105 return addr < 64*1024; | 112 return addr < 64*1024; |
| 106 } | 113 } |
| 107 void HandleIllegalAccess(uword addr, Instr* instr); | 114 void HandleIllegalAccess(uword addr, Instr* instr); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 last_setjmp_buffer_ = buffer; | 157 last_setjmp_buffer_ = buffer; |
| 151 } | 158 } |
| 152 | 159 |
| 153 friend class SimulatorDebugger; | 160 friend class SimulatorDebugger; |
| 154 friend class SimulatorSetjmpBuffer; | 161 friend class SimulatorSetjmpBuffer; |
| 155 }; | 162 }; |
| 156 | 163 |
| 157 } // namespace dart | 164 } // namespace dart |
| 158 | 165 |
| 159 #endif // VM_SIMULATOR_MIPS_H_ | 166 #endif // VM_SIMULATOR_MIPS_H_ |
| OLD | NEW |