| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 | 5 |
| 6 // Declares a Simulator for PPC instructions if we are not generating a native | 6 // Declares a Simulator for PPC instructions if we are not generating a native |
| 7 // PPC binary. This Simulator allows us to run and debug PPC code generation on | 7 // PPC binary. This Simulator allows us to run and debug PPC code generation on |
| 8 // regular desktop machines. | 8 // regular desktop machines. |
| 9 // V8 calls into generated code by "calling" the CALL_GENERATED_CODE macro, | 9 // V8 calls into generated code by "calling" the CALL_GENERATED_CODE macro, |
| 10 // which will start execution in the Simulator or forwards to the real entry | 10 // which will start execution in the Simulator or forwards to the real entry |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 // The currently executing Simulator instance. Potentially there can be one | 173 // The currently executing Simulator instance. Potentially there can be one |
| 174 // for each native thread. | 174 // for each native thread. |
| 175 static Simulator* current(v8::internal::Isolate* isolate); | 175 static Simulator* current(v8::internal::Isolate* isolate); |
| 176 | 176 |
| 177 // Accessors for register state. | 177 // Accessors for register state. |
| 178 void set_register(int reg, intptr_t value); | 178 void set_register(int reg, intptr_t value); |
| 179 intptr_t get_register(int reg) const; | 179 intptr_t get_register(int reg) const; |
| 180 double get_double_from_register_pair(int reg); | 180 double get_double_from_register_pair(int reg); |
| 181 void set_d_register_from_double(int dreg, const double dbl) { | 181 void set_d_register_from_double(int dreg, const double dbl) { |
| 182 DCHECK(dreg >= 0 && dreg < kNumFPRs); | 182 DCHECK(dreg >= 0 && dreg < kNumFPRs); |
| 183 fp_registers_[dreg] = dbl; | 183 *bit_cast<double*>(&fp_registers_[dreg]) = dbl; |
| 184 } | 184 } |
| 185 double get_double_from_d_register(int dreg) { return fp_registers_[dreg]; } | 185 double get_double_from_d_register(int dreg) { |
| 186 DCHECK(dreg >= 0 && dreg < kNumFPRs); |
| 187 return *bit_cast<double*>(&fp_registers_[dreg]); |
| 188 } |
| 189 void set_d_register(int dreg, int64_t value) { |
| 190 DCHECK(dreg >= 0 && dreg < kNumFPRs); |
| 191 fp_registers_[dreg] = value; |
| 192 } |
| 193 int64_t get_d_register(int dreg) { |
| 194 DCHECK(dreg >= 0 && dreg < kNumFPRs); |
| 195 return fp_registers_[dreg]; |
| 196 } |
| 186 | 197 |
| 187 // Special case of set_register and get_register to access the raw PC value. | 198 // Special case of set_register and get_register to access the raw PC value. |
| 188 void set_pc(intptr_t value); | 199 void set_pc(intptr_t value); |
| 189 intptr_t get_pc() const; | 200 intptr_t get_pc() const; |
| 190 | 201 |
| 191 Address get_sp() { | 202 Address get_sp() { |
| 192 return reinterpret_cast<Address>(static_cast<intptr_t>(get_register(sp))); | 203 return reinterpret_cast<Address>(static_cast<intptr_t>(get_register(sp))); |
| 193 } | 204 } |
| 194 | 205 |
| 195 // Accessor to the internal simulator stack area. | 206 // Accessor to the internal simulator stack area. |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 | 297 |
| 287 intptr_t* ReadDW(intptr_t addr); | 298 intptr_t* ReadDW(intptr_t addr); |
| 288 void WriteDW(intptr_t addr, int64_t value); | 299 void WriteDW(intptr_t addr, int64_t value); |
| 289 | 300 |
| 290 void Trace(Instruction* instr); | 301 void Trace(Instruction* instr); |
| 291 void SetCR0(intptr_t result, bool setSO = false); | 302 void SetCR0(intptr_t result, bool setSO = false); |
| 292 void ExecuteBranchConditional(Instruction* instr); | 303 void ExecuteBranchConditional(Instruction* instr); |
| 293 void ExecuteExt1(Instruction* instr); | 304 void ExecuteExt1(Instruction* instr); |
| 294 bool ExecuteExt2_10bit(Instruction* instr); | 305 bool ExecuteExt2_10bit(Instruction* instr); |
| 295 bool ExecuteExt2_9bit_part1(Instruction* instr); | 306 bool ExecuteExt2_9bit_part1(Instruction* instr); |
| 296 void ExecuteExt2_9bit_part2(Instruction* instr); | 307 bool ExecuteExt2_9bit_part2(Instruction* instr); |
| 308 void ExecuteExt2_5bit(Instruction* instr); |
| 297 void ExecuteExt2(Instruction* instr); | 309 void ExecuteExt2(Instruction* instr); |
| 298 void ExecuteExt4(Instruction* instr); | 310 void ExecuteExt4(Instruction* instr); |
| 299 #if V8_TARGET_ARCH_PPC64 | 311 #if V8_TARGET_ARCH_PPC64 |
| 300 void ExecuteExt5(Instruction* instr); | 312 void ExecuteExt5(Instruction* instr); |
| 301 #endif | 313 #endif |
| 302 void ExecuteGeneric(Instruction* instr); | 314 void ExecuteGeneric(Instruction* instr); |
| 303 | 315 |
| 304 // Executes one instruction. | 316 // Executes one instruction. |
| 305 void ExecuteInstruction(Instruction* instr); | 317 void ExecuteInstruction(Instruction* instr); |
| 306 | 318 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 326 // There is currently no way to read the CPSR directly, and thus read the Q | 338 // There is currently no way to read the CPSR directly, and thus read the Q |
| 327 // flag, so this is left unimplemented. | 339 // flag, so this is left unimplemented. |
| 328 intptr_t registers_[kNumGPRs]; | 340 intptr_t registers_[kNumGPRs]; |
| 329 int32_t condition_reg_; | 341 int32_t condition_reg_; |
| 330 int32_t fp_condition_reg_; | 342 int32_t fp_condition_reg_; |
| 331 intptr_t special_reg_lr_; | 343 intptr_t special_reg_lr_; |
| 332 intptr_t special_reg_pc_; | 344 intptr_t special_reg_pc_; |
| 333 intptr_t special_reg_ctr_; | 345 intptr_t special_reg_ctr_; |
| 334 int32_t special_reg_xer_; | 346 int32_t special_reg_xer_; |
| 335 | 347 |
| 336 double fp_registers_[kNumFPRs]; | 348 int64_t fp_registers_[kNumFPRs]; |
| 337 | 349 |
| 338 // Simulator support. | 350 // Simulator support. |
| 339 char* stack_; | 351 char* stack_; |
| 340 bool pc_modified_; | 352 bool pc_modified_; |
| 341 int icount_; | 353 int icount_; |
| 342 | 354 |
| 343 // Debugger input. | 355 // Debugger input. |
| 344 char* last_debugger_input_; | 356 char* last_debugger_input_; |
| 345 | 357 |
| 346 // Icache simulation | 358 // Icache simulation |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 | 416 |
| 405 static inline void UnregisterCTryCatch() { | 417 static inline void UnregisterCTryCatch() { |
| 406 Simulator::current(Isolate::Current())->PopAddress(); | 418 Simulator::current(Isolate::Current())->PopAddress(); |
| 407 } | 419 } |
| 408 }; | 420 }; |
| 409 } | 421 } |
| 410 } // namespace v8::internal | 422 } // namespace v8::internal |
| 411 | 423 |
| 412 #endif // !defined(USE_SIMULATOR) | 424 #endif // !defined(USE_SIMULATOR) |
| 413 #endif // V8_PPC_SIMULATOR_PPC_H_ | 425 #endif // V8_PPC_SIMULATOR_PPC_H_ |
| OLD | NEW |