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. |
11 | 11 |
12 #ifndef VM_SIMULATOR_MIPS_H_ | 12 #ifndef VM_SIMULATOR_MIPS_H_ |
13 #define VM_SIMULATOR_MIPS_H_ | 13 #define VM_SIMULATOR_MIPS_H_ |
14 | 14 |
15 #ifndef VM_SIMULATOR_H_ | 15 #ifndef VM_SIMULATOR_H_ |
16 #error Do not include simulator_mips.h directly; use simulator.h. | 16 #error Do not include simulator_mips.h directly; use simulator.h. |
17 #endif | 17 #endif |
18 | 18 |
19 namespace dart { | 19 namespace dart { |
20 | 20 |
21 class Simulator { | 21 class Simulator { |
22 public: | 22 public: |
23 Simulator(); | 23 Simulator(); |
24 ~Simulator(); | 24 ~Simulator(); |
25 | 25 |
| 26 // The currently executing Simulator instance, which is associated to the |
| 27 // current isolate |
| 28 static Simulator* Current(); |
| 29 |
26 // Call on program start. | 30 // Call on program start. |
27 static void InitOnce(); | 31 static void InitOnce(); |
| 32 |
| 33 // Dart generally calls into generated code with 5 parameters. This is a |
| 34 // convenience function, which sets up the simulator state and grabs the |
| 35 // result on return. |
| 36 int64_t Call(int32_t entry, |
| 37 int32_t parameter0, |
| 38 int32_t parameter1, |
| 39 int32_t parameter2, |
| 40 int32_t parameter3, |
| 41 int32_t parameter4); |
28 }; | 42 }; |
29 | 43 |
30 } // namespace dart | 44 } // namespace dart |
31 | 45 |
32 #endif // VM_SIMULATOR_MIPS_H_ | 46 #endif // VM_SIMULATOR_MIPS_H_ |
OLD | NEW |