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

Unified Diff: src/compiler/machine-operator-reducer.cc

Issue 1476763006: Revert of [compiler] merge binary-operator-reducer (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month 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/machine-operator-reducer.h ('k') | src/compiler/pipeline.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/machine-operator-reducer.cc
diff --git a/src/compiler/machine-operator-reducer.cc b/src/compiler/machine-operator-reducer.cc
index 81a0b784fc9949b46805055f7de4746b43211dc4..04af8d4a431a9ca9c9e875a05380359084192d03 100644
--- a/src/compiler/machine-operator-reducer.cc
+++ b/src/compiler/machine-operator-reducer.cc
@@ -350,7 +350,7 @@
if (m.IsFoldable()) { // K * K => K
return ReplaceFloat64(m.left().Value() * m.right().Value());
}
- return ReduceFloat52Mul(node);
+ break;
}
case IrOpcode::kFloat64Div: {
Float64BinopMatcher m(node);
@@ -364,7 +364,7 @@
if (m.IsFoldable()) { // K / K => K
return ReplaceFloat64(m.left().Value() / m.right().Value());
}
- return ReduceFloat52Div(node);
+ break;
}
case IrOpcode::kFloat64Mod: {
Float64BinopMatcher m(node);
@@ -1080,88 +1080,6 @@
}
-Reduction MachineOperatorReducer::ReduceFloat52Mul(Node* node) {
- if (!machine()->Is64()) return NoChange();
-
- Float64BinopMatcher m(node);
- if (!m.left().IsChangeInt32ToFloat64() ||
- !m.right().IsChangeInt32ToFloat64()) {
- return NoChange();
- }
-
- Type* type = NodeProperties::GetType(node);
- Type::RangeType* range = type->GetRange();
-
- // JavaScript has 52 bit precision in multiplication
- if (range == nullptr || range->Min() < 0.0 ||
- range->Max() > 0xFFFFFFFFFFFFFULL) {
- return NoChange();
- }
-
- Node* mul = graph()->NewNode(machine()->Int64Mul(), m.left().InputAt(0),
- m.right().InputAt(0));
-
- Type* range_type = Type::Range(range->Min(), range->Max(), graph()->zone());
-
- // TODO(indutny): Is Type::Number() a proper thing here? It looks like
- // every other place is using Type:Internal() for int64 values.
- // Should we off-load range propagation to Typer?
- NodeProperties::SetType(
- mul, Type::Intersect(range_type, Type::Number(), graph()->zone()));
-
- Node* out = graph()->NewNode(machine()->RoundInt64ToFloat64(), mul);
- return Replace(out);
-}
-
-
-Reduction MachineOperatorReducer::ReduceFloat52Div(Node* node) {
- if (!machine()->Is64()) return NoChange();
-
- Float64BinopMatcher m(node);
- if (!m.left().IsRoundInt64ToFloat64()) return NoChange();
-
- // Right value should be positive...
- if (!m.right().HasValue() || m.right().Value() <= 0) return NoChange();
-
- // ...integer...
- int64_t value = static_cast<int64_t>(m.right().Value());
- if (value != static_cast<int64_t>(m.right().Value())) return NoChange();
-
- // ...and should be a power of two.
- if (!base::bits::IsPowerOfTwo64(value)) return NoChange();
-
- Node* left = m.left().InputAt(0);
- Type::RangeType* range = NodeProperties::GetType(left)->GetRange();
-
- // The RoundInt64ToFloat64 input should fit into 52bit integer
- if (range == nullptr || range->Min() < 0 ||
- range->Max() > 0xFFFFFFFFFFFFFULL) {
- return NoChange();
- }
-
- // The result should fit into 32bit word
- int64_t min = static_cast<int64_t>(range->Min()) / value;
- int64_t max = static_cast<int64_t>(range->Max()) / value;
- if (min < 0 || max > 0xFFFFFFFLL) {
- return NoChange();
- }
-
- int64_t shift = WhichPowerOf2_64(static_cast<int64_t>(m.right().Value()));
-
- // Replace division with 64bit right shift
- Node* shr =
- graph()->NewNode(machine()->Word64Shr(), left,
- graph()->NewNode(common()->Int64Constant(shift)));
-
- Type* range_type = Type::Range(min, max, graph()->zone());
- NodeProperties::SetType(
- shr, Type::Intersect(range_type, Type::Number(), graph()->zone()));
-
- Node* out = graph()->NewNode(machine()->RoundInt64ToFloat64(), shr);
- return Replace(out);
-}
-
-
CommonOperatorBuilder* MachineOperatorReducer::common() const {
return jsgraph()->common();
}
« no previous file with comments | « src/compiler/machine-operator-reducer.h ('k') | src/compiler/pipeline.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698