| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_INSTRUCTION_SELECTOR_IMPL_H_ | 5 #ifndef V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ |
| 6 #define V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ | 6 #define V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ |
| 7 | 7 |
| 8 #include "src/compiler/instruction.h" | 8 #include "src/compiler/instruction.h" |
| 9 #include "src/compiler/instruction-selector.h" | 9 #include "src/compiler/instruction-selector.h" |
| 10 #include "src/compiler/linkage.h" | 10 #include "src/compiler/linkage.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 } | 44 } |
| 45 | 45 |
| 46 InstructionOperand DefineSameAsFirst(Node* node) { | 46 InstructionOperand DefineSameAsFirst(Node* node) { |
| 47 return Define(node, | 47 return Define(node, |
| 48 UnallocatedOperand(UnallocatedOperand::SAME_AS_FIRST_INPUT, | 48 UnallocatedOperand(UnallocatedOperand::SAME_AS_FIRST_INPUT, |
| 49 GetVReg(node))); | 49 GetVReg(node))); |
| 50 } | 50 } |
| 51 | 51 |
| 52 InstructionOperand DefineAsFixed(Node* node, Register reg) { | 52 InstructionOperand DefineAsFixed(Node* node, Register reg) { |
| 53 return Define(node, UnallocatedOperand(UnallocatedOperand::FIXED_REGISTER, | 53 return Define(node, UnallocatedOperand(UnallocatedOperand::FIXED_REGISTER, |
| 54 reg.code(), GetVReg(node))); | 54 Register::ToAllocationIndex(reg), |
| 55 GetVReg(node))); |
| 55 } | 56 } |
| 56 | 57 |
| 57 InstructionOperand DefineAsFixed(Node* node, DoubleRegister reg) { | 58 InstructionOperand DefineAsFixed(Node* node, DoubleRegister reg) { |
| 58 return Define(node, | 59 return Define(node, |
| 59 UnallocatedOperand(UnallocatedOperand::FIXED_DOUBLE_REGISTER, | 60 UnallocatedOperand(UnallocatedOperand::FIXED_DOUBLE_REGISTER, |
| 60 reg.code(), GetVReg(node))); | 61 DoubleRegister::ToAllocationIndex(reg), |
| 62 GetVReg(node))); |
| 61 } | 63 } |
| 62 | 64 |
| 63 InstructionOperand DefineAsConstant(Node* node) { | 65 InstructionOperand DefineAsConstant(Node* node) { |
| 64 selector()->MarkAsDefined(node); | 66 selector()->MarkAsDefined(node); |
| 65 int virtual_register = GetVReg(node); | 67 int virtual_register = GetVReg(node); |
| 66 sequence()->AddConstant(virtual_register, ToConstant(node)); | 68 sequence()->AddConstant(virtual_register, ToConstant(node)); |
| 67 return ConstantOperand(virtual_register); | 69 return ConstantOperand(virtual_register); |
| 68 } | 70 } |
| 69 | 71 |
| 70 InstructionOperand DefineAsLocation(Node* node, LinkageLocation location, | 72 InstructionOperand DefineAsLocation(Node* node, LinkageLocation location, |
| (...skipping 27 matching lines...) Expand all Loading... |
| 98 | 100 |
| 99 // Use a unique register for the node that does not alias any temporary or | 101 // Use a unique register for the node that does not alias any temporary or |
| 100 // output registers. | 102 // output registers. |
| 101 InstructionOperand UseUniqueRegister(Node* node) { | 103 InstructionOperand UseUniqueRegister(Node* node) { |
| 102 return Use(node, UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, | 104 return Use(node, UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, |
| 103 GetVReg(node))); | 105 GetVReg(node))); |
| 104 } | 106 } |
| 105 | 107 |
| 106 InstructionOperand UseFixed(Node* node, Register reg) { | 108 InstructionOperand UseFixed(Node* node, Register reg) { |
| 107 return Use(node, UnallocatedOperand(UnallocatedOperand::FIXED_REGISTER, | 109 return Use(node, UnallocatedOperand(UnallocatedOperand::FIXED_REGISTER, |
| 108 reg.code(), GetVReg(node))); | 110 Register::ToAllocationIndex(reg), |
| 111 GetVReg(node))); |
| 109 } | 112 } |
| 110 | 113 |
| 111 InstructionOperand UseFixed(Node* node, DoubleRegister reg) { | 114 InstructionOperand UseFixed(Node* node, DoubleRegister reg) { |
| 112 return Use(node, | 115 return Use(node, |
| 113 UnallocatedOperand(UnallocatedOperand::FIXED_DOUBLE_REGISTER, | 116 UnallocatedOperand(UnallocatedOperand::FIXED_DOUBLE_REGISTER, |
| 114 reg.code(), GetVReg(node))); | 117 DoubleRegister::ToAllocationIndex(reg), |
| 118 GetVReg(node))); |
| 115 } | 119 } |
| 116 | 120 |
| 117 InstructionOperand UseImmediate(Node* node) { | 121 InstructionOperand UseImmediate(Node* node) { |
| 118 return sequence()->AddImmediate(ToConstant(node)); | 122 return sequence()->AddImmediate(ToConstant(node)); |
| 119 } | 123 } |
| 120 | 124 |
| 121 InstructionOperand UseLocation(Node* node, LinkageLocation location, | 125 InstructionOperand UseLocation(Node* node, LinkageLocation location, |
| 122 MachineType type) { | 126 MachineType type) { |
| 123 return Use(node, ToUnallocatedOperand(location, type, GetVReg(node))); | 127 return Use(node, ToUnallocatedOperand(location, type, GetVReg(node))); |
| 124 } | 128 } |
| 125 | 129 |
| 126 InstructionOperand TempRegister() { | 130 InstructionOperand TempRegister() { |
| 127 return UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, | 131 return UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, |
| 128 UnallocatedOperand::USED_AT_START, | 132 UnallocatedOperand::USED_AT_START, |
| 129 sequence()->NextVirtualRegister()); | 133 sequence()->NextVirtualRegister()); |
| 130 } | 134 } |
| 131 | 135 |
| 132 InstructionOperand TempDoubleRegister() { | 136 InstructionOperand TempDoubleRegister() { |
| 133 UnallocatedOperand op = UnallocatedOperand( | 137 UnallocatedOperand op = UnallocatedOperand( |
| 134 UnallocatedOperand::MUST_HAVE_REGISTER, | 138 UnallocatedOperand::MUST_HAVE_REGISTER, |
| 135 UnallocatedOperand::USED_AT_START, sequence()->NextVirtualRegister()); | 139 UnallocatedOperand::USED_AT_START, sequence()->NextVirtualRegister()); |
| 136 sequence()->MarkAsRepresentation(kRepFloat64, op.virtual_register()); | 140 sequence()->MarkAsRepresentation(kRepFloat64, op.virtual_register()); |
| 137 return op; | 141 return op; |
| 138 } | 142 } |
| 139 | 143 |
| 140 InstructionOperand TempRegister(Register reg) { | 144 InstructionOperand TempRegister(Register reg) { |
| 141 return UnallocatedOperand(UnallocatedOperand::FIXED_REGISTER, reg.code(), | 145 return UnallocatedOperand(UnallocatedOperand::FIXED_REGISTER, |
| 146 Register::ToAllocationIndex(reg), |
| 142 InstructionOperand::kInvalidVirtualRegister); | 147 InstructionOperand::kInvalidVirtualRegister); |
| 143 } | 148 } |
| 144 | 149 |
| 145 InstructionOperand TempImmediate(int32_t imm) { | 150 InstructionOperand TempImmediate(int32_t imm) { |
| 146 return sequence()->AddImmediate(Constant(imm)); | 151 return sequence()->AddImmediate(Constant(imm)); |
| 147 } | 152 } |
| 148 | 153 |
| 149 InstructionOperand TempLocation(LinkageLocation location, MachineType type) { | 154 InstructionOperand TempLocation(LinkageLocation location, MachineType type) { |
| 150 return ToUnallocatedOperand(location, type, | 155 return ToUnallocatedOperand(location, type, |
| 151 sequence()->NextVirtualRegister()); | 156 sequence()->NextVirtualRegister()); |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 : (frame_state_descriptor->GetTotalSize() + | 342 : (frame_state_descriptor->GetTotalSize() + |
| 338 1); // Include deopt id. | 343 1); // Include deopt id. |
| 339 } | 344 } |
| 340 }; | 345 }; |
| 341 | 346 |
| 342 } // namespace compiler | 347 } // namespace compiler |
| 343 } // namespace internal | 348 } // namespace internal |
| 344 } // namespace v8 | 349 } // namespace v8 |
| 345 | 350 |
| 346 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ | 351 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ |
| OLD | NEW |