| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef V8_COMPILER_CODE_GENERATOR_IMPL_H_ | 5 #ifndef V8_COMPILER_CODE_GENERATOR_IMPL_H_ |
| 6 #define V8_COMPILER_CODE_GENERATOR_IMPL_H_ | 6 #define V8_COMPILER_CODE_GENERATOR_IMPL_H_ |
| 7 | 7 |
| 8 #include "src/compiler/code-generator.h" | 8 #include "src/compiler/code-generator.h" |
| 9 #include "src/compiler/common-operator.h" | 9 #include "src/compiler/common-operator.h" |
| 10 #include "src/compiler/generic-graph.h" | 10 #include "src/compiler/generic-graph.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 return ToHeapObject(instr_->InputAt(index)); | 60 return ToHeapObject(instr_->InputAt(index)); |
| 61 } | 61 } |
| 62 | 62 |
| 63 Label* InputLabel(int index) { | 63 Label* InputLabel(int index) { |
| 64 return gen_->code()->GetLabel(InputBlock(index)); | 64 return gen_->code()->GetLabel(InputBlock(index)); |
| 65 } | 65 } |
| 66 | 66 |
| 67 BasicBlock* InputBlock(int index) { | 67 BasicBlock* InputBlock(int index) { |
| 68 NodeId block_id = static_cast<NodeId>(instr_->InputAt(index)->index()); | 68 NodeId block_id = static_cast<NodeId>(instr_->InputAt(index)->index()); |
| 69 // operand should be a block id. | 69 // operand should be a block id. |
| 70 ASSERT(block_id >= 0); | 70 DCHECK(block_id >= 0); |
| 71 ASSERT(block_id < gen_->schedule()->BasicBlockCount()); | 71 DCHECK(block_id < gen_->schedule()->BasicBlockCount()); |
| 72 return gen_->schedule()->GetBlockById(block_id); | 72 return gen_->schedule()->GetBlockById(block_id); |
| 73 } | 73 } |
| 74 | 74 |
| 75 Register OutputRegister(int index = 0) { | 75 Register OutputRegister(int index = 0) { |
| 76 return ToRegister(instr_->OutputAt(index)); | 76 return ToRegister(instr_->OutputAt(index)); |
| 77 } | 77 } |
| 78 | 78 |
| 79 DoubleRegister OutputDoubleRegister() { | 79 DoubleRegister OutputDoubleRegister() { |
| 80 return ToDoubleRegister(instr_->Output()); | 80 return ToDoubleRegister(instr_->Output()); |
| 81 } | 81 } |
| 82 | 82 |
| 83 Register TempRegister(int index) { return ToRegister(instr_->TempAt(index)); } | 83 Register TempRegister(int index) { return ToRegister(instr_->TempAt(index)); } |
| 84 | 84 |
| 85 Register ToRegister(InstructionOperand* op) { | 85 Register ToRegister(InstructionOperand* op) { |
| 86 ASSERT(op->IsRegister()); | 86 DCHECK(op->IsRegister()); |
| 87 return Register::FromAllocationIndex(op->index()); | 87 return Register::FromAllocationIndex(op->index()); |
| 88 } | 88 } |
| 89 | 89 |
| 90 DoubleRegister ToDoubleRegister(InstructionOperand* op) { | 90 DoubleRegister ToDoubleRegister(InstructionOperand* op) { |
| 91 ASSERT(op->IsDoubleRegister()); | 91 DCHECK(op->IsDoubleRegister()); |
| 92 return DoubleRegister::FromAllocationIndex(op->index()); | 92 return DoubleRegister::FromAllocationIndex(op->index()); |
| 93 } | 93 } |
| 94 | 94 |
| 95 Constant ToConstant(InstructionOperand* operand) { | 95 Constant ToConstant(InstructionOperand* operand) { |
| 96 if (operand->IsImmediate()) { | 96 if (operand->IsImmediate()) { |
| 97 return gen_->code()->GetImmediate(operand->index()); | 97 return gen_->code()->GetImmediate(operand->index()); |
| 98 } | 98 } |
| 99 return gen_->code()->GetConstant(operand->index()); | 99 return gen_->code()->GetConstant(operand->index()); |
| 100 } | 100 } |
| 101 | 101 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 123 #if V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_ARM | 123 #if V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_ARM |
| 124 masm->CheckConstPool(true, false); | 124 masm->CheckConstPool(true, false); |
| 125 #endif | 125 #endif |
| 126 } | 126 } |
| 127 | 127 |
| 128 } // namespace compiler | 128 } // namespace compiler |
| 129 } // namespace internal | 129 } // namespace internal |
| 130 } // namespace v8 | 130 } // namespace v8 |
| 131 | 131 |
| 132 #endif // V8_COMPILER_CODE_GENERATOR_IMPL_H | 132 #endif // V8_COMPILER_CODE_GENERATOR_IMPL_H |
| OLD | NEW |