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

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

Issue 2154073002: [Turbofan]: Eliminate the check for -0 if it's not possible/observable. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE. Created 4 years, 5 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') | test/mjsunit/compiler/math-mul.js » ('j') | 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 258f4c324bed440619d14ffbea9e2cf0ce07d4e4..ac5134d7588598968f22ecba895013456bb3c092 100644
--- a/src/compiler/simplified-operator.cc
+++ b/src/compiler/simplified-operator.cc
@@ -201,6 +201,26 @@ CheckFloat64HoleMode CheckFloat64HoleModeOf(const Operator* op) {
return OpParameter<CheckFloat64HoleMode>(op);
}
+CheckForMinusZeroMode CheckMinusZeroModeOf(const Operator* op) {
+ DCHECK_EQ(IrOpcode::kCheckedInt32Mul, op->opcode());
+ return OpParameter<CheckForMinusZeroMode>(op);
+}
+
+size_t hash_value(CheckForMinusZeroMode mode) {
+ return static_cast<size_t>(mode);
+}
+
+std::ostream& operator<<(std::ostream& os, CheckForMinusZeroMode mode) {
+ switch (mode) {
+ case CheckForMinusZeroMode::kCheckForMinusZero:
+ return os << "check-for-minus-zero";
+ case CheckForMinusZeroMode::kDontCheckForMinusZero:
+ return os << "dont-check-for-minus-zero";
+ }
+ UNREACHABLE();
+ return os;
+}
+
size_t hash_value(CheckTaggedHoleMode mode) {
return static_cast<size_t>(mode);
}
@@ -334,7 +354,6 @@ CompareOperationHints::Hint CompareOperationHintOf(const Operator* op) {
V(CheckedInt32Mod, 2, 1) \
V(CheckedUint32Div, 2, 1) \
V(CheckedUint32Mod, 2, 1) \
- V(CheckedInt32Mul, 2, 1) \
V(CheckedUint32ToInt32, 1, 1) \
V(CheckedFloat64ToInt32, 1, 1) \
V(CheckedTaggedToInt32, 1, 1) \
@@ -362,6 +381,20 @@ struct SimplifiedOperatorGlobalCache final {
CHECKED_OP_LIST(CHECKED)
#undef CHECKED
+ template <CheckForMinusZeroMode kMode>
+ struct CheckedInt32MulOperator final
+ : public Operator1<CheckForMinusZeroMode> {
+ CheckedInt32MulOperator()
+ : Operator1<CheckForMinusZeroMode>(
+ IrOpcode::kCheckedInt32Mul,
+ Operator::kFoldable | Operator::kNoThrow, "CheckedInt32Mul", 2, 1,
+ 1, 1, 1, 0, kMode) {}
+ };
+ CheckedInt32MulOperator<CheckForMinusZeroMode::kCheckForMinusZero>
+ kCheckedInt32MulCheckForMinusZeroOperator;
+ CheckedInt32MulOperator<CheckForMinusZeroMode::kDontCheckForMinusZero>
+ kCheckedInt32MulDontCheckForMinusZeroOperator;
+
template <CheckFloat64HoleMode kMode>
struct CheckFloat64HoleNaNOperator final
: public Operator1<CheckFloat64HoleMode> {
@@ -441,6 +474,18 @@ PURE_OP_LIST(GET_FROM_CACHE)
CHECKED_OP_LIST(GET_FROM_CACHE)
#undef GET_FROM_CACHE
+const Operator* SimplifiedOperatorBuilder::CheckedInt32Mul(
+ CheckForMinusZeroMode mode) {
+ switch (mode) {
+ case CheckForMinusZeroMode::kCheckForMinusZero:
+ return &cache_.kCheckedInt32MulCheckForMinusZeroOperator;
+ case CheckForMinusZeroMode::kDontCheckForMinusZero:
+ return &cache_.kCheckedInt32MulDontCheckForMinusZeroOperator;
+ }
+ UNREACHABLE();
+ return nullptr;
+}
+
const Operator* SimplifiedOperatorBuilder::CheckFloat64Hole(
CheckFloat64HoleMode mode) {
switch (mode) {
« no previous file with comments | « src/compiler/simplified-operator.h ('k') | test/mjsunit/compiler/math-mul.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698