| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 ~Simulator(); | 177 ~Simulator(); |
| 178 | 178 |
| 179 // The currently executing Simulator instance. Potentially there can be one | 179 // The currently executing Simulator instance. Potentially there can be one |
| 180 // for each native thread. | 180 // for each native thread. |
| 181 static Simulator* current(v8::internal::Isolate* isolate); | 181 static Simulator* current(v8::internal::Isolate* isolate); |
| 182 | 182 |
| 183 // Accessors for register state. Reading the pc value adheres to the MIPS | 183 // Accessors for register state. Reading the pc value adheres to the MIPS |
| 184 // architecture specification and is off by a 8 from the currently executing | 184 // architecture specification and is off by a 8 from the currently executing |
| 185 // instruction. | 185 // instruction. |
| 186 void set_register(int reg, int32_t value); | 186 void set_register(int reg, int32_t value); |
| 187 void set_dw_register(int dreg, const int* dbl); |
| 187 int32_t get_register(int reg) const; | 188 int32_t get_register(int reg) const; |
| 189 double get_double_from_register_pair(int reg); |
| 188 // Same for FPURegisters. | 190 // Same for FPURegisters. |
| 189 void set_fpu_register(int fpureg, int32_t value); | 191 void set_fpu_register(int fpureg, int32_t value); |
| 190 void set_fpu_register_float(int fpureg, float value); | 192 void set_fpu_register_float(int fpureg, float value); |
| 191 void set_fpu_register_double(int fpureg, double value); | 193 void set_fpu_register_double(int fpureg, double value); |
| 192 int32_t get_fpu_register(int fpureg) const; | 194 int32_t get_fpu_register(int fpureg) const; |
| 193 int64_t get_fpu_register_long(int fpureg) const; | 195 int64_t get_fpu_register_long(int fpureg) const; |
| 194 float get_fpu_register_float(int fpureg) const; | 196 float get_fpu_register_float(int fpureg) const; |
| 195 double get_fpu_register_double(int fpureg) const; | 197 double get_fpu_register_double(int fpureg) const; |
| 196 void set_fcsr_bit(uint32_t cc, bool value); | 198 void set_fcsr_bit(uint32_t cc, bool value); |
| 197 bool test_fcsr_bit(uint32_t cc); | 199 bool test_fcsr_bit(uint32_t cc); |
| 198 bool set_fcsr_round_error(double original, double rounded); | 200 bool set_fcsr_round_error(double original, double rounded); |
| 199 | 201 |
| 200 // Special case of set_register and get_register to access the raw PC value. | 202 // Special case of set_register and get_register to access the raw PC value. |
| 201 void set_pc(int32_t value); | 203 void set_pc(int32_t value); |
| 202 int32_t get_pc() const; | 204 int32_t get_pc() const; |
| 203 | 205 |
| 204 // Accessor to the internal simulator stack area. | 206 // Accessor to the internal simulator stack area. |
| 205 uintptr_t StackLimit() const; | 207 uintptr_t StackLimit() const; |
| 206 | 208 |
| 207 // Executes MIPS instructions until the PC reaches end_sim_pc. | 209 // Executes MIPS instructions until the PC reaches end_sim_pc. |
| 208 void Execute(); | 210 void Execute(); |
| 209 | 211 |
| 210 // Call on program start. | 212 // Call on program start. |
| 211 static void Initialize(Isolate* isolate); | 213 static void Initialize(Isolate* isolate); |
| 212 | 214 |
| 213 // V8 generally calls into generated JS code with 5 parameters and into | 215 // V8 generally calls into generated JS code with 5 parameters and into |
| 214 // generated RegExp code with 7 parameters. This is a convenience function, | 216 // generated RegExp code with 7 parameters. This is a convenience function, |
| 215 // which sets up the simulator state and grabs the result on return. | 217 // which sets up the simulator state and grabs the result on return. |
| 216 int32_t Call(byte* entry, int argument_count, ...); | 218 int32_t Call(byte* entry, int argument_count, ...); |
| 219 // Alternative: call a 2-argument double function. |
| 220 double CallFP(byte* entry, double d0, double d1); |
| 217 | 221 |
| 218 // Push an address onto the JS stack. | 222 // Push an address onto the JS stack. |
| 219 uintptr_t PushAddress(uintptr_t address); | 223 uintptr_t PushAddress(uintptr_t address); |
| 220 | 224 |
| 221 // Pop an address from the JS stack. | 225 // Pop an address from the JS stack. |
| 222 uintptr_t PopAddress(); | 226 uintptr_t PopAddress(); |
| 223 | 227 |
| 224 // Debugger input. | 228 // Debugger input. |
| 225 void set_last_debugger_input(char* input); | 229 void set_last_debugger_input(char* input); |
| 226 char* last_debugger_input() { return last_debugger_input_; } | 230 char* last_debugger_input() { return last_debugger_input_; } |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 // Runtime call support. | 350 // Runtime call support. |
| 347 static void* RedirectExternalReference(void* external_function, | 351 static void* RedirectExternalReference(void* external_function, |
| 348 ExternalReference::Type type); | 352 ExternalReference::Type type); |
| 349 | 353 |
| 350 // For use in calls that take double value arguments. | 354 // For use in calls that take double value arguments. |
| 351 void GetFpArgs(double* x, double* y); | 355 void GetFpArgs(double* x, double* y); |
| 352 void GetFpArgs(double* x); | 356 void GetFpArgs(double* x); |
| 353 void GetFpArgs(double* x, int32_t* y); | 357 void GetFpArgs(double* x, int32_t* y); |
| 354 void SetFpResult(const double& result); | 358 void SetFpResult(const double& result); |
| 355 | 359 |
| 360 void CallInternal(byte* entry); |
| 356 | 361 |
| 357 // Architecture state. | 362 // Architecture state. |
| 358 // Registers. | 363 // Registers. |
| 359 int32_t registers_[kNumSimuRegisters]; | 364 int32_t registers_[kNumSimuRegisters]; |
| 360 // Coprocessor Registers. | 365 // Coprocessor Registers. |
| 361 int32_t FPUregisters_[kNumFPURegisters]; | 366 int32_t FPUregisters_[kNumFPURegisters]; |
| 362 // FPU control register. | 367 // FPU control register. |
| 363 uint32_t FCSR_; | 368 uint32_t FCSR_; |
| 364 | 369 |
| 365 // Simulator support. | 370 // Simulator support. |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 | 436 |
| 432 static inline void UnregisterCTryCatch() { | 437 static inline void UnregisterCTryCatch() { |
| 433 Simulator::current(Isolate::Current())->PopAddress(); | 438 Simulator::current(Isolate::Current())->PopAddress(); |
| 434 } | 439 } |
| 435 }; | 440 }; |
| 436 | 441 |
| 437 } } // namespace v8::internal | 442 } } // namespace v8::internal |
| 438 | 443 |
| 439 #endif // !defined(USE_SIMULATOR) | 444 #endif // !defined(USE_SIMULATOR) |
| 440 #endif // V8_MIPS_SIMULATOR_MIPS_H_ | 445 #endif // V8_MIPS_SIMULATOR_MIPS_H_ |
| OLD | NEW |