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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 BasicBlock* false_block) | 252 BasicBlock* false_block) |
253 : mode_(kFlags_branch), | 253 : mode_(kFlags_branch), |
254 condition_(condition), | 254 condition_(condition), |
255 true_block_(true_block), | 255 true_block_(true_block), |
256 false_block_(false_block) { | 256 false_block_(false_block) { |
257 DCHECK_NOT_NULL(true_block); | 257 DCHECK_NOT_NULL(true_block); |
258 DCHECK_NOT_NULL(false_block); | 258 DCHECK_NOT_NULL(false_block); |
259 } | 259 } |
260 | 260 |
261 // Creates a new flags continuation from the given condition and result node. | 261 // Creates a new flags continuation from the given condition and result node. |
262 FlagsContinuation(FlagsCondition condition, Node* result) | 262 FlagsContinuation(FlagsCondition condition, Node* result, |
263 : mode_(kFlags_set), condition_(condition), result_(result) { | 263 FlagsMode mode = kFlags_set) |
| 264 : mode_(mode), condition_(condition), result_(result) { |
264 DCHECK_NOT_NULL(result); | 265 DCHECK_NOT_NULL(result); |
265 } | 266 } |
266 | 267 |
267 bool IsNone() const { return mode_ == kFlags_none; } | 268 bool IsNone() const { return mode_ == kFlags_none; } |
268 bool IsBranch() const { return mode_ == kFlags_branch; } | 269 bool IsBranch() const { return mode_ == kFlags_branch; } |
269 bool IsSet() const { return mode_ == kFlags_set; } | 270 bool IsSet() const { return mode_ == kFlags_set; } |
| 271 bool IsSelect() const { return mode_ == kFlags_select; } |
270 FlagsCondition condition() const { | 272 FlagsCondition condition() const { |
271 DCHECK(!IsNone()); | 273 DCHECK(!IsNone()); |
272 return condition_; | 274 return condition_; |
273 } | 275 } |
274 Node* result() const { | 276 Node* result() const { |
275 DCHECK(IsSet()); | 277 DCHECK(IsSet() || IsSelect()); |
276 return result_; | 278 return result_; |
277 } | 279 } |
278 BasicBlock* true_block() const { | 280 BasicBlock* true_block() const { |
279 DCHECK(IsBranch()); | 281 DCHECK(IsBranch()); |
280 return true_block_; | 282 return true_block_; |
281 } | 283 } |
282 BasicBlock* false_block() const { | 284 BasicBlock* false_block() const { |
283 DCHECK(IsBranch()); | 285 DCHECK(IsBranch()); |
284 return false_block_; | 286 return false_block_; |
285 } | 287 } |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 opcode |= FlagsModeField::encode(mode_); | 341 opcode |= FlagsModeField::encode(mode_); |
340 if (mode_ != kFlags_none) { | 342 if (mode_ != kFlags_none) { |
341 opcode |= FlagsConditionField::encode(condition_); | 343 opcode |= FlagsConditionField::encode(condition_); |
342 } | 344 } |
343 return opcode; | 345 return opcode; |
344 } | 346 } |
345 | 347 |
346 private: | 348 private: |
347 FlagsMode mode_; | 349 FlagsMode mode_; |
348 FlagsCondition condition_; | 350 FlagsCondition condition_; |
349 Node* result_; // Only valid if mode_ == kFlags_set. | 351 Node* result_; // Valid if mode_ == kFlags_set or kFlags_select. |
350 BasicBlock* true_block_; // Only valid if mode_ == kFlags_branch. | 352 BasicBlock* true_block_; // Valid if mode_ == kFlags_branch. |
351 BasicBlock* false_block_; // Only valid if mode_ == kFlags_branch. | 353 BasicBlock* false_block_; // Valid if mode_ == kFlags_branch. |
352 }; | 354 }; |
353 | 355 |
354 | 356 |
355 // An internal helper class for generating the operands to calls. | 357 // An internal helper class for generating the operands to calls. |
356 // TODO(bmeurer): Get rid of the CallBuffer business and make | 358 // TODO(bmeurer): Get rid of the CallBuffer business and make |
357 // InstructionSelector::VisitCall platform independent instead. | 359 // InstructionSelector::VisitCall platform independent instead. |
358 struct CallBuffer { | 360 struct CallBuffer { |
359 CallBuffer(Zone* zone, const CallDescriptor* descriptor, | 361 CallBuffer(Zone* zone, const CallDescriptor* descriptor, |
360 FrameStateDescriptor* frame_state); | 362 FrameStateDescriptor* frame_state); |
361 | 363 |
(...skipping 14 matching lines...) Expand all Loading... |
376 : (frame_state_descriptor->GetTotalSize() + | 378 : (frame_state_descriptor->GetTotalSize() + |
377 1); // Include deopt id. | 379 1); // Include deopt id. |
378 } | 380 } |
379 }; | 381 }; |
380 | 382 |
381 } // namespace compiler | 383 } // namespace compiler |
382 } // namespace internal | 384 } // namespace internal |
383 } // namespace v8 | 385 } // namespace v8 |
384 | 386 |
385 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ | 387 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ |
OLD | NEW |