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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 case IrOpcode::kHeapConstant: | 162 case IrOpcode::kHeapConstant: |
163 return Constant(OpParameter<Unique<HeapObject> >(node).handle()); | 163 return Constant(OpParameter<Unique<HeapObject> >(node).handle()); |
164 default: | 164 default: |
165 break; | 165 break; |
166 } | 166 } |
167 UNREACHABLE(); | 167 UNREACHABLE(); |
168 return Constant(static_cast<int32_t>(0)); | 168 return Constant(static_cast<int32_t>(0)); |
169 } | 169 } |
170 | 170 |
171 UnallocatedOperand* Define(Node* node, UnallocatedOperand* operand) { | 171 UnallocatedOperand* Define(Node* node, UnallocatedOperand* operand) { |
172 DCHECK_NOT_NULL(node); | 172 DCHECK(node); |
173 DCHECK_NOT_NULL(operand); | 173 DCHECK(operand); |
174 operand->set_virtual_register(selector_->GetVirtualRegister(node)); | 174 operand->set_virtual_register(selector_->GetVirtualRegister(node)); |
175 selector()->MarkAsDefined(node); | 175 selector()->MarkAsDefined(node); |
176 return operand; | 176 return operand; |
177 } | 177 } |
178 | 178 |
179 UnallocatedOperand* Use(Node* node, UnallocatedOperand* operand) { | 179 UnallocatedOperand* Use(Node* node, UnallocatedOperand* operand) { |
180 DCHECK_NOT_NULL(node); | 180 DCHECK(node); |
181 DCHECK_NOT_NULL(operand); | 181 DCHECK(operand); |
182 operand->set_virtual_register(selector_->GetVirtualRegister(node)); | 182 operand->set_virtual_register(selector_->GetVirtualRegister(node)); |
183 selector()->MarkAsUsed(node); | 183 selector()->MarkAsUsed(node); |
184 return operand; | 184 return operand; |
185 } | 185 } |
186 | 186 |
187 UnallocatedOperand* ToUnallocatedOperand(LinkageLocation location, | 187 UnallocatedOperand* ToUnallocatedOperand(LinkageLocation location, |
188 MachineType type) { | 188 MachineType type) { |
189 if (location.location_ == LinkageLocation::ANY_REGISTER) { | 189 if (location.location_ == LinkageLocation::ANY_REGISTER) { |
190 // any machine register. | 190 // any machine register. |
191 return new (zone()) | 191 return new (zone()) |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 FlagsContinuation() : mode_(kFlags_none) {} | 225 FlagsContinuation() : mode_(kFlags_none) {} |
226 | 226 |
227 // Creates a new flags continuation from the given condition and true/false | 227 // Creates a new flags continuation from the given condition and true/false |
228 // blocks. | 228 // blocks. |
229 FlagsContinuation(FlagsCondition condition, BasicBlock* true_block, | 229 FlagsContinuation(FlagsCondition condition, BasicBlock* true_block, |
230 BasicBlock* false_block) | 230 BasicBlock* false_block) |
231 : mode_(kFlags_branch), | 231 : mode_(kFlags_branch), |
232 condition_(condition), | 232 condition_(condition), |
233 true_block_(true_block), | 233 true_block_(true_block), |
234 false_block_(false_block) { | 234 false_block_(false_block) { |
235 DCHECK_NOT_NULL(true_block); | 235 DCHECK(true_block); |
236 DCHECK_NOT_NULL(false_block); | 236 DCHECK(false_block); |
237 } | 237 } |
238 | 238 |
239 // Creates a new flags continuation from the given condition and result node. | 239 // Creates a new flags continuation from the given condition and result node. |
240 FlagsContinuation(FlagsCondition condition, Node* result) | 240 FlagsContinuation(FlagsCondition condition, Node* result) |
241 : mode_(kFlags_set), condition_(condition), result_(result) { | 241 : mode_(kFlags_set), condition_(condition), result_(result) { |
242 DCHECK_NOT_NULL(result); | 242 DCHECK(result); |
243 } | 243 } |
244 | 244 |
245 bool IsNone() const { return mode_ == kFlags_none; } | 245 bool IsNone() const { return mode_ == kFlags_none; } |
246 bool IsBranch() const { return mode_ == kFlags_branch; } | 246 bool IsBranch() const { return mode_ == kFlags_branch; } |
247 bool IsSet() const { return mode_ == kFlags_set; } | 247 bool IsSet() const { return mode_ == kFlags_set; } |
248 FlagsCondition condition() const { | 248 FlagsCondition condition() const { |
249 DCHECK(!IsNone()); | 249 DCHECK(!IsNone()); |
250 return condition_; | 250 return condition_; |
251 } | 251 } |
252 Node* result() const { | 252 Node* result() const { |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 : (frame_state_descriptor->GetTotalSize() + | 354 : (frame_state_descriptor->GetTotalSize() + |
355 1); // Include deopt id. | 355 1); // Include deopt id. |
356 } | 356 } |
357 }; | 357 }; |
358 | 358 |
359 } // namespace compiler | 359 } // namespace compiler |
360 } // namespace internal | 360 } // namespace internal |
361 } // namespace v8 | 361 } // namespace v8 |
362 | 362 |
363 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ | 363 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ |
OLD | NEW |