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

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

Issue 2202993005: [turbofan] Don't generate unnecessary minus zero checks. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@TurboFan_SignedSmall
Patch Set: Err, DCHECK, meh Created 4 years, 4 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/simplified-operator.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/simplified-operator.cc
diff --git a/src/compiler/simplified-operator.cc b/src/compiler/simplified-operator.cc
index 53d1f9ae255005a77384acc8bfb630b785ecb6db..e7374246961e3011569ffb646cd90b92f5fb497c 100644
--- a/src/compiler/simplified-operator.cc
+++ b/src/compiler/simplified-operator.cc
@@ -208,7 +208,9 @@ CheckFloat64HoleMode CheckFloat64HoleModeOf(const Operator* op) {
}
CheckForMinusZeroMode CheckMinusZeroModeOf(const Operator* op) {
- DCHECK_EQ(IrOpcode::kCheckedInt32Mul, op->opcode());
+ DCHECK(op->opcode() == IrOpcode::kCheckedInt32Mul ||
+ op->opcode() == IrOpcode::kCheckedFloat64ToInt32 ||
+ op->opcode() == IrOpcode::kCheckedTaggedToInt32);
return OpParameter<CheckForMinusZeroMode>(op);
}
@@ -395,9 +397,7 @@ CompareOperationHints::Hint CompareOperationHintOf(const Operator* op) {
V(CheckedUint32Div, 2, 1) \
V(CheckedUint32Mod, 2, 1) \
V(CheckedUint32ToInt32, 1, 1) \
- V(CheckedFloat64ToInt32, 1, 1) \
V(CheckedTaggedSignedToInt32, 1, 1) \
- V(CheckedTaggedToInt32, 1, 1) \
V(CheckedTaggedToFloat64, 1, 1) \
V(CheckedTruncateTaggedToWord32, 1, 1)
@@ -437,6 +437,34 @@ struct SimplifiedOperatorGlobalCache final {
CheckedInt32MulOperator<CheckForMinusZeroMode::kDontCheckForMinusZero>
kCheckedInt32MulDontCheckForMinusZeroOperator;
+ template <CheckForMinusZeroMode kMode>
+ struct CheckedFloat64ToInt32Operator final
+ : public Operator1<CheckForMinusZeroMode> {
+ CheckedFloat64ToInt32Operator()
+ : Operator1<CheckForMinusZeroMode>(
+ IrOpcode::kCheckedFloat64ToInt32,
+ Operator::kFoldable | Operator::kNoThrow, "CheckedFloat64ToInt32",
+ 1, 1, 1, 1, 1, 0, kMode) {}
+ };
+ CheckedFloat64ToInt32Operator<CheckForMinusZeroMode::kCheckForMinusZero>
+ kCheckedFloat64ToInt32CheckForMinusZeroOperator;
+ CheckedFloat64ToInt32Operator<CheckForMinusZeroMode::kDontCheckForMinusZero>
+ kCheckedFloat64ToInt32DontCheckForMinusZeroOperator;
+
+ template <CheckForMinusZeroMode kMode>
+ struct CheckedTaggedToInt32Operator final
+ : public Operator1<CheckForMinusZeroMode> {
+ CheckedTaggedToInt32Operator()
+ : Operator1<CheckForMinusZeroMode>(
+ IrOpcode::kCheckedTaggedToInt32,
+ Operator::kFoldable | Operator::kNoThrow, "CheckedTaggedToInt32",
+ 1, 1, 1, 1, 1, 0, kMode) {}
+ };
+ CheckedTaggedToInt32Operator<CheckForMinusZeroMode::kCheckForMinusZero>
+ kCheckedTaggedToInt32CheckForMinusZeroOperator;
+ CheckedTaggedToInt32Operator<CheckForMinusZeroMode::kDontCheckForMinusZero>
+ kCheckedTaggedToInt32DontCheckForMinusZeroOperator;
+
template <CheckFloat64HoleMode kMode>
struct CheckFloat64HoleNaNOperator final
: public Operator1<CheckFloat64HoleMode> {
@@ -524,6 +552,30 @@ const Operator* SimplifiedOperatorBuilder::CheckedInt32Mul(
return nullptr;
}
+const Operator* SimplifiedOperatorBuilder::CheckedFloat64ToInt32(
+ CheckForMinusZeroMode mode) {
+ switch (mode) {
+ case CheckForMinusZeroMode::kCheckForMinusZero:
+ return &cache_.kCheckedFloat64ToInt32CheckForMinusZeroOperator;
+ case CheckForMinusZeroMode::kDontCheckForMinusZero:
+ return &cache_.kCheckedFloat64ToInt32DontCheckForMinusZeroOperator;
+ }
+ UNREACHABLE();
+ return nullptr;
+}
+
+const Operator* SimplifiedOperatorBuilder::CheckedTaggedToInt32(
+ CheckForMinusZeroMode mode) {
+ switch (mode) {
+ case CheckForMinusZeroMode::kCheckForMinusZero:
+ return &cache_.kCheckedTaggedToInt32CheckForMinusZeroOperator;
+ case CheckForMinusZeroMode::kDontCheckForMinusZero:
+ return &cache_.kCheckedTaggedToInt32DontCheckForMinusZeroOperator;
+ }
+ UNREACHABLE();
+ return nullptr;
+}
+
const Operator* SimplifiedOperatorBuilder::CheckMaps(int map_input_count) {
// TODO(bmeurer): Cache the most important versions of this operator.
DCHECK_LT(0, map_input_count);
« no previous file with comments | « src/compiler/simplified-operator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698