| 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-selector.h" | 8 #include "src/compiler/instruction-selector.h" |
| 9 #include "src/compiler/instruction.h" | 9 #include "src/compiler/instruction.h" |
| 10 #include "src/compiler/linkage.h" | 10 #include "src/compiler/linkage.h" |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 : mode_(kFlags_branch), | 343 : mode_(kFlags_branch), |
| 344 condition_(condition), | 344 condition_(condition), |
| 345 true_block_(true_block), | 345 true_block_(true_block), |
| 346 false_block_(false_block) { | 346 false_block_(false_block) { |
| 347 DCHECK_NOT_NULL(true_block); | 347 DCHECK_NOT_NULL(true_block); |
| 348 DCHECK_NOT_NULL(false_block); | 348 DCHECK_NOT_NULL(false_block); |
| 349 } | 349 } |
| 350 | 350 |
| 351 // Creates a new flags continuation for an eager deoptimization exit. | 351 // Creates a new flags continuation for an eager deoptimization exit. |
| 352 static FlagsContinuation ForDeoptimize(FlagsCondition condition, | 352 static FlagsContinuation ForDeoptimize(FlagsCondition condition, |
| 353 DeoptimizeKind kind, |
| 353 DeoptimizeReason reason, | 354 DeoptimizeReason reason, |
| 354 Node* frame_state) { | 355 Node* frame_state) { |
| 355 return FlagsContinuation(condition, reason, frame_state); | 356 return FlagsContinuation(condition, kind, reason, frame_state); |
| 356 } | 357 } |
| 357 | 358 |
| 358 // Creates a new flags continuation for a boolean value. | 359 // Creates a new flags continuation for a boolean value. |
| 359 static FlagsContinuation ForSet(FlagsCondition condition, Node* result) { | 360 static FlagsContinuation ForSet(FlagsCondition condition, Node* result) { |
| 360 return FlagsContinuation(condition, result); | 361 return FlagsContinuation(condition, result); |
| 361 } | 362 } |
| 362 | 363 |
| 363 // Creates a new flags continuation for a wasm trap. | 364 // Creates a new flags continuation for a wasm trap. |
| 364 static FlagsContinuation ForTrap(FlagsCondition condition, | 365 static FlagsContinuation ForTrap(FlagsCondition condition, |
| 365 Runtime::FunctionId trap_id, Node* result) { | 366 Runtime::FunctionId trap_id, Node* result) { |
| 366 return FlagsContinuation(condition, trap_id, result); | 367 return FlagsContinuation(condition, trap_id, result); |
| 367 } | 368 } |
| 368 | 369 |
| 369 bool IsNone() const { return mode_ == kFlags_none; } | 370 bool IsNone() const { return mode_ == kFlags_none; } |
| 370 bool IsBranch() const { return mode_ == kFlags_branch; } | 371 bool IsBranch() const { return mode_ == kFlags_branch; } |
| 371 bool IsDeoptimize() const { return mode_ == kFlags_deoptimize; } | 372 bool IsDeoptimize() const { return mode_ == kFlags_deoptimize; } |
| 372 bool IsSet() const { return mode_ == kFlags_set; } | 373 bool IsSet() const { return mode_ == kFlags_set; } |
| 373 bool IsTrap() const { return mode_ == kFlags_trap; } | 374 bool IsTrap() const { return mode_ == kFlags_trap; } |
| 374 FlagsCondition condition() const { | 375 FlagsCondition condition() const { |
| 375 DCHECK(!IsNone()); | 376 DCHECK(!IsNone()); |
| 376 return condition_; | 377 return condition_; |
| 377 } | 378 } |
| 379 DeoptimizeKind kind() const { |
| 380 DCHECK(IsDeoptimize()); |
| 381 return kind_; |
| 382 } |
| 378 DeoptimizeReason reason() const { | 383 DeoptimizeReason reason() const { |
| 379 DCHECK(IsDeoptimize()); | 384 DCHECK(IsDeoptimize()); |
| 380 return reason_; | 385 return reason_; |
| 381 } | 386 } |
| 382 Node* frame_state() const { | 387 Node* frame_state() const { |
| 383 DCHECK(IsDeoptimize()); | 388 DCHECK(IsDeoptimize()); |
| 384 return frame_state_or_result_; | 389 return frame_state_or_result_; |
| 385 } | 390 } |
| 386 Node* result() const { | 391 Node* result() const { |
| 387 DCHECK(IsSet()); | 392 DCHECK(IsSet()); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 // Encodes this flags continuation into the given opcode. | 446 // Encodes this flags continuation into the given opcode. |
| 442 InstructionCode Encode(InstructionCode opcode) { | 447 InstructionCode Encode(InstructionCode opcode) { |
| 443 opcode |= FlagsModeField::encode(mode_); | 448 opcode |= FlagsModeField::encode(mode_); |
| 444 if (mode_ != kFlags_none) { | 449 if (mode_ != kFlags_none) { |
| 445 opcode |= FlagsConditionField::encode(condition_); | 450 opcode |= FlagsConditionField::encode(condition_); |
| 446 } | 451 } |
| 447 return opcode; | 452 return opcode; |
| 448 } | 453 } |
| 449 | 454 |
| 450 private: | 455 private: |
| 451 FlagsContinuation(FlagsCondition condition, DeoptimizeReason reason, | 456 FlagsContinuation(FlagsCondition condition, DeoptimizeKind kind, |
| 452 Node* frame_state) | 457 DeoptimizeReason reason, Node* frame_state) |
| 453 : mode_(kFlags_deoptimize), | 458 : mode_(kFlags_deoptimize), |
| 454 condition_(condition), | 459 condition_(condition), |
| 460 kind_(kind), |
| 455 reason_(reason), | 461 reason_(reason), |
| 456 frame_state_or_result_(frame_state) { | 462 frame_state_or_result_(frame_state) { |
| 457 DCHECK_NOT_NULL(frame_state); | 463 DCHECK_NOT_NULL(frame_state); |
| 458 } | 464 } |
| 459 FlagsContinuation(FlagsCondition condition, Node* result) | 465 FlagsContinuation(FlagsCondition condition, Node* result) |
| 460 : mode_(kFlags_set), | 466 : mode_(kFlags_set), |
| 461 condition_(condition), | 467 condition_(condition), |
| 462 frame_state_or_result_(result) { | 468 frame_state_or_result_(result) { |
| 463 DCHECK_NOT_NULL(result); | 469 DCHECK_NOT_NULL(result); |
| 464 } | 470 } |
| 465 | 471 |
| 466 FlagsContinuation(FlagsCondition condition, Runtime::FunctionId trap_id, | 472 FlagsContinuation(FlagsCondition condition, Runtime::FunctionId trap_id, |
| 467 Node* result) | 473 Node* result) |
| 468 : mode_(kFlags_trap), | 474 : mode_(kFlags_trap), |
| 469 condition_(condition), | 475 condition_(condition), |
| 470 frame_state_or_result_(result), | 476 frame_state_or_result_(result), |
| 471 trap_id_(trap_id) { | 477 trap_id_(trap_id) { |
| 472 DCHECK_NOT_NULL(result); | 478 DCHECK_NOT_NULL(result); |
| 473 } | 479 } |
| 474 | 480 |
| 475 FlagsMode const mode_; | 481 FlagsMode const mode_; |
| 476 FlagsCondition condition_; | 482 FlagsCondition condition_; |
| 477 DeoptimizeReason reason_; // Only value if mode_ == kFlags_deoptimize | 483 DeoptimizeKind kind_; // Only valid if mode_ == kFlags_deoptimize |
| 484 DeoptimizeReason reason_; // Only valid if mode_ == kFlags_deoptimize |
| 478 Node* frame_state_or_result_; // Only valid if mode_ == kFlags_deoptimize | 485 Node* frame_state_or_result_; // Only valid if mode_ == kFlags_deoptimize |
| 479 // or mode_ == kFlags_set. | 486 // or mode_ == kFlags_set. |
| 480 BasicBlock* true_block_; // Only valid if mode_ == kFlags_branch. | 487 BasicBlock* true_block_; // Only valid if mode_ == kFlags_branch. |
| 481 BasicBlock* false_block_; // Only valid if mode_ == kFlags_branch. | 488 BasicBlock* false_block_; // Only valid if mode_ == kFlags_branch. |
| 482 Runtime::FunctionId trap_id_; // Only valid if mode_ == kFlags_trap. | 489 Runtime::FunctionId trap_id_; // Only valid if mode_ == kFlags_trap. |
| 483 }; | 490 }; |
| 484 | 491 |
| 485 } // namespace compiler | 492 } // namespace compiler |
| 486 } // namespace internal | 493 } // namespace internal |
| 487 } // namespace v8 | 494 } // namespace v8 |
| 488 | 495 |
| 489 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ | 496 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ |
| OLD | NEW |