summaryrefslogtreecommitdiff
path: root/deps/v8/src/mips/simulator-mips.cc
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/mips/simulator-mips.cc')
-rw-r--r--deps/v8/src/mips/simulator-mips.cc68
1 files changed, 31 insertions, 37 deletions
diff --git a/deps/v8/src/mips/simulator-mips.cc b/deps/v8/src/mips/simulator-mips.cc
index d58b899755..13f5f38f0d 100644
--- a/deps/v8/src/mips/simulator-mips.cc
+++ b/deps/v8/src/mips/simulator-mips.cc
@@ -395,7 +395,7 @@ void MipsDebugger::Debug() {
} else {
// Allow si to jump over generated breakpoints.
PrintF("/!\\ Jumping over generated breakpoint.\n");
- sim_->set_pc(sim_->get_pc() + Instruction::kInstrSize);
+ sim_->set_pc(sim_->get_pc() + kInstrSize);
}
} else if ((strcmp(cmd, "c") == 0) || (strcmp(cmd, "cont") == 0)) {
// Execute the one instruction we broke at with breakpoints disabled.
@@ -562,7 +562,7 @@ void MipsDebugger::Debug() {
if (argc == 1) {
cur = reinterpret_cast<byte*>(sim_->get_pc());
- end = cur + (10 * Instruction::kInstrSize);
+ end = cur + (10 * kInstrSize);
} else if (argc == 2) {
int regnum = Registers::Number(arg1);
if (regnum != kInvalidRegister || strncmp(arg1, "0x", 2) == 0) {
@@ -571,7 +571,7 @@ void MipsDebugger::Debug() {
if (GetValue(arg1, &value)) {
cur = reinterpret_cast<byte*>(value);
// Disassemble 10 instructions at <arg1>.
- end = cur + (10 * Instruction::kInstrSize);
+ end = cur + (10 * kInstrSize);
}
} else {
// The argument is the number of instructions.
@@ -579,7 +579,7 @@ void MipsDebugger::Debug() {
if (GetValue(arg1, &value)) {
cur = reinterpret_cast<byte*>(sim_->get_pc());
// Disassemble <arg1> instructions.
- end = cur + (value * Instruction::kInstrSize);
+ end = cur + (value * kInstrSize);
}
}
} else {
@@ -587,7 +587,7 @@ void MipsDebugger::Debug() {
int32_t value2;
if (GetValue(arg1, &value1) && GetValue(arg2, &value2)) {
cur = reinterpret_cast<byte*>(value1);
- end = cur + (value2 * Instruction::kInstrSize);
+ end = cur + (value2 * kInstrSize);
}
}
@@ -595,7 +595,7 @@ void MipsDebugger::Debug() {
dasm.InstructionDecode(buffer, cur);
PrintF(" 0x%08" PRIxPTR " %s\n", reinterpret_cast<intptr_t>(cur),
buffer.start());
- cur += Instruction::kInstrSize;
+ cur += kInstrSize;
}
} else if (strcmp(cmd, "gdb") == 0) {
PrintF("relinquishing control to gdb\n");
@@ -622,12 +622,10 @@ void MipsDebugger::Debug() {
PrintF("No flags on MIPS !\n");
} else if (strcmp(cmd, "stop") == 0) {
int32_t value;
- intptr_t stop_pc = sim_->get_pc() -
- 2 * Instruction::kInstrSize;
+ intptr_t stop_pc = sim_->get_pc() - 2 * kInstrSize;
Instruction* stop_instr = reinterpret_cast<Instruction*>(stop_pc);
Instruction* msg_address =
- reinterpret_cast<Instruction*>(stop_pc +
- Instruction::kInstrSize);
+ reinterpret_cast<Instruction*>(stop_pc + kInstrSize);
if ((argc == 2) && (strcmp(arg1, "unstop") == 0)) {
// Remove the current stop.
if (sim_->IsStopInstruction(stop_instr)) {
@@ -696,20 +694,20 @@ void MipsDebugger::Debug() {
if (argc == 1) {
cur = reinterpret_cast<byte*>(sim_->get_pc());
- end = cur + (10 * Instruction::kInstrSize);
+ end = cur + (10 * kInstrSize);
} else if (argc == 2) {
int32_t value;
if (GetValue(arg1, &value)) {
cur = reinterpret_cast<byte*>(value);
// no length parameter passed, assume 10 instructions
- end = cur + (10 * Instruction::kInstrSize);
+ end = cur + (10 * kInstrSize);
}
} else {
int32_t value1;
int32_t value2;
if (GetValue(arg1, &value1) && GetValue(arg2, &value2)) {
cur = reinterpret_cast<byte*>(value1);
- end = cur + (value2 * Instruction::kInstrSize);
+ end = cur + (value2 * kInstrSize);
}
}
@@ -717,7 +715,7 @@ void MipsDebugger::Debug() {
dasm.InstructionDecode(buffer, cur);
PrintF(" 0x%08" PRIxPTR " %s\n", reinterpret_cast<intptr_t>(cur),
buffer.start());
- cur += Instruction::kInstrSize;
+ cur += kInstrSize;
}
} else if ((strcmp(cmd, "h") == 0) || (strcmp(cmd, "help") == 0)) {
PrintF("cont\n");
@@ -871,8 +869,7 @@ void Simulator::CheckICache(base::CustomMatcherHashMap* i_cache,
if (cache_hit) {
// Check that the data in memory matches the contents of the I-cache.
CHECK_EQ(0, memcmp(reinterpret_cast<void*>(instr),
- cache_page->CachedData(offset),
- Instruction::kInstrSize));
+ cache_page->CachedData(offset), kInstrSize));
} else {
// Cache miss. Load memory into the cache.
memcpy(cached_line, line, CachePage::kLineLength);
@@ -3797,7 +3794,7 @@ void Simulator::DecodeTypeRegisterSPECIAL() {
int32_t next_pc = rs();
int32_t current_pc = get_pc();
Instruction* branch_delay_instr =
- reinterpret_cast<Instruction*>(current_pc + Instruction::kInstrSize);
+ reinterpret_cast<Instruction*>(current_pc + kInstrSize);
BranchDelayInstructionDecode(branch_delay_instr);
set_pc(next_pc);
pc_modified_ = true;
@@ -3808,9 +3805,9 @@ void Simulator::DecodeTypeRegisterSPECIAL() {
int32_t return_addr_reg = rd_reg();
int32_t current_pc = get_pc();
Instruction* branch_delay_instr =
- reinterpret_cast<Instruction*>(current_pc + Instruction::kInstrSize);
+ reinterpret_cast<Instruction*>(current_pc + kInstrSize);
BranchDelayInstructionDecode(branch_delay_instr);
- set_register(return_addr_reg, current_pc + 2 * Instruction::kInstrSize);
+ set_register(return_addr_reg, current_pc + 2 * kInstrSize);
set_pc(next_pc);
pc_modified_ = true;
break;
@@ -6304,12 +6301,12 @@ void Simulator::DecodeTypeImmediate() {
[this, &next_pc, &execute_branch_delay_instruction](bool do_branch) {
execute_branch_delay_instruction = true;
int32_t current_pc = get_pc();
+ set_register(31, current_pc + 2 * kInstrSize);
if (do_branch) {
int16_t imm16 = this->instr_.Imm16Value();
- next_pc = current_pc + (imm16 << 2) + Instruction::kInstrSize;
- set_register(31, current_pc + 2 * Instruction::kInstrSize);
+ next_pc = current_pc + (imm16 << 2) + kInstrSize;
} else {
- next_pc = current_pc + 2 * Instruction::kInstrSize;
+ next_pc = current_pc + 2 * kInstrSize;
}
};
@@ -6319,9 +6316,9 @@ void Simulator::DecodeTypeImmediate() {
int32_t current_pc = get_pc();
if (do_branch) {
int16_t imm16 = this->instr_.Imm16Value();
- next_pc = current_pc + (imm16 << 2) + Instruction::kInstrSize;
+ next_pc = current_pc + (imm16 << 2) + kInstrSize;
} else {
- next_pc = current_pc + 2 * Instruction::kInstrSize;
+ next_pc = current_pc + 2 * kInstrSize;
}
};
@@ -6343,9 +6340,9 @@ void Simulator::DecodeTypeImmediate() {
// pc + kInstrSize + 511 * kInstrSize]
int16_t offset = static_cast<int16_t>(imm16 << (bitsIn16Int - 10)) >>
(bitsIn16Int - 12);
- next_pc = current_pc + offset + Instruction::kInstrSize;
+ next_pc = current_pc + offset + kInstrSize;
} else {
- next_pc = current_pc + 2 * Instruction::kInstrSize;
+ next_pc = current_pc + 2 * kInstrSize;
}
};
@@ -6356,8 +6353,8 @@ void Simulator::DecodeTypeImmediate() {
int32_t imm = this->instr_.ImmValue(bits);
imm <<= 32 - bits;
imm >>= 32 - bits;
- next_pc = current_pc + (imm << 2) + Instruction::kInstrSize;
- set_register(31, current_pc + Instruction::kInstrSize);
+ next_pc = current_pc + (imm << 2) + kInstrSize;
+ set_register(31, current_pc + kInstrSize);
}
};
@@ -6368,7 +6365,7 @@ void Simulator::DecodeTypeImmediate() {
int32_t imm = this->instr_.ImmValue(bits);
imm <<= 32 - bits;
imm >>= 32 - bits;
- next_pc = get_pc() + (imm << 2) + Instruction::kInstrSize;
+ next_pc = get_pc() + (imm << 2) + kInstrSize;
}
};
@@ -6568,7 +6565,7 @@ void Simulator::DecodeTypeImmediate() {
if (rs_reg != 0) { // BNEZC
BranchCompactHelper(rs != 0, 21);
} else { // JIALC
- set_register(31, get_pc() + Instruction::kInstrSize);
+ set_register(31, get_pc() + kInstrSize);
next_pc = rt + imm16;
}
break;
@@ -6864,7 +6861,7 @@ void Simulator::DecodeTypeImmediate() {
// We don't check for end_sim_pc. First it should not be met as the current
// pc is valid. Secondly a jump should always execute its branch delay slot.
Instruction* branch_delay_instr =
- reinterpret_cast<Instruction*>(get_pc() + Instruction::kInstrSize);
+ reinterpret_cast<Instruction*>(get_pc() + kInstrSize);
BranchDelayInstructionDecode(branch_delay_instr);
}
@@ -6890,13 +6887,13 @@ void Simulator::DecodeTypeJump() {
// We don't check for end_sim_pc. First it should not be met as the current pc
// is valid. Secondly a jump should always execute its branch delay slot.
Instruction* branch_delay_instr =
- reinterpret_cast<Instruction*>(current_pc + Instruction::kInstrSize);
+ reinterpret_cast<Instruction*>(current_pc + kInstrSize);
BranchDelayInstructionDecode(branch_delay_instr);
// Update pc and ra if necessary.
// Do this after the branch delay execution.
if (simInstr.IsLinkingInstruction()) {
- set_register(31, current_pc + 2 * Instruction::kInstrSize);
+ set_register(31, current_pc + 2 * kInstrSize);
}
set_pc(next_pc);
pc_modified_ = true;
@@ -6937,13 +6934,10 @@ void Simulator::InstructionDecode(Instruction* instr) {
trace_buf_.start());
}
if (!pc_modified_) {
- set_register(pc, reinterpret_cast<int32_t>(instr) +
- Instruction::kInstrSize);
+ set_register(pc, reinterpret_cast<int32_t>(instr) + kInstrSize);
}
}
-
-
void Simulator::Execute() {
// Get the PC to simulate. Cannot use the accessor here as we need the
// raw PC value and not the one used as input to arithmetic instructions.