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 27 matching lines...) Expand all Loading... |
38 } | 38 } |
39 | 39 |
40 InstructionOperand* DefineAsFixed(Node* node, DoubleRegister reg) { | 40 InstructionOperand* DefineAsFixed(Node* node, DoubleRegister reg) { |
41 return Define(node, new (zone()) | 41 return Define(node, new (zone()) |
42 UnallocatedOperand(UnallocatedOperand::FIXED_DOUBLE_REGISTER, | 42 UnallocatedOperand(UnallocatedOperand::FIXED_DOUBLE_REGISTER, |
43 DoubleRegister::ToAllocationIndex(reg))); | 43 DoubleRegister::ToAllocationIndex(reg))); |
44 } | 44 } |
45 | 45 |
46 InstructionOperand* DefineAsConstant(Node* node) { | 46 InstructionOperand* DefineAsConstant(Node* node) { |
47 selector()->MarkAsDefined(node); | 47 selector()->MarkAsDefined(node); |
48 sequence()->AddConstant(node->id(), ToConstant(node)); | 48 int virtual_register = sequence()->AddConstant(node, ToConstant(node)); |
49 return ConstantOperand::Create(node->id(), zone()); | 49 return ConstantOperand::Create(virtual_register, zone()); |
50 } | 50 } |
51 | 51 |
52 InstructionOperand* DefineAsLocation(Node* node, LinkageLocation location, | 52 InstructionOperand* DefineAsLocation(Node* node, LinkageLocation location, |
53 MachineType type) { | 53 MachineType type) { |
54 return Define(node, ToUnallocatedOperand(location, type)); | 54 return Define(node, ToUnallocatedOperand(location, type)); |
55 } | 55 } |
56 | 56 |
57 InstructionOperand* Use(Node* node) { | 57 InstructionOperand* Use(Node* node) { |
58 return Use(node, | 58 return Use(node, |
59 new (zone()) UnallocatedOperand( | 59 new (zone()) UnallocatedOperand( |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 default: | 159 default: |
160 break; | 160 break; |
161 } | 161 } |
162 UNREACHABLE(); | 162 UNREACHABLE(); |
163 return Constant(static_cast<int32_t>(0)); | 163 return Constant(static_cast<int32_t>(0)); |
164 } | 164 } |
165 | 165 |
166 UnallocatedOperand* Define(Node* node, UnallocatedOperand* operand) { | 166 UnallocatedOperand* Define(Node* node, UnallocatedOperand* operand) { |
167 DCHECK_NOT_NULL(node); | 167 DCHECK_NOT_NULL(node); |
168 DCHECK_NOT_NULL(operand); | 168 DCHECK_NOT_NULL(operand); |
169 operand->set_virtual_register(node->id()); | 169 operand->set_virtual_register( |
| 170 selector_->sequence()->GetVirtualRegister(node)); |
170 selector()->MarkAsDefined(node); | 171 selector()->MarkAsDefined(node); |
171 return operand; | 172 return operand; |
172 } | 173 } |
173 | 174 |
174 UnallocatedOperand* Use(Node* node, UnallocatedOperand* operand) { | 175 UnallocatedOperand* Use(Node* node, UnallocatedOperand* operand) { |
175 DCHECK_NOT_NULL(node); | 176 DCHECK_NOT_NULL(node); |
176 DCHECK_NOT_NULL(operand); | 177 DCHECK_NOT_NULL(operand); |
177 operand->set_virtual_register(node->id()); | 178 operand->set_virtual_register( |
| 179 selector_->sequence()->GetVirtualRegister(node)); |
178 selector()->MarkAsUsed(node); | 180 selector()->MarkAsUsed(node); |
179 return operand; | 181 return operand; |
180 } | 182 } |
181 | 183 |
182 UnallocatedOperand* ToUnallocatedOperand(LinkageLocation location, | 184 UnallocatedOperand* ToUnallocatedOperand(LinkageLocation location, |
183 MachineType type) { | 185 MachineType type) { |
184 if (location.location_ == LinkageLocation::ANY_REGISTER) { | 186 if (location.location_ == LinkageLocation::ANY_REGISTER) { |
185 return new (zone()) | 187 return new (zone()) |
186 UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER); | 188 UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER); |
187 } | 189 } |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 : (frame_state_descriptor->GetTotalSize() + | 356 : (frame_state_descriptor->GetTotalSize() + |
355 1); // Include deopt id. | 357 1); // Include deopt id. |
356 } | 358 } |
357 }; | 359 }; |
358 | 360 |
359 } // namespace compiler | 361 } // namespace compiler |
360 } // namespace internal | 362 } // namespace internal |
361 } // namespace v8 | 363 } // namespace v8 |
362 | 364 |
363 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ | 365 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ |
OLD | NEW |