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