Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: src/compiler/common-operator.cc

Issue 2683203002: Revert of [compiler] Pass deoptimization_kind through DeoptimizeParameters and FlagsContinuation (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/common-operator.h ('k') | src/compiler/common-operator-reducer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "src/compiler/common-operator.h" 5 #include "src/compiler/common-operator.h"
6 6
7 #include "src/assembler.h" 7 #include "src/assembler.h"
8 #include "src/base/lazy-instance.h" 8 #include "src/base/lazy-instance.h"
9 #include "src/compiler/linkage.h" 9 #include "src/compiler/linkage.h"
10 #include "src/compiler/node.h" 10 #include "src/compiler/node.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 return OpParameter<DeoptimizeReason>(op); 43 return OpParameter<DeoptimizeReason>(op);
44 } 44 }
45 45
46 int ValueInputCountOfReturn(Operator const* const op) { 46 int ValueInputCountOfReturn(Operator const* const op) {
47 DCHECK(op->opcode() == IrOpcode::kReturn); 47 DCHECK(op->opcode() == IrOpcode::kReturn);
48 // Return nodes have a hidden input at index 0 which we ignore in the value 48 // Return nodes have a hidden input at index 0 which we ignore in the value
49 // input count. 49 // input count.
50 return op->ValueInputCount() - 1; 50 return op->ValueInputCount() - 1;
51 } 51 }
52 52
53 size_t hash_value(DeoptimizeKind kind) { return static_cast<size_t>(kind); }
54
55 std::ostream& operator<<(std::ostream& os, DeoptimizeKind kind) {
56 switch (kind) {
57 case DeoptimizeKind::kEager:
58 return os << "Eager";
59 case DeoptimizeKind::kSoft:
60 return os << "Soft";
61 }
62 UNREACHABLE();
63 return os;
64 }
65
53 bool operator==(DeoptimizeParameters lhs, DeoptimizeParameters rhs) { 66 bool operator==(DeoptimizeParameters lhs, DeoptimizeParameters rhs) {
54 return lhs.kind() == rhs.kind() && lhs.reason() == rhs.reason(); 67 return lhs.kind() == rhs.kind() && lhs.reason() == rhs.reason();
55 } 68 }
56 69
57 bool operator!=(DeoptimizeParameters lhs, DeoptimizeParameters rhs) { 70 bool operator!=(DeoptimizeParameters lhs, DeoptimizeParameters rhs) {
58 return !(lhs == rhs); 71 return !(lhs == rhs);
59 } 72 }
60 73
61 size_t hash_value(DeoptimizeParameters p) { 74 size_t hash_value(DeoptimizeParameters p) {
62 return base::hash_combine(p.kind(), p.reason()); 75 return base::hash_combine(p.kind(), p.reason());
63 } 76 }
64 77
65 std::ostream& operator<<(std::ostream& os, DeoptimizeParameters p) { 78 std::ostream& operator<<(std::ostream& os, DeoptimizeParameters p) {
66 return os << p.kind() << ":" << p.reason(); 79 return os << p.kind() << ":" << p.reason();
67 } 80 }
68 81
69 DeoptimizeParameters const& DeoptimizeParametersOf(Operator const* const op) { 82 DeoptimizeParameters const& DeoptimizeParametersOf(Operator const* const op) {
70 DCHECK(op->opcode() == IrOpcode::kDeoptimize || 83 DCHECK_EQ(IrOpcode::kDeoptimize, op->opcode());
71 op->opcode() == IrOpcode::kDeoptimizeIf ||
72 op->opcode() == IrOpcode::kDeoptimizeUnless);
73 return OpParameter<DeoptimizeParameters>(op); 84 return OpParameter<DeoptimizeParameters>(op);
74 } 85 }
75 86
76 87
77 bool operator==(SelectParameters const& lhs, SelectParameters const& rhs) { 88 bool operator==(SelectParameters const& lhs, SelectParameters const& rhs) {
78 return lhs.representation() == rhs.representation() && 89 return lhs.representation() == rhs.representation() &&
79 lhs.hint() == rhs.hint(); 90 lhs.hint() == rhs.hint();
80 } 91 }
81 92
82 93
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 V(8) 429 V(8)
419 430
420 #define CACHED_DEOPTIMIZE_LIST(V) \ 431 #define CACHED_DEOPTIMIZE_LIST(V) \
421 V(Eager, MinusZero) \ 432 V(Eager, MinusZero) \
422 V(Eager, NoReason) \ 433 V(Eager, NoReason) \
423 V(Eager, WrongMap) \ 434 V(Eager, WrongMap) \
424 V(Soft, InsufficientTypeFeedbackForGenericKeyedAccess) \ 435 V(Soft, InsufficientTypeFeedbackForGenericKeyedAccess) \
425 V(Soft, InsufficientTypeFeedbackForGenericNamedAccess) 436 V(Soft, InsufficientTypeFeedbackForGenericNamedAccess)
426 437
427 #define CACHED_DEOPTIMIZE_IF_LIST(V) \ 438 #define CACHED_DEOPTIMIZE_IF_LIST(V) \
428 V(Eager, DivisionByZero) \ 439 V(DivisionByZero) \
429 V(Eager, Hole) \ 440 V(Hole) \
430 V(Eager, MinusZero) \ 441 V(MinusZero) \
431 V(Eager, Overflow) \ 442 V(Overflow) \
432 V(Eager, Smi) 443 V(Smi)
433 444
434 #define CACHED_DEOPTIMIZE_UNLESS_LIST(V) \ 445 #define CACHED_DEOPTIMIZE_UNLESS_LIST(V) \
435 V(Eager, LostPrecision) \ 446 V(LostPrecision) \
436 V(Eager, LostPrecisionOrNaN) \ 447 V(LostPrecisionOrNaN) \
437 V(Eager, NoReason) \ 448 V(NoReason) \
438 V(Eager, NotAHeapNumber) \ 449 V(NotAHeapNumber) \
439 V(Eager, NotANumberOrOddball) \ 450 V(NotANumberOrOddball) \
440 V(Eager, NotASmi) \ 451 V(NotASmi) \
441 V(Eager, OutOfBounds) \ 452 V(OutOfBounds) \
442 V(Eager, WrongInstanceType) \ 453 V(WrongInstanceType) \
443 V(Eager, WrongMap) 454 V(WrongMap)
444 455
445 #define CACHED_TRAP_IF_LIST(V) \ 456 #define CACHED_TRAP_IF_LIST(V) \
446 V(TrapDivUnrepresentable) \ 457 V(TrapDivUnrepresentable) \
447 V(TrapFloatUnrepresentable) 458 V(TrapFloatUnrepresentable)
448 459
449 // The reason for a trap. 460 // The reason for a trap.
450 #define CACHED_TRAP_UNLESS_LIST(V) \ 461 #define CACHED_TRAP_UNLESS_LIST(V) \
451 V(TrapUnreachable) \ 462 V(TrapUnreachable) \
452 V(TrapMemOutOfBounds) \ 463 V(TrapMemOutOfBounds) \
453 V(TrapDivByZero) \ 464 V(TrapDivByZero) \
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 "Deoptimize", // name 628 "Deoptimize", // name
618 1, 1, 1, 0, 0, 1, // counts 629 1, 1, 1, 0, 0, 1, // counts
619 DeoptimizeParameters(kKind, kReason)) {} // parameter 630 DeoptimizeParameters(kKind, kReason)) {} // parameter
620 }; 631 };
621 #define CACHED_DEOPTIMIZE(Kind, Reason) \ 632 #define CACHED_DEOPTIMIZE(Kind, Reason) \
622 DeoptimizeOperator<DeoptimizeKind::k##Kind, DeoptimizeReason::k##Reason> \ 633 DeoptimizeOperator<DeoptimizeKind::k##Kind, DeoptimizeReason::k##Reason> \
623 kDeoptimize##Kind##Reason##Operator; 634 kDeoptimize##Kind##Reason##Operator;
624 CACHED_DEOPTIMIZE_LIST(CACHED_DEOPTIMIZE) 635 CACHED_DEOPTIMIZE_LIST(CACHED_DEOPTIMIZE)
625 #undef CACHED_DEOPTIMIZE 636 #undef CACHED_DEOPTIMIZE
626 637
627 template <DeoptimizeKind kKind, DeoptimizeReason kReason> 638 template <DeoptimizeReason kReason>
628 struct DeoptimizeIfOperator final : public Operator1<DeoptimizeParameters> { 639 struct DeoptimizeIfOperator final : public Operator1<DeoptimizeReason> {
629 DeoptimizeIfOperator() 640 DeoptimizeIfOperator()
630 : Operator1<DeoptimizeParameters>( // -- 641 : Operator1<DeoptimizeReason>( // --
631 IrOpcode::kDeoptimizeIf, // opcode 642 IrOpcode::kDeoptimizeIf, // opcode
632 Operator::kFoldable | Operator::kNoThrow, // properties 643 Operator::kFoldable | Operator::kNoThrow, // properties
633 "DeoptimizeIf", // name 644 "DeoptimizeIf", // name
634 2, 1, 1, 0, 1, 1, // counts 645 2, 1, 1, 0, 1, 1, // counts
635 DeoptimizeParameters(kKind, kReason)) {} // parameter 646 kReason) {} // parameter
636 }; 647 };
637 #define CACHED_DEOPTIMIZE_IF(Kind, Reason) \ 648 #define CACHED_DEOPTIMIZE_IF(Reason) \
638 DeoptimizeIfOperator<DeoptimizeKind::k##Kind, DeoptimizeReason::k##Reason> \ 649 DeoptimizeIfOperator<DeoptimizeReason::k##Reason> \
639 kDeoptimizeIf##Kind##Reason##Operator; 650 kDeoptimizeIf##Reason##Operator;
640 CACHED_DEOPTIMIZE_IF_LIST(CACHED_DEOPTIMIZE_IF) 651 CACHED_DEOPTIMIZE_IF_LIST(CACHED_DEOPTIMIZE_IF)
641 #undef CACHED_DEOPTIMIZE_IF 652 #undef CACHED_DEOPTIMIZE_IF
642 653
643 template <DeoptimizeKind kKind, DeoptimizeReason kReason> 654 template <DeoptimizeReason kReason>
644 struct DeoptimizeUnlessOperator final 655 struct DeoptimizeUnlessOperator final : public Operator1<DeoptimizeReason> {
645 : public Operator1<DeoptimizeParameters> {
646 DeoptimizeUnlessOperator() 656 DeoptimizeUnlessOperator()
647 : Operator1<DeoptimizeParameters>( // -- 657 : Operator1<DeoptimizeReason>( // --
648 IrOpcode::kDeoptimizeUnless, // opcode 658 IrOpcode::kDeoptimizeUnless, // opcode
649 Operator::kFoldable | Operator::kNoThrow, // properties 659 Operator::kFoldable | Operator::kNoThrow, // properties
650 "DeoptimizeUnless", // name 660 "DeoptimizeUnless", // name
651 2, 1, 1, 0, 1, 1, // counts 661 2, 1, 1, 0, 1, 1, // counts
652 DeoptimizeParameters(kKind, kReason)) {} // parameter 662 kReason) {} // parameter
653 }; 663 };
654 #define CACHED_DEOPTIMIZE_UNLESS(Kind, Reason) \ 664 #define CACHED_DEOPTIMIZE_UNLESS(Reason) \
655 DeoptimizeUnlessOperator<DeoptimizeKind::k##Kind, \ 665 DeoptimizeUnlessOperator<DeoptimizeReason::k##Reason> \
656 DeoptimizeReason::k##Reason> \ 666 kDeoptimizeUnless##Reason##Operator;
657 kDeoptimizeUnless##Kind##Reason##Operator;
658 CACHED_DEOPTIMIZE_UNLESS_LIST(CACHED_DEOPTIMIZE_UNLESS) 667 CACHED_DEOPTIMIZE_UNLESS_LIST(CACHED_DEOPTIMIZE_UNLESS)
659 #undef CACHED_DEOPTIMIZE_UNLESS 668 #undef CACHED_DEOPTIMIZE_UNLESS
660 669
661 template <int32_t trap_id> 670 template <int32_t trap_id>
662 struct TrapIfOperator final : public Operator1<int32_t> { 671 struct TrapIfOperator final : public Operator1<int32_t> {
663 TrapIfOperator() 672 TrapIfOperator()
664 : Operator1<int32_t>( // -- 673 : Operator1<int32_t>( // --
665 IrOpcode::kTrapIf, // opcode 674 IrOpcode::kTrapIf, // opcode
666 Operator::kFoldable | Operator::kNoThrow, // properties 675 Operator::kFoldable | Operator::kNoThrow, // properties
667 "TrapIf", // name 676 "TrapIf", // name
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
843 // Uncached 852 // Uncached
844 DeoptimizeParameters parameter(kind, reason); 853 DeoptimizeParameters parameter(kind, reason);
845 return new (zone()) Operator1<DeoptimizeParameters>( // -- 854 return new (zone()) Operator1<DeoptimizeParameters>( // --
846 IrOpcode::kDeoptimize, // opcodes 855 IrOpcode::kDeoptimize, // opcodes
847 Operator::kFoldable | Operator::kNoThrow, // properties 856 Operator::kFoldable | Operator::kNoThrow, // properties
848 "Deoptimize", // name 857 "Deoptimize", // name
849 1, 1, 1, 0, 0, 1, // counts 858 1, 1, 1, 0, 0, 1, // counts
850 parameter); // parameter 859 parameter); // parameter
851 } 860 }
852 861
853 const Operator* CommonOperatorBuilder::DeoptimizeIf(DeoptimizeKind kind, 862 const Operator* CommonOperatorBuilder::DeoptimizeIf(DeoptimizeReason reason) {
854 DeoptimizeReason reason) { 863 switch (reason) {
855 #define CACHED_DEOPTIMIZE_IF(Kind, Reason) \ 864 #define CACHED_DEOPTIMIZE_IF(Reason) \
856 if (kind == DeoptimizeKind::k##Kind && \ 865 case DeoptimizeReason::k##Reason: \
857 reason == DeoptimizeReason::k##Reason) { \ 866 return &cache_.kDeoptimizeIf##Reason##Operator;
858 return &cache_.kDeoptimizeIf##Kind##Reason##Operator; \ 867 CACHED_DEOPTIMIZE_IF_LIST(CACHED_DEOPTIMIZE_IF)
868 #undef CACHED_DEOPTIMIZE_IF
869 default:
870 break;
859 } 871 }
860 CACHED_DEOPTIMIZE_IF_LIST(CACHED_DEOPTIMIZE_IF)
861 #undef CACHED_DEOPTIMIZE_IF
862 // Uncached 872 // Uncached
863 DeoptimizeParameters parameter(kind, reason); 873 return new (zone()) Operator1<DeoptimizeReason>( // --
864 return new (zone()) Operator1<DeoptimizeParameters>( // -- 874 IrOpcode::kDeoptimizeIf, // opcode
865 IrOpcode::kDeoptimizeIf, // opcode 875 Operator::kFoldable | Operator::kNoThrow, // properties
866 Operator::kFoldable | Operator::kNoThrow, // properties 876 "DeoptimizeIf", // name
867 "DeoptimizeIf", // name 877 2, 1, 1, 0, 1, 1, // counts
868 2, 1, 1, 0, 1, 1, // counts 878 reason); // parameter
869 parameter); // parameter
870 } 879 }
871 880
872 const Operator* CommonOperatorBuilder::DeoptimizeUnless( 881 const Operator* CommonOperatorBuilder::DeoptimizeUnless(
873 DeoptimizeKind kind, DeoptimizeReason reason) { 882 DeoptimizeReason reason) {
874 #define CACHED_DEOPTIMIZE_UNLESS(Kind, Reason) \ 883 switch (reason) {
875 if (kind == DeoptimizeKind::k##Kind && \ 884 #define CACHED_DEOPTIMIZE_UNLESS(Reason) \
876 reason == DeoptimizeReason::k##Reason) { \ 885 case DeoptimizeReason::k##Reason: \
877 return &cache_.kDeoptimizeUnless##Kind##Reason##Operator; \ 886 return &cache_.kDeoptimizeUnless##Reason##Operator;
887 CACHED_DEOPTIMIZE_UNLESS_LIST(CACHED_DEOPTIMIZE_UNLESS)
888 #undef CACHED_DEOPTIMIZE_UNLESS
889 default:
890 break;
878 } 891 }
879 CACHED_DEOPTIMIZE_UNLESS_LIST(CACHED_DEOPTIMIZE_UNLESS)
880 #undef CACHED_DEOPTIMIZE_UNLESS
881 // Uncached 892 // Uncached
882 DeoptimizeParameters parameter(kind, reason); 893 return new (zone()) Operator1<DeoptimizeReason>( // --
883 return new (zone()) Operator1<DeoptimizeParameters>( // -- 894 IrOpcode::kDeoptimizeUnless, // opcode
884 IrOpcode::kDeoptimizeUnless, // opcode 895 Operator::kFoldable | Operator::kNoThrow, // properties
885 Operator::kFoldable | Operator::kNoThrow, // properties 896 "DeoptimizeUnless", // name
886 "DeoptimizeUnless", // name 897 2, 1, 1, 0, 1, 1, // counts
887 2, 1, 1, 0, 1, 1, // counts 898 reason); // parameter
888 parameter); // parameter
889 } 899 }
890 900
891 const Operator* CommonOperatorBuilder::TrapIf(int32_t trap_id) { 901 const Operator* CommonOperatorBuilder::TrapIf(int32_t trap_id) {
892 switch (trap_id) { 902 switch (trap_id) {
893 #define CACHED_TRAP_IF(Trap) \ 903 #define CACHED_TRAP_IF(Trap) \
894 case Runtime::kThrowWasm##Trap: \ 904 case Runtime::kThrowWasm##Trap: \
895 return &cache_.kTrapIf##Trap##Operator; 905 return &cache_.kTrapIf##Trap##Operator;
896 CACHED_TRAP_IF_LIST(CACHED_TRAP_IF) 906 CACHED_TRAP_IF_LIST(CACHED_TRAP_IF)
897 #undef CACHED_TRAP_IF 907 #undef CACHED_TRAP_IF
898 default: 908 default:
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
1354 CommonOperatorBuilder::CreateFrameStateFunctionInfo( 1364 CommonOperatorBuilder::CreateFrameStateFunctionInfo(
1355 FrameStateType type, int parameter_count, int local_count, 1365 FrameStateType type, int parameter_count, int local_count,
1356 Handle<SharedFunctionInfo> shared_info) { 1366 Handle<SharedFunctionInfo> shared_info) {
1357 return new (zone()->New(sizeof(FrameStateFunctionInfo))) 1367 return new (zone()->New(sizeof(FrameStateFunctionInfo)))
1358 FrameStateFunctionInfo(type, parameter_count, local_count, shared_info); 1368 FrameStateFunctionInfo(type, parameter_count, local_count, shared_info);
1359 } 1369 }
1360 1370
1361 } // namespace compiler 1371 } // namespace compiler
1362 } // namespace internal 1372 } // namespace internal
1363 } // namespace v8 1373 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/common-operator.h ('k') | src/compiler/common-operator-reducer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698