| 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/generic-node-inl.h" | 8 #include "src/compiler/generic-node-inl.h" |
| 9 #include "src/compiler/instruction.h" | 9 #include "src/compiler/instruction.h" |
| 10 #include "src/compiler/instruction-selector.h" | 10 #include "src/compiler/instruction-selector.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 } | 39 } |
| 40 | 40 |
| 41 InstructionOperand* DefineAsFixed(Node* node, DoubleRegister reg) { | 41 InstructionOperand* DefineAsFixed(Node* node, DoubleRegister reg) { |
| 42 return Define(node, new (zone()) | 42 return Define(node, new (zone()) |
| 43 UnallocatedOperand(UnallocatedOperand::FIXED_DOUBLE_REGISTER, | 43 UnallocatedOperand(UnallocatedOperand::FIXED_DOUBLE_REGISTER, |
| 44 DoubleRegister::ToAllocationIndex(reg))); | 44 DoubleRegister::ToAllocationIndex(reg))); |
| 45 } | 45 } |
| 46 | 46 |
| 47 InstructionOperand* DefineAsConstant(Node* node) { | 47 InstructionOperand* DefineAsConstant(Node* node) { |
| 48 selector()->MarkAsDefined(node); | 48 selector()->MarkAsDefined(node); |
| 49 int virtual_register = sequence()->AddConstant(node, ToConstant(node)); | 49 int virtual_register = selector_->GetVirtualRegister(node); |
| 50 sequence()->AddConstant(virtual_register, ToConstant(node)); |
| 50 return ConstantOperand::Create(virtual_register, zone()); | 51 return ConstantOperand::Create(virtual_register, zone()); |
| 51 } | 52 } |
| 52 | 53 |
| 53 InstructionOperand* DefineAsLocation(Node* node, LinkageLocation location, | 54 InstructionOperand* DefineAsLocation(Node* node, LinkageLocation location, |
| 54 MachineType type) { | 55 MachineType type) { |
| 55 return Define(node, ToUnallocatedOperand(location, type)); | 56 return Define(node, ToUnallocatedOperand(location, type)); |
| 56 } | 57 } |
| 57 | 58 |
| 58 InstructionOperand* Use(Node* node) { | 59 InstructionOperand* Use(Node* node) { |
| 59 return Use( | 60 return Use( |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 default: | 166 default: |
| 166 break; | 167 break; |
| 167 } | 168 } |
| 168 UNREACHABLE(); | 169 UNREACHABLE(); |
| 169 return Constant(static_cast<int32_t>(0)); | 170 return Constant(static_cast<int32_t>(0)); |
| 170 } | 171 } |
| 171 | 172 |
| 172 UnallocatedOperand* Define(Node* node, UnallocatedOperand* operand) { | 173 UnallocatedOperand* Define(Node* node, UnallocatedOperand* operand) { |
| 173 DCHECK_NOT_NULL(node); | 174 DCHECK_NOT_NULL(node); |
| 174 DCHECK_NOT_NULL(operand); | 175 DCHECK_NOT_NULL(operand); |
| 175 operand->set_virtual_register( | 176 operand->set_virtual_register(selector_->GetVirtualRegister(node)); |
| 176 selector_->sequence()->GetVirtualRegister(node)); | |
| 177 selector()->MarkAsDefined(node); | 177 selector()->MarkAsDefined(node); |
| 178 return operand; | 178 return operand; |
| 179 } | 179 } |
| 180 | 180 |
| 181 UnallocatedOperand* Use(Node* node, UnallocatedOperand* operand) { | 181 UnallocatedOperand* Use(Node* node, UnallocatedOperand* operand) { |
| 182 DCHECK_NOT_NULL(node); | 182 DCHECK_NOT_NULL(node); |
| 183 DCHECK_NOT_NULL(operand); | 183 DCHECK_NOT_NULL(operand); |
| 184 operand->set_virtual_register( | 184 operand->set_virtual_register(selector_->GetVirtualRegister(node)); |
| 185 selector_->sequence()->GetVirtualRegister(node)); | |
| 186 selector()->MarkAsUsed(node); | 185 selector()->MarkAsUsed(node); |
| 187 return operand; | 186 return operand; |
| 188 } | 187 } |
| 189 | 188 |
| 190 UnallocatedOperand* ToUnallocatedOperand(LinkageLocation location, | 189 UnallocatedOperand* ToUnallocatedOperand(LinkageLocation location, |
| 191 MachineType type) { | 190 MachineType type) { |
| 192 if (location.location_ == LinkageLocation::ANY_REGISTER) { | 191 if (location.location_ == LinkageLocation::ANY_REGISTER) { |
| 193 return new (zone()) | 192 return new (zone()) |
| 194 UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER); | 193 UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER); |
| 195 } | 194 } |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 : (frame_state_descriptor->GetTotalSize() + | 361 : (frame_state_descriptor->GetTotalSize() + |
| 363 1); // Include deopt id. | 362 1); // Include deopt id. |
| 364 } | 363 } |
| 365 }; | 364 }; |
| 366 | 365 |
| 367 } // namespace compiler | 366 } // namespace compiler |
| 368 } // namespace internal | 367 } // namespace internal |
| 369 } // namespace v8 | 368 } // namespace v8 |
| 370 | 369 |
| 371 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ | 370 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ |
| OLD | NEW |