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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 : mode_(kFlags_branch), | 318 : mode_(kFlags_branch), |
319 condition_(condition), | 319 condition_(condition), |
320 true_block_(true_block), | 320 true_block_(true_block), |
321 false_block_(false_block) { | 321 false_block_(false_block) { |
322 DCHECK_NOT_NULL(true_block); | 322 DCHECK_NOT_NULL(true_block); |
323 DCHECK_NOT_NULL(false_block); | 323 DCHECK_NOT_NULL(false_block); |
324 } | 324 } |
325 | 325 |
326 // Creates a new flags continuation for an eager deoptimization exit. | 326 // Creates a new flags continuation for an eager deoptimization exit. |
327 static FlagsContinuation ForDeoptimize(FlagsCondition condition, | 327 static FlagsContinuation ForDeoptimize(FlagsCondition condition, |
| 328 DeoptimizeReason reason, |
328 Node* frame_state) { | 329 Node* frame_state) { |
329 return FlagsContinuation(kFlags_deoptimize, condition, frame_state); | 330 return FlagsContinuation(condition, reason, frame_state); |
330 } | 331 } |
331 | 332 |
332 // Creates a new flags continuation for a boolean value. | 333 // Creates a new flags continuation for a boolean value. |
333 static FlagsContinuation ForSet(FlagsCondition condition, Node* result) { | 334 static FlagsContinuation ForSet(FlagsCondition condition, Node* result) { |
334 return FlagsContinuation(kFlags_set, condition, result); | 335 return FlagsContinuation(condition, result); |
335 } | 336 } |
336 | 337 |
337 bool IsNone() const { return mode_ == kFlags_none; } | 338 bool IsNone() const { return mode_ == kFlags_none; } |
338 bool IsBranch() const { return mode_ == kFlags_branch; } | 339 bool IsBranch() const { return mode_ == kFlags_branch; } |
339 bool IsDeoptimize() const { return mode_ == kFlags_deoptimize; } | 340 bool IsDeoptimize() const { return mode_ == kFlags_deoptimize; } |
340 bool IsSet() const { return mode_ == kFlags_set; } | 341 bool IsSet() const { return mode_ == kFlags_set; } |
341 FlagsCondition condition() const { | 342 FlagsCondition condition() const { |
342 DCHECK(!IsNone()); | 343 DCHECK(!IsNone()); |
343 return condition_; | 344 return condition_; |
344 } | 345 } |
| 346 DeoptimizeReason reason() const { |
| 347 DCHECK(IsDeoptimize()); |
| 348 return reason_; |
| 349 } |
345 Node* frame_state() const { | 350 Node* frame_state() const { |
346 DCHECK(IsDeoptimize()); | 351 DCHECK(IsDeoptimize()); |
347 return frame_state_or_result_; | 352 return frame_state_or_result_; |
348 } | 353 } |
349 Node* result() const { | 354 Node* result() const { |
350 DCHECK(IsSet()); | 355 DCHECK(IsSet()); |
351 return frame_state_or_result_; | 356 return frame_state_or_result_; |
352 } | 357 } |
353 BasicBlock* true_block() const { | 358 BasicBlock* true_block() const { |
354 DCHECK(IsBranch()); | 359 DCHECK(IsBranch()); |
(...skipping 25 matching lines...) Expand all Loading... |
380 // Encodes this flags continuation into the given opcode. | 385 // Encodes this flags continuation into the given opcode. |
381 InstructionCode Encode(InstructionCode opcode) { | 386 InstructionCode Encode(InstructionCode opcode) { |
382 opcode |= FlagsModeField::encode(mode_); | 387 opcode |= FlagsModeField::encode(mode_); |
383 if (mode_ != kFlags_none) { | 388 if (mode_ != kFlags_none) { |
384 opcode |= FlagsConditionField::encode(condition_); | 389 opcode |= FlagsConditionField::encode(condition_); |
385 } | 390 } |
386 return opcode; | 391 return opcode; |
387 } | 392 } |
388 | 393 |
389 private: | 394 private: |
390 FlagsContinuation(FlagsMode mode, FlagsCondition condition, | 395 FlagsContinuation(FlagsCondition condition, DeoptimizeReason reason, |
391 Node* frame_state_or_result) | 396 Node* frame_state) |
392 : mode_(mode), | 397 : mode_(kFlags_deoptimize), |
393 condition_(condition), | 398 condition_(condition), |
394 frame_state_or_result_(frame_state_or_result) { | 399 reason_(reason), |
395 DCHECK_NOT_NULL(frame_state_or_result); | 400 frame_state_or_result_(frame_state) { |
| 401 DCHECK_NOT_NULL(frame_state); |
| 402 } |
| 403 FlagsContinuation(FlagsCondition condition, Node* result) |
| 404 : mode_(kFlags_set), |
| 405 condition_(condition), |
| 406 frame_state_or_result_(result) { |
| 407 DCHECK_NOT_NULL(result); |
396 } | 408 } |
397 | 409 |
398 FlagsMode const mode_; | 410 FlagsMode const mode_; |
399 FlagsCondition condition_; | 411 FlagsCondition condition_; |
| 412 DeoptimizeReason reason_; // Only value if mode_ == kFlags_deoptimize |
400 Node* frame_state_or_result_; // Only valid if mode_ == kFlags_deoptimize | 413 Node* frame_state_or_result_; // Only valid if mode_ == kFlags_deoptimize |
401 // or mode_ == kFlags_set. | 414 // or mode_ == kFlags_set. |
402 BasicBlock* true_block_; // Only valid if mode_ == kFlags_branch. | 415 BasicBlock* true_block_; // Only valid if mode_ == kFlags_branch. |
403 BasicBlock* false_block_; // Only valid if mode_ == kFlags_branch. | 416 BasicBlock* false_block_; // Only valid if mode_ == kFlags_branch. |
404 }; | 417 }; |
405 | 418 |
406 } // namespace compiler | 419 } // namespace compiler |
407 } // namespace internal | 420 } // namespace internal |
408 } // namespace v8 | 421 } // namespace v8 |
409 | 422 |
410 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ | 423 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ |
OLD | NEW |