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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/common-operator.cc
diff --git a/src/compiler/common-operator.cc b/src/compiler/common-operator.cc
index 99e53a24abf6dc3c23f23830907ccc81f86c76a2..eb398d4c1ff5354f2e2bc8d3688d9bd98f35620a 100644
--- a/src/compiler/common-operator.cc
+++ b/src/compiler/common-operator.cc
@@ -50,6 +50,19 @@
return op->ValueInputCount() - 1;
}
+size_t hash_value(DeoptimizeKind kind) { return static_cast<size_t>(kind); }
+
+std::ostream& operator<<(std::ostream& os, DeoptimizeKind kind) {
+ switch (kind) {
+ case DeoptimizeKind::kEager:
+ return os << "Eager";
+ case DeoptimizeKind::kSoft:
+ return os << "Soft";
+ }
+ UNREACHABLE();
+ return os;
+}
+
bool operator==(DeoptimizeParameters lhs, DeoptimizeParameters rhs) {
return lhs.kind() == rhs.kind() && lhs.reason() == rhs.reason();
}
@@ -67,9 +80,7 @@
}
DeoptimizeParameters const& DeoptimizeParametersOf(Operator const* const op) {
- DCHECK(op->opcode() == IrOpcode::kDeoptimize ||
- op->opcode() == IrOpcode::kDeoptimizeIf ||
- op->opcode() == IrOpcode::kDeoptimizeUnless);
+ DCHECK_EQ(IrOpcode::kDeoptimize, op->opcode());
return OpParameter<DeoptimizeParameters>(op);
}
@@ -425,22 +436,22 @@
V(Soft, InsufficientTypeFeedbackForGenericNamedAccess)
#define CACHED_DEOPTIMIZE_IF_LIST(V) \
- V(Eager, DivisionByZero) \
- V(Eager, Hole) \
- V(Eager, MinusZero) \
- V(Eager, Overflow) \
- V(Eager, Smi)
+ V(DivisionByZero) \
+ V(Hole) \
+ V(MinusZero) \
+ V(Overflow) \
+ V(Smi)
#define CACHED_DEOPTIMIZE_UNLESS_LIST(V) \
- V(Eager, LostPrecision) \
- V(Eager, LostPrecisionOrNaN) \
- V(Eager, NoReason) \
- V(Eager, NotAHeapNumber) \
- V(Eager, NotANumberOrOddball) \
- V(Eager, NotASmi) \
- V(Eager, OutOfBounds) \
- V(Eager, WrongInstanceType) \
- V(Eager, WrongMap)
+ V(LostPrecision) \
+ V(LostPrecisionOrNaN) \
+ V(NoReason) \
+ V(NotAHeapNumber) \
+ V(NotANumberOrOddball) \
+ V(NotASmi) \
+ V(OutOfBounds) \
+ V(WrongInstanceType) \
+ V(WrongMap)
#define CACHED_TRAP_IF_LIST(V) \
V(TrapDivUnrepresentable) \
@@ -624,37 +635,35 @@
CACHED_DEOPTIMIZE_LIST(CACHED_DEOPTIMIZE)
#undef CACHED_DEOPTIMIZE
- template <DeoptimizeKind kKind, DeoptimizeReason kReason>
- struct DeoptimizeIfOperator final : public Operator1<DeoptimizeParameters> {
+ template <DeoptimizeReason kReason>
+ struct DeoptimizeIfOperator final : public Operator1<DeoptimizeReason> {
DeoptimizeIfOperator()
- : Operator1<DeoptimizeParameters>( // --
+ : Operator1<DeoptimizeReason>( // --
IrOpcode::kDeoptimizeIf, // opcode
Operator::kFoldable | Operator::kNoThrow, // properties
"DeoptimizeIf", // name
2, 1, 1, 0, 1, 1, // counts
- DeoptimizeParameters(kKind, kReason)) {} // parameter
- };
-#define CACHED_DEOPTIMIZE_IF(Kind, Reason) \
- DeoptimizeIfOperator<DeoptimizeKind::k##Kind, DeoptimizeReason::k##Reason> \
- kDeoptimizeIf##Kind##Reason##Operator;
+ kReason) {} // parameter
+ };
+#define CACHED_DEOPTIMIZE_IF(Reason) \
+ DeoptimizeIfOperator<DeoptimizeReason::k##Reason> \
+ kDeoptimizeIf##Reason##Operator;
CACHED_DEOPTIMIZE_IF_LIST(CACHED_DEOPTIMIZE_IF)
#undef CACHED_DEOPTIMIZE_IF
- template <DeoptimizeKind kKind, DeoptimizeReason kReason>
- struct DeoptimizeUnlessOperator final
- : public Operator1<DeoptimizeParameters> {
+ template <DeoptimizeReason kReason>
+ struct DeoptimizeUnlessOperator final : public Operator1<DeoptimizeReason> {
DeoptimizeUnlessOperator()
- : Operator1<DeoptimizeParameters>( // --
+ : Operator1<DeoptimizeReason>( // --
IrOpcode::kDeoptimizeUnless, // opcode
Operator::kFoldable | Operator::kNoThrow, // properties
"DeoptimizeUnless", // name
2, 1, 1, 0, 1, 1, // counts
- DeoptimizeParameters(kKind, kReason)) {} // parameter
- };
-#define CACHED_DEOPTIMIZE_UNLESS(Kind, Reason) \
- DeoptimizeUnlessOperator<DeoptimizeKind::k##Kind, \
- DeoptimizeReason::k##Reason> \
- kDeoptimizeUnless##Kind##Reason##Operator;
+ kReason) {} // parameter
+ };
+#define CACHED_DEOPTIMIZE_UNLESS(Reason) \
+ DeoptimizeUnlessOperator<DeoptimizeReason::k##Reason> \
+ kDeoptimizeUnless##Reason##Operator;
CACHED_DEOPTIMIZE_UNLESS_LIST(CACHED_DEOPTIMIZE_UNLESS)
#undef CACHED_DEOPTIMIZE_UNLESS
@@ -850,42 +859,43 @@
parameter); // parameter
}
-const Operator* CommonOperatorBuilder::DeoptimizeIf(DeoptimizeKind kind,
- DeoptimizeReason reason) {
-#define CACHED_DEOPTIMIZE_IF(Kind, Reason) \
- if (kind == DeoptimizeKind::k##Kind && \
- reason == DeoptimizeReason::k##Reason) { \
- return &cache_.kDeoptimizeIf##Kind##Reason##Operator; \
- }
- CACHED_DEOPTIMIZE_IF_LIST(CACHED_DEOPTIMIZE_IF)
+const Operator* CommonOperatorBuilder::DeoptimizeIf(DeoptimizeReason reason) {
+ switch (reason) {
+#define CACHED_DEOPTIMIZE_IF(Reason) \
+ case DeoptimizeReason::k##Reason: \
+ return &cache_.kDeoptimizeIf##Reason##Operator;
+ CACHED_DEOPTIMIZE_IF_LIST(CACHED_DEOPTIMIZE_IF)
#undef CACHED_DEOPTIMIZE_IF
+ default:
+ break;
+ }
// Uncached
- DeoptimizeParameters parameter(kind, reason);
- return new (zone()) Operator1<DeoptimizeParameters>( // --
- IrOpcode::kDeoptimizeIf, // opcode
- Operator::kFoldable | Operator::kNoThrow, // properties
- "DeoptimizeIf", // name
- 2, 1, 1, 0, 1, 1, // counts
- parameter); // parameter
+ return new (zone()) Operator1<DeoptimizeReason>( // --
+ IrOpcode::kDeoptimizeIf, // opcode
+ Operator::kFoldable | Operator::kNoThrow, // properties
+ "DeoptimizeIf", // name
+ 2, 1, 1, 0, 1, 1, // counts
+ reason); // parameter
}
const Operator* CommonOperatorBuilder::DeoptimizeUnless(
- DeoptimizeKind kind, DeoptimizeReason reason) {
-#define CACHED_DEOPTIMIZE_UNLESS(Kind, Reason) \
- if (kind == DeoptimizeKind::k##Kind && \
- reason == DeoptimizeReason::k##Reason) { \
- return &cache_.kDeoptimizeUnless##Kind##Reason##Operator; \
- }
- CACHED_DEOPTIMIZE_UNLESS_LIST(CACHED_DEOPTIMIZE_UNLESS)
+ DeoptimizeReason reason) {
+ switch (reason) {
+#define CACHED_DEOPTIMIZE_UNLESS(Reason) \
+ case DeoptimizeReason::k##Reason: \
+ return &cache_.kDeoptimizeUnless##Reason##Operator;
+ CACHED_DEOPTIMIZE_UNLESS_LIST(CACHED_DEOPTIMIZE_UNLESS)
#undef CACHED_DEOPTIMIZE_UNLESS
+ default:
+ break;
+ }
// Uncached
- DeoptimizeParameters parameter(kind, reason);
- return new (zone()) Operator1<DeoptimizeParameters>( // --
- IrOpcode::kDeoptimizeUnless, // opcode
- Operator::kFoldable | Operator::kNoThrow, // properties
- "DeoptimizeUnless", // name
- 2, 1, 1, 0, 1, 1, // counts
- parameter); // parameter
+ return new (zone()) Operator1<DeoptimizeReason>( // --
+ IrOpcode::kDeoptimizeUnless, // opcode
+ Operator::kFoldable | Operator::kNoThrow, // properties
+ "DeoptimizeUnless", // name
+ 2, 1, 1, 0, 1, 1, // counts
+ reason); // parameter
}
const Operator* CommonOperatorBuilder::TrapIf(int32_t trap_id) {
« 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