Chromium Code Reviews| Index: src/interpreter/bytecode-register-optimizer.cc |
| diff --git a/src/interpreter/bytecode-register-optimizer.cc b/src/interpreter/bytecode-register-optimizer.cc |
| index 563956e5c613456cbd5a9a8e1e0e48e627deaccf..6006c25363578fff84a8e262b1b7fe568d81d2b3 100644 |
| --- a/src/interpreter/bytecode-register-optimizer.cc |
| +++ b/src/interpreter/bytecode-register-optimizer.cc |
| @@ -265,16 +265,22 @@ void BytecodeRegisterOptimizer::OutputRegisterTransfer( |
| if (input == accumulator_) { |
| uint32_t operand = static_cast<uint32_t>(output.ToOperand()); |
| - BytecodeNode node(Bytecode::kStar, operand, source_info); |
| + BytecodeNode node = |
| + BytecodeNode::Create<Bytecode::kStar, OperandType::kRegOut>( |
|
Leszek Swirski
2016/12/05 10:57:42
This seems error prone -- would it be worth having
rmcilroy
2016/12/09 09:21:05
Good idea, done (as differently named functions ra
|
| + operand, source_info); |
| next_stage_->Write(&node); |
| } else if (output == accumulator_) { |
| uint32_t operand = static_cast<uint32_t>(input.ToOperand()); |
| - BytecodeNode node(Bytecode::kLdar, operand, source_info); |
| + BytecodeNode node = |
| + BytecodeNode::Create<Bytecode::kLdar, OperandType::kReg>(operand, |
| + source_info); |
| next_stage_->Write(&node); |
| } else { |
| uint32_t operand0 = static_cast<uint32_t>(input.ToOperand()); |
| uint32_t operand1 = static_cast<uint32_t>(output.ToOperand()); |
| - BytecodeNode node(Bytecode::kMov, operand0, operand1, source_info); |
| + BytecodeNode node = BytecodeNode::Create<Bytecode::kMov, OperandType::kReg, |
| + OperandType::kRegOut>( |
| + operand0, operand1, source_info); |
| next_stage_->Write(&node); |
| } |
| if (output != accumulator_) { |
| @@ -365,7 +371,7 @@ void BytecodeRegisterOptimizer::RegisterTransfer( |
| void BytecodeRegisterOptimizer::EmitNopForSourceInfo( |
| BytecodeSourceInfo source_info) const { |
| DCHECK(source_info.is_valid()); |
| - BytecodeNode nop(Bytecode::kNop, source_info); |
| + BytecodeNode nop = BytecodeNode::Create<Bytecode::kNop>(source_info); |
| next_stage_->Write(&nop); |
| } |
| @@ -416,32 +422,6 @@ RegisterList BytecodeRegisterOptimizer::GetInputRegisterList( |
| } |
| } |
| -void BytecodeRegisterOptimizer::PrepareForBytecode(Bytecode bytecode) { |
| - if (Bytecodes::IsJump(bytecode) || bytecode == Bytecode::kDebugger || |
| - bytecode == Bytecode::kSuspendGenerator) { |
| - // All state must be flushed before emitting |
| - // - a jump bytecode (as the register equivalents at the jump target aren't |
| - // known. |
| - // - a call to the debugger (as it can manipulate locals and parameters), |
| - // - a generator suspend (as this involves saving all registers). |
| - Flush(); |
| - } |
| - |
| - // Materialize the accumulator if it is read by the bytecode. The |
| - // accumulator is special and no other register can be materialized |
| - // in it's place. |
| - if (Bytecodes::ReadsAccumulator(bytecode) && |
| - !accumulator_info_->materialized()) { |
| - Materialize(accumulator_info_); |
| - } |
| - |
| - // Materialize an equivalent to the accumulator if it will be |
| - // clobbered when the bytecode is dispatched. |
| - if (Bytecodes::WritesAccumulator(bytecode)) { |
| - PrepareOutputRegister(accumulator_); |
| - } |
| -} |
| - |
| void BytecodeRegisterOptimizer::GrowRegisterMap(Register reg) { |
| DCHECK(RegisterIsTemporary(reg)); |
| size_t index = GetRegisterInfoTableIndex(reg); |