| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 MIPS instructions if we are not generating a native | 6 // Declares a Simulator for MIPS instructions if we are not generating a native |
| 7 // MIPS binary. This Simulator allows us to run and debug MIPS code generation | 7 // MIPS binary. This Simulator allows us to run and debug MIPS code generation |
| 8 // on regular desktop machines. | 8 // on 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 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 set_register(rd_reg, alu_out); | 385 set_register(rd_reg, alu_out); |
| 386 TraceRegWr(alu_out); | 386 TraceRegWr(alu_out); |
| 387 } | 387 } |
| 388 | 388 |
| 389 void DecodeTypeImmediate(Instruction* instr); | 389 void DecodeTypeImmediate(Instruction* instr); |
| 390 void DecodeTypeJump(Instruction* instr); | 390 void DecodeTypeJump(Instruction* instr); |
| 391 | 391 |
| 392 // Used for breakpoints and traps. | 392 // Used for breakpoints and traps. |
| 393 void SoftwareInterrupt(Instruction* instr); | 393 void SoftwareInterrupt(Instruction* instr); |
| 394 | 394 |
| 395 // Compact branch guard. |
| 396 void CheckForbiddenSlot(int64_t current_pc) { |
| 397 Instruction* instr_after_compact_branch = |
| 398 reinterpret_cast<Instruction*>(current_pc + Instruction::kInstrSize); |
| 399 if (instr_after_compact_branch->IsForbiddenAfterBranch()) { |
| 400 V8_Fatal(__FILE__, __LINE__, |
| 401 "Error: Unexpected instruction 0x%08x immediately after a " |
| 402 "compact branch instruction.", |
| 403 *reinterpret_cast<uint32_t*>(instr_after_compact_branch)); |
| 404 } |
| 405 } |
| 406 |
| 395 // Stop helper functions. | 407 // Stop helper functions. |
| 396 bool IsWatchpoint(uint64_t code); | 408 bool IsWatchpoint(uint64_t code); |
| 397 void PrintWatchpoint(uint64_t code); | 409 void PrintWatchpoint(uint64_t code); |
| 398 void HandleStop(uint64_t code, Instruction* instr); | 410 void HandleStop(uint64_t code, Instruction* instr); |
| 399 bool IsStopInstruction(Instruction* instr); | 411 bool IsStopInstruction(Instruction* instr); |
| 400 bool IsEnabledStop(uint64_t code); | 412 bool IsEnabledStop(uint64_t code); |
| 401 void EnableStop(uint64_t code); | 413 void EnableStop(uint64_t code); |
| 402 void DisableStop(uint64_t code); | 414 void DisableStop(uint64_t code); |
| 403 void IncreaseStopCounter(uint64_t code); | 415 void IncreaseStopCounter(uint64_t code); |
| 404 void PrintStopInfo(uint64_t code); | 416 void PrintStopInfo(uint64_t code); |
| 405 | 417 |
| 406 | 418 |
| 407 // Executes one instruction. | 419 // Executes one instruction. |
| 408 void InstructionDecode(Instruction* instr); | 420 void InstructionDecode(Instruction* instr); |
| 409 // Execute one instruction placed in a branch delay slot. | 421 // Execute one instruction placed in a branch delay slot. |
| 410 void BranchDelayInstructionDecode(Instruction* instr) { | 422 void BranchDelayInstructionDecode(Instruction* instr) { |
| 411 if (instr->InstructionBits() == nopInstr) { | 423 if (instr->InstructionBits() == nopInstr) { |
| 412 // Short-cut generic nop instructions. They are always valid and they | 424 // Short-cut generic nop instructions. They are always valid and they |
| 413 // never change the simulator state. | 425 // never change the simulator state. |
| 414 return; | 426 return; |
| 415 } | 427 } |
| 416 | 428 |
| 417 if (instr->IsForbiddenInBranchDelay()) { | 429 if (instr->IsForbiddenAfterBranch()) { |
| 418 V8_Fatal(__FILE__, __LINE__, | 430 V8_Fatal(__FILE__, __LINE__, |
| 419 "Eror:Unexpected %i opcode in a branch delay slot.", | 431 "Eror:Unexpected %i opcode in a branch delay slot.", |
| 420 instr->OpcodeValue()); | 432 instr->OpcodeValue()); |
| 421 } | 433 } |
| 422 InstructionDecode(instr); | 434 InstructionDecode(instr); |
| 423 SNPrintF(trace_buf_, " "); | 435 SNPrintF(trace_buf_, " "); |
| 424 } | 436 } |
| 425 | 437 |
| 426 // ICache. | 438 // ICache. |
| 427 static void CheckICache(v8::internal::HashMap* i_cache, Instruction* instr); | 439 static void CheckICache(v8::internal::HashMap* i_cache, Instruction* instr); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 static inline void UnregisterCTryCatch(Isolate* isolate) { | 550 static inline void UnregisterCTryCatch(Isolate* isolate) { |
| 539 Simulator::current(isolate)->PopAddress(); | 551 Simulator::current(isolate)->PopAddress(); |
| 540 } | 552 } |
| 541 }; | 553 }; |
| 542 | 554 |
| 543 } // namespace internal | 555 } // namespace internal |
| 544 } // namespace v8 | 556 } // namespace v8 |
| 545 | 557 |
| 546 #endif // !defined(USE_SIMULATOR) | 558 #endif // !defined(USE_SIMULATOR) |
| 547 #endif // V8_MIPS_SIMULATOR_MIPS_H_ | 559 #endif // V8_MIPS_SIMULATOR_MIPS_H_ |
| OLD | NEW |