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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 // the address of "this" to get a value on the current execution stack and then | 47 // the address of "this" to get a value on the current execution stack and then |
48 // calculates the stack limit based on that value. | 48 // calculates the stack limit based on that value. |
49 #define GENERATED_CODE_STACK_LIMIT(limit) \ | 49 #define GENERATED_CODE_STACK_LIMIT(limit) \ |
50 (reinterpret_cast<uintptr_t>(this) - limit) | 50 (reinterpret_cast<uintptr_t>(this) - limit) |
51 | 51 |
52 #else // defined(__arm__) | 52 #else // defined(__arm__) |
53 | 53 |
54 // When running with the simulator transition into simulated execution at this | 54 // When running with the simulator transition into simulated execution at this |
55 // point. | 55 // point. |
56 #define CALL_GENERATED_CODE(entry, p0, p1, p2, p3, p4) \ | 56 #define CALL_GENERATED_CODE(entry, p0, p1, p2, p3, p4) \ |
57 assembler::arm::Simulator::current()->call((int32_t)entry, (int32_t)p0, \ | 57 assembler::arm::Simulator::current()->Call((int32_t)entry, (int32_t)p0, \ |
58 (int32_t)p1, (int32_t)p2, (int32_t)p3, (int32_t)p4) | 58 (int32_t)p1, (int32_t)p2, (int32_t)p3, (int32_t)p4) |
59 | 59 |
60 // The simulator has its own stack. Thus it has a different stack limit from | 60 // The simulator has its own stack. Thus it has a different stack limit from |
61 // the C-based native code. | 61 // the C-based native code. |
62 #define GENERATED_CODE_STACK_LIMIT(limit) \ | 62 #define GENERATED_CODE_STACK_LIMIT(limit) \ |
63 (assembler::arm::Simulator::current()->StackLimit()) | 63 (assembler::arm::Simulator::current()->StackLimit()) |
64 | 64 |
65 | 65 |
66 #include "constants-arm.h" | 66 #include "constants-arm.h" |
67 | 67 |
(...skipping 28 matching lines...) Expand all Loading... |
96 int32_t get_register(int reg) const; | 96 int32_t get_register(int reg) const; |
97 | 97 |
98 // Special case of set_register and get_register to access the raw PC value. | 98 // Special case of set_register and get_register to access the raw PC value. |
99 void set_pc(int32_t value); | 99 void set_pc(int32_t value); |
100 int32_t get_pc() const; | 100 int32_t get_pc() const; |
101 | 101 |
102 // Accessor to the internal simulator stack area. | 102 // Accessor to the internal simulator stack area. |
103 uintptr_t StackLimit() const; | 103 uintptr_t StackLimit() const; |
104 | 104 |
105 // Executes ARM instructions until the PC reaches end_sim_pc. | 105 // Executes ARM instructions until the PC reaches end_sim_pc. |
106 void execute(); | 106 void Execute(); |
107 | 107 |
108 // V8 generally calls into generated code with 5 parameters. This is a | 108 // V8 generally calls into generated code with 5 parameters. This is a |
109 // convenience funtion, which sets up the simulator state and grabs the | 109 // convenience funtion, which sets up the simulator state and grabs the |
110 // result on return. | 110 // result on return. |
111 v8::internal::Object* call(int32_t entry, int32_t p0, int32_t p1, | 111 v8::internal::Object* Call(int32_t entry, int32_t p0, int32_t p1, |
112 int32_t p2, int32_t p3, int32_t p4); | 112 int32_t p2, int32_t p3, int32_t p4); |
113 | 113 |
114 private: | 114 private: |
115 enum special_values { | 115 enum special_values { |
116 // Known bad pc value to ensure that the simulator does not execute | 116 // Known bad pc value to ensure that the simulator does not execute |
117 // without being properly setup. | 117 // without being properly setup. |
118 bad_lr = -1, | 118 bad_lr = -1, |
119 // A pc value used to signal the simulator to stop execution. Generally | 119 // A pc value used to signal the simulator to stop execution. Generally |
120 // the lr is set to this value on transition from native C code to | 120 // the lr is set to this value on transition from native C code to |
121 // simulated execution, so that the simulator can "return" to the native | 121 // simulated execution, so that the simulator can "return" to the native |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 // registered breakpoints | 189 // registered breakpoints |
190 Instr* break_pc_; | 190 Instr* break_pc_; |
191 instr_t break_instr_; | 191 instr_t break_instr_; |
192 }; | 192 }; |
193 | 193 |
194 } } // namespace assembler::arm | 194 } } // namespace assembler::arm |
195 | 195 |
196 #endif // defined(__arm__) | 196 #endif // defined(__arm__) |
197 | 197 |
198 #endif // V8_SIMULATOR_ARM_H_ | 198 #endif // V8_SIMULATOR_ARM_H_ |
OLD | NEW |