| 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/code-stubs.h" | 8 #include "src/code-stubs.h" |
| 9 #include "src/compiler/code-generator.h" | 9 #include "src/compiler/code-generator.h" |
| 10 #include "src/compiler/instruction.h" | 10 #include "src/compiler/instruction.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 | 83 |
| 84 Label* ToLabel(InstructionOperand* op) { | 84 Label* ToLabel(InstructionOperand* op) { |
| 85 return gen_->GetLabel(ToRpoNumber(op)); | 85 return gen_->GetLabel(ToRpoNumber(op)); |
| 86 } | 86 } |
| 87 | 87 |
| 88 RpoNumber ToRpoNumber(InstructionOperand* op) { | 88 RpoNumber ToRpoNumber(InstructionOperand* op) { |
| 89 return ToConstant(op).ToRpoNumber(); | 89 return ToConstant(op).ToRpoNumber(); |
| 90 } | 90 } |
| 91 | 91 |
| 92 Register ToRegister(InstructionOperand* op) { | 92 Register ToRegister(InstructionOperand* op) { |
| 93 DCHECK(op->IsRegister()); | 93 return Register::FromAllocationIndex(RegisterOperand::cast(op)->index()); |
| 94 return Register::FromAllocationIndex(op->index()); | |
| 95 } | 94 } |
| 96 | 95 |
| 97 DoubleRegister ToDoubleRegister(InstructionOperand* op) { | 96 DoubleRegister ToDoubleRegister(InstructionOperand* op) { |
| 98 DCHECK(op->IsDoubleRegister()); | 97 return DoubleRegister::FromAllocationIndex( |
| 99 return DoubleRegister::FromAllocationIndex(op->index()); | 98 DoubleRegisterOperand::cast(op)->index()); |
| 100 } | 99 } |
| 101 | 100 |
| 102 Constant ToConstant(InstructionOperand* op) { | 101 Constant ToConstant(InstructionOperand* op) { |
| 103 if (op->IsImmediate()) { | 102 if (op->IsImmediate()) { |
| 104 return gen_->code()->GetImmediate(op->index()); | 103 return gen_->code()->GetImmediate(ImmediateOperand::cast(op)->index()); |
| 105 } | 104 } |
| 106 return gen_->code()->GetConstant(op->index()); | 105 return gen_->code()->GetConstant( |
| 106 ConstantOperand::cast(op)->virtual_register()); |
| 107 } | 107 } |
| 108 | 108 |
| 109 double ToDouble(InstructionOperand* op) { return ToConstant(op).ToFloat64(); } | 109 double ToDouble(InstructionOperand* op) { return ToConstant(op).ToFloat64(); } |
| 110 | 110 |
| 111 Handle<HeapObject> ToHeapObject(InstructionOperand* op) { | 111 Handle<HeapObject> ToHeapObject(InstructionOperand* op) { |
| 112 return ToConstant(op).ToHeapObject(); | 112 return ToConstant(op).ToHeapObject(); |
| 113 } | 113 } |
| 114 | 114 |
| 115 Frame* frame() const { return gen_->frame(); } | 115 Frame* frame() const { return gen_->frame(); } |
| 116 Isolate* isolate() const { return gen_->isolate(); } | 116 Isolate* isolate() const { return gen_->isolate(); } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 #elif V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X64 | 151 #elif V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X64 |
| 152 masm->ud2(); | 152 masm->ud2(); |
| 153 #endif | 153 #endif |
| 154 } | 154 } |
| 155 | 155 |
| 156 } // namespace compiler | 156 } // namespace compiler |
| 157 } // namespace internal | 157 } // namespace internal |
| 158 } // namespace v8 | 158 } // namespace v8 |
| 159 | 159 |
| 160 #endif // V8_COMPILER_CODE_GENERATOR_IMPL_H | 160 #endif // V8_COMPILER_CODE_GENERATOR_IMPL_H |
| OLD | NEW |