OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 // architecture specification and is off by a 8 from the currently executing | 156 // architecture specification and is off by a 8 from the currently executing |
157 // instruction. | 157 // instruction. |
158 void set_register(int reg, int32_t value); | 158 void set_register(int reg, int32_t value); |
159 int32_t get_register(int reg) const; | 159 int32_t get_register(int reg) const; |
160 double get_double_from_register_pair(int reg); | 160 double get_double_from_register_pair(int reg); |
161 void set_dw_register(int dreg, const int* dbl); | 161 void set_dw_register(int dreg, const int* dbl); |
162 | 162 |
163 // Support for VFP. | 163 // Support for VFP. |
164 void set_s_register(int reg, unsigned int value); | 164 void set_s_register(int reg, unsigned int value); |
165 unsigned int get_s_register(int reg) const; | 165 unsigned int get_s_register(int reg) const; |
166 void set_d_register_from_double(int dreg, const double& dbl); | 166 |
167 double get_double_from_d_register(int dreg); | 167 void set_d_register_from_double(int dreg, const double& dbl) { |
168 void set_s_register_from_float(int sreg, const float dbl); | 168 SetVFPRegister<double, 2>(dreg, dbl); |
169 float get_float_from_s_register(int sreg); | 169 } |
170 void set_s_register_from_sinteger(int reg, const int value); | 170 |
171 int get_sinteger_from_s_register(int reg); | 171 double get_double_from_d_register(int dreg) { |
| 172 return GetFromVFPRegister<double, 2>(dreg); |
| 173 } |
| 174 |
| 175 void set_s_register_from_float(int sreg, const float flt) { |
| 176 SetVFPRegister<float, 1>(sreg, flt); |
| 177 } |
| 178 |
| 179 float get_float_from_s_register(int sreg) { |
| 180 return GetFromVFPRegister<float, 1>(sreg); |
| 181 } |
| 182 |
| 183 void set_s_register_from_sinteger(int sreg, const int sint) { |
| 184 SetVFPRegister<int, 1>(sreg, sint); |
| 185 } |
| 186 |
| 187 int get_sinteger_from_s_register(int sreg) { |
| 188 return GetFromVFPRegister<int, 1>(sreg); |
| 189 } |
172 | 190 |
173 // Special case of set_register and get_register to access the raw PC value. | 191 // Special case of set_register and get_register to access the raw PC value. |
174 void set_pc(int32_t value); | 192 void set_pc(int32_t value); |
175 int32_t get_pc() const; | 193 int32_t get_pc() const; |
176 | 194 |
177 // Accessor to the internal simulator stack area. | 195 // Accessor to the internal simulator stack area. |
178 uintptr_t StackLimit() const; | 196 uintptr_t StackLimit() const; |
179 | 197 |
180 // Executes ARM instructions until the PC reaches end_sim_pc. | 198 // Executes ARM instructions until the PC reaches end_sim_pc. |
181 void Execute(); | 199 void Execute(); |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 void* external_function, | 343 void* external_function, |
326 v8::internal::ExternalReference::Type type); | 344 v8::internal::ExternalReference::Type type); |
327 | 345 |
328 // For use in calls that take double value arguments. | 346 // For use in calls that take double value arguments. |
329 void GetFpArgs(double* x, double* y); | 347 void GetFpArgs(double* x, double* y); |
330 void GetFpArgs(double* x); | 348 void GetFpArgs(double* x); |
331 void GetFpArgs(double* x, int32_t* y); | 349 void GetFpArgs(double* x, int32_t* y); |
332 void SetFpResult(const double& result); | 350 void SetFpResult(const double& result); |
333 void TrashCallerSaveRegisters(); | 351 void TrashCallerSaveRegisters(); |
334 | 352 |
| 353 template<class ReturnType, int register_size> |
| 354 ReturnType GetFromVFPRegister(int reg_index); |
| 355 |
| 356 template<class InputType, int register_size> |
| 357 void SetVFPRegister(int reg_index, const InputType& value); |
| 358 |
335 // Architecture state. | 359 // Architecture state. |
336 // Saturating instructions require a Q flag to indicate saturation. | 360 // Saturating instructions require a Q flag to indicate saturation. |
337 // There is currently no way to read the CPSR directly, and thus read the Q | 361 // There is currently no way to read the CPSR directly, and thus read the Q |
338 // flag, so this is left unimplemented. | 362 // flag, so this is left unimplemented. |
339 int32_t registers_[16]; | 363 int32_t registers_[16]; |
340 bool n_flag_; | 364 bool n_flag_; |
341 bool z_flag_; | 365 bool z_flag_; |
342 bool c_flag_; | 366 bool c_flag_; |
343 bool v_flag_; | 367 bool v_flag_; |
344 | 368 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 | 453 |
430 static inline void UnregisterCTryCatch() { | 454 static inline void UnregisterCTryCatch() { |
431 Simulator::current(Isolate::Current())->PopAddress(); | 455 Simulator::current(Isolate::Current())->PopAddress(); |
432 } | 456 } |
433 }; | 457 }; |
434 | 458 |
435 } } // namespace v8::internal | 459 } } // namespace v8::internal |
436 | 460 |
437 #endif // !defined(USE_SIMULATOR) | 461 #endif // !defined(USE_SIMULATOR) |
438 #endif // V8_ARM_SIMULATOR_ARM_H_ | 462 #endif // V8_ARM_SIMULATOR_ARM_H_ |
OLD | NEW |