Index: src/compiler/code-generator-impl.h |
diff --git a/src/compiler/code-generator-impl.h b/src/compiler/code-generator-impl.h |
index 0dc919ad6b30d87742eadf1f2cb05b6498f84b02..914e1e8c91ded126a042422e611c8bdd0b88b546 100644 |
--- a/src/compiler/code-generator-impl.h |
+++ b/src/compiler/code-generator-impl.h |
@@ -25,6 +25,8 @@ class InstructionOperandConverter { |
InstructionOperandConverter(CodeGenerator* gen, Instruction* instr) |
: gen_(gen), instr_(instr) {} |
+ // -- Instruction operand accesses with conversions -------------------------- |
+ |
Register InputRegister(int index) { |
return ToRegister(instr_->InputAt(index)); |
} |
@@ -57,22 +59,31 @@ class InstructionOperandConverter { |
return ToHeapObject(instr_->InputAt(index)); |
} |
- Label* InputLabel(int index) { return gen_->GetLabel(InputRpo(index)); } |
+ Label* InputLabel(int index) { return ToLabel(instr_->InputAt(index)); } |
BasicBlock::RpoNumber InputRpo(int index) { |
- int rpo_number = InputInt32(index); |
- return BasicBlock::RpoNumber::FromInt(rpo_number); |
+ return ToRpoNumber(instr_->InputAt(index)); |
} |
Register OutputRegister(int index = 0) { |
return ToRegister(instr_->OutputAt(index)); |
} |
+ Register TempRegister(int index) { return ToRegister(instr_->TempAt(index)); } |
+ |
DoubleRegister OutputDoubleRegister() { |
return ToDoubleRegister(instr_->Output()); |
} |
- Register TempRegister(int index) { return ToRegister(instr_->TempAt(index)); } |
+ // -- Conversions for operands ----------------------------------------------- |
+ |
+ Label* ToLabel(InstructionOperand* op) { |
+ return gen_->GetLabel(ToRpoNumber(op)); |
+ } |
+ |
+ BasicBlock::RpoNumber ToRpoNumber(InstructionOperand* op) { |
+ return ToConstant(op).ToRpoNumber(); |
+ } |
Register ToRegister(InstructionOperand* op) { |
DCHECK(op->IsRegister()); |
@@ -84,19 +95,17 @@ class InstructionOperandConverter { |
return DoubleRegister::FromAllocationIndex(op->index()); |
} |
- Constant ToConstant(InstructionOperand* operand) { |
- if (operand->IsImmediate()) { |
- return gen_->code()->GetImmediate(operand->index()); |
+ Constant ToConstant(InstructionOperand* op) { |
+ if (op->IsImmediate()) { |
+ return gen_->code()->GetImmediate(op->index()); |
} |
- return gen_->code()->GetConstant(operand->index()); |
+ return gen_->code()->GetConstant(op->index()); |
} |
- double ToDouble(InstructionOperand* operand) { |
- return ToConstant(operand).ToFloat64(); |
- } |
+ double ToDouble(InstructionOperand* op) { return ToConstant(op).ToFloat64(); } |
- Handle<HeapObject> ToHeapObject(InstructionOperand* operand) { |
- return ToConstant(operand).ToHeapObject(); |
+ Handle<HeapObject> ToHeapObject(InstructionOperand* op) { |
+ return ToConstant(op).ToHeapObject(); |
} |
Frame* frame() const { return gen_->frame(); } |