| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 } | 83 } |
| 84 } | 84 } |
| 85 | 85 |
| 86 bool test_fcsr_bit(uint32_t cc) { | 86 bool test_fcsr_bit(uint32_t cc) { |
| 87 return fcsr_ & (1 << cc); | 87 return fcsr_ & (1 << cc); |
| 88 } | 88 } |
| 89 | 89 |
| 90 // Accessor to the internal simulator stack top. | 90 // Accessor to the internal simulator stack top. |
| 91 uword StackTop() const; | 91 uword StackTop() const; |
| 92 | 92 |
| 93 // Accessor to the instruction counter. |
| 94 intptr_t get_icount() const { return icount_; } |
| 95 |
| 93 // The isolate's top_exit_frame_info refers to a Dart frame in the simulator | 96 // The isolate's top_exit_frame_info refers to a Dart frame in the simulator |
| 94 // stack. The simulator's top_exit_frame_info refers to a C++ frame in the | 97 // stack. The simulator's top_exit_frame_info refers to a C++ frame in the |
| 95 // native stack. | 98 // native stack. |
| 96 uword top_exit_frame_info() const { return top_exit_frame_info_; } | 99 uword top_exit_frame_info() const { return top_exit_frame_info_; } |
| 97 void set_top_exit_frame_info(uword value) { top_exit_frame_info_ = value; } | 100 void set_top_exit_frame_info(uword value) { top_exit_frame_info_ = value; } |
| 98 | 101 |
| 99 // Call on program start. | 102 // Call on program start. |
| 100 static void InitOnce(); | 103 static void InitOnce(); |
| 101 | 104 |
| 102 // Dart generally calls into generated code with 5 parameters. This is a | 105 // Dart generally calls into generated code with 5 parameters. This is a |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 return addr < 64*1024; | 173 return addr < 64*1024; |
| 171 } | 174 } |
| 172 void HandleIllegalAccess(uword addr, Instr* instr); | 175 void HandleIllegalAccess(uword addr, Instr* instr); |
| 173 | 176 |
| 174 // Read and write memory. | 177 // Read and write memory. |
| 175 void UnalignedAccess(const char* msg, uword addr, Instr* instr); | 178 void UnalignedAccess(const char* msg, uword addr, Instr* instr); |
| 176 | 179 |
| 177 // Handles a legal instruction that the simulator does not implement. | 180 // Handles a legal instruction that the simulator does not implement. |
| 178 void UnimplementedInstruction(Instr* instr); | 181 void UnimplementedInstruction(Instr* instr); |
| 179 | 182 |
| 180 bool OverflowFrom(int32_t alu_out, | |
| 181 int32_t left, | |
| 182 int32_t right, | |
| 183 bool addition); | |
| 184 | |
| 185 void set_pc(uword value) { pc_ = value; } | 183 void set_pc(uword value) { pc_ = value; } |
| 186 | 184 |
| 187 void Format(Instr* instr, const char* format); | 185 void Format(Instr* instr, const char* format); |
| 188 | 186 |
| 189 inline int8_t ReadB(uword addr); | 187 inline int8_t ReadB(uword addr); |
| 190 inline uint8_t ReadBU(uword addr); | 188 inline uint8_t ReadBU(uword addr); |
| 191 inline int16_t ReadH(uword addr, Instr* instr); | 189 inline int16_t ReadH(uword addr, Instr* instr); |
| 192 inline uint16_t ReadHU(uword addr, Instr *instr); | 190 inline uint16_t ReadHU(uword addr, Instr *instr); |
| 193 inline intptr_t ReadW(uword addr, Instr* instr); | 191 inline intptr_t ReadW(uword addr, Instr* instr); |
| 194 | 192 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 } | 250 } |
| 253 | 251 |
| 254 friend class SimulatorDebugger; | 252 friend class SimulatorDebugger; |
| 255 friend class SimulatorSetjmpBuffer; | 253 friend class SimulatorSetjmpBuffer; |
| 256 DISALLOW_COPY_AND_ASSIGN(Simulator); | 254 DISALLOW_COPY_AND_ASSIGN(Simulator); |
| 257 }; | 255 }; |
| 258 | 256 |
| 259 } // namespace dart | 257 } // namespace dart |
| 260 | 258 |
| 261 #endif // VM_SIMULATOR_MIPS_H_ | 259 #endif // VM_SIMULATOR_MIPS_H_ |
| OLD | NEW |