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

Unified Diff: src/compiler/common-operator.cc

Issue 2682143002: [compiler] Pass deoptimization_kind through DeoptimizeParameters and FlagsContinuation (Closed)
Patch Set: fix 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 eb398d4c1ff5354f2e2bc8d3688d9bd98f35620a..6d148029e2cdf27dbcf95732aff15cf7b482dbeb 100644
--- a/src/compiler/common-operator.cc
+++ b/src/compiler/common-operator.cc
@@ -37,12 +37,6 @@ BranchHint BranchHintOf(const Operator* const op) {
return OpParameter<BranchHint>(op);
}
-DeoptimizeReason DeoptimizeReasonOf(Operator const* const op) {
- DCHECK(op->opcode() == IrOpcode::kDeoptimizeIf ||
- op->opcode() == IrOpcode::kDeoptimizeUnless);
- return OpParameter<DeoptimizeReason>(op);
-}
-
int ValueInputCountOfReturn(Operator const* const op) {
DCHECK(op->opcode() == IrOpcode::kReturn);
// Return nodes have a hidden input at index 0 which we ignore in the value
@@ -50,19 +44,6 @@ int ValueInputCountOfReturn(Operator const* const op) {
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();
}
@@ -80,7 +61,9 @@ std::ostream& operator<<(std::ostream& os, DeoptimizeParameters p) {
}
DeoptimizeParameters const& DeoptimizeParametersOf(Operator const* const op) {
- DCHECK_EQ(IrOpcode::kDeoptimize, op->opcode());
+ DCHECK(op->opcode() == IrOpcode::kDeoptimize ||
+ op->opcode() == IrOpcode::kDeoptimizeIf ||
+ op->opcode() == IrOpcode::kDeoptimizeUnless);
return OpParameter<DeoptimizeParameters>(op);
}
@@ -436,22 +419,22 @@ ZoneVector<MachineType> const* MachineTypesOf(Operator const* op) {
V(Soft, InsufficientTypeFeedbackForGenericNamedAccess)
#define CACHED_DEOPTIMIZE_IF_LIST(V) \
- V(DivisionByZero) \
- V(Hole) \
- V(MinusZero) \
- V(Overflow) \
- V(Smi)
+ V(Eager, DivisionByZero) \
+ V(Eager, Hole) \
+ V(Eager, MinusZero) \
+ V(Eager, Overflow) \
+ V(Eager, Smi)
#define CACHED_DEOPTIMIZE_UNLESS_LIST(V) \
- V(LostPrecision) \
- V(LostPrecisionOrNaN) \
- V(NoReason) \
- V(NotAHeapNumber) \
- V(NotANumberOrOddball) \
- V(NotASmi) \
- V(OutOfBounds) \
- V(WrongInstanceType) \
- V(WrongMap)
+ 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)
#define CACHED_TRAP_IF_LIST(V) \
V(TrapDivUnrepresentable) \
@@ -635,35 +618,37 @@ struct CommonOperatorGlobalCache final {
CACHED_DEOPTIMIZE_LIST(CACHED_DEOPTIMIZE)
#undef CACHED_DEOPTIMIZE
- template <DeoptimizeReason kReason>
- struct DeoptimizeIfOperator final : public Operator1<DeoptimizeReason> {
+ template <DeoptimizeKind kKind, DeoptimizeReason kReason>
+ struct DeoptimizeIfOperator final : public Operator1<DeoptimizeParameters> {
DeoptimizeIfOperator()
- : Operator1<DeoptimizeReason>( // --
+ : Operator1<DeoptimizeParameters>( // --
IrOpcode::kDeoptimizeIf, // opcode
Operator::kFoldable | Operator::kNoThrow, // properties
"DeoptimizeIf", // name
2, 1, 1, 0, 1, 1, // counts
- kReason) {} // parameter
+ DeoptimizeParameters(kKind, kReason)) {} // parameter
};
-#define CACHED_DEOPTIMIZE_IF(Reason) \
- DeoptimizeIfOperator<DeoptimizeReason::k##Reason> \
- kDeoptimizeIf##Reason##Operator;
+#define CACHED_DEOPTIMIZE_IF(Kind, Reason) \
+ DeoptimizeIfOperator<DeoptimizeKind::k##Kind, DeoptimizeReason::k##Reason> \
+ kDeoptimizeIf##Kind##Reason##Operator;
CACHED_DEOPTIMIZE_IF_LIST(CACHED_DEOPTIMIZE_IF)
#undef CACHED_DEOPTIMIZE_IF
- template <DeoptimizeReason kReason>
- struct DeoptimizeUnlessOperator final : public Operator1<DeoptimizeReason> {
+ template <DeoptimizeKind kKind, DeoptimizeReason kReason>
+ struct DeoptimizeUnlessOperator final
+ : public Operator1<DeoptimizeParameters> {
DeoptimizeUnlessOperator()
- : Operator1<DeoptimizeReason>( // --
+ : Operator1<DeoptimizeParameters>( // --
IrOpcode::kDeoptimizeUnless, // opcode
Operator::kFoldable | Operator::kNoThrow, // properties
"DeoptimizeUnless", // name
2, 1, 1, 0, 1, 1, // counts
- kReason) {} // parameter
+ DeoptimizeParameters(kKind, kReason)) {} // parameter
};
-#define CACHED_DEOPTIMIZE_UNLESS(Reason) \
- DeoptimizeUnlessOperator<DeoptimizeReason::k##Reason> \
- kDeoptimizeUnless##Reason##Operator;
+#define CACHED_DEOPTIMIZE_UNLESS(Kind, Reason) \
+ DeoptimizeUnlessOperator<DeoptimizeKind::k##Kind, \
+ DeoptimizeReason::k##Reason> \
+ kDeoptimizeUnless##Kind##Reason##Operator;
CACHED_DEOPTIMIZE_UNLESS_LIST(CACHED_DEOPTIMIZE_UNLESS)
#undef CACHED_DEOPTIMIZE_UNLESS
@@ -859,43 +844,42 @@ const Operator* CommonOperatorBuilder::Deoptimize(DeoptimizeKind kind,
parameter); // parameter
}
-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;
+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)
+#undef CACHED_DEOPTIMIZE_IF
// Uncached
- return new (zone()) Operator1<DeoptimizeReason>( // --
- IrOpcode::kDeoptimizeIf, // opcode
- Operator::kFoldable | Operator::kNoThrow, // properties
- "DeoptimizeIf", // name
- 2, 1, 1, 0, 1, 1, // counts
- reason); // parameter
+ 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
}
const Operator* CommonOperatorBuilder::DeoptimizeUnless(
- 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;
+ 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)
+#undef CACHED_DEOPTIMIZE_UNLESS
// Uncached
- return new (zone()) Operator1<DeoptimizeReason>( // --
- IrOpcode::kDeoptimizeUnless, // opcode
- Operator::kFoldable | Operator::kNoThrow, // properties
- "DeoptimizeUnless", // name
- 2, 1, 1, 0, 1, 1, // counts
- reason); // parameter
+ 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
}
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