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

Unified Diff: src/compiler/js-typed-lowering.cc

Issue 2222993003: [turbofan] Consume number type hints for strict equality. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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/js-operator.cc ('k') | test/unittests/compiler/js-typed-lowering-unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/js-typed-lowering.cc
diff --git a/src/compiler/js-typed-lowering.cc b/src/compiler/js-typed-lowering.cc
index 34f30c28869db3a31abd7b79cea93c271a731d87..aa5c9fdd8ae4bd03725fa5dbccf5699672c4e60f 100644
--- a/src/compiler/js-typed-lowering.cc
+++ b/src/compiler/js-typed-lowering.cc
@@ -55,9 +55,7 @@ class JSBinopReduction final {
bool GetCompareNumberOperationHint(NumberOperationHint* hint) {
if (lowering_->flags() & JSTypedLowering::kDeoptimizationEnabled) {
- DCHECK_NE(0, node_->op()->ControlOutputCount());
DCHECK_EQ(1, node_->op()->EffectOutputCount());
- DCHECK_EQ(1, OperatorProperties::GetFrameStateInputCount(node_->op()));
CompareOperationHints hints = CompareOperationHintsOf(node_->op());
switch (hints.combined()) {
case CompareOperationHints::kSignedSmall:
@@ -175,8 +173,6 @@ class JSBinopReduction final {
DCHECK_EQ(1, node_->op()->EffectInputCount());
DCHECK_EQ(1, node_->op()->EffectOutputCount());
DCHECK_EQ(1, node_->op()->ControlInputCount());
- DCHECK_LT(1, node_->op()->ControlOutputCount());
- DCHECK_EQ(1, OperatorProperties::GetFrameStateInputCount(node_->op()));
DCHECK_EQ(2, node_->op()->ValueInputCount());
// Reconnect the control output to bypass the IfSuccess node and
@@ -196,7 +192,9 @@ class JSBinopReduction final {
}
// Remove the frame state and the context.
- node_->RemoveInput(NodeProperties::FirstFrameStateIndex(node_));
+ if (OperatorProperties::HasFrameStateInput(node_->op())) {
+ node_->RemoveInput(NodeProperties::FirstFrameStateIndex(node_));
+ }
node_->RemoveInput(NodeProperties::FirstContextIndex(node_));
NodeProperties::ChangeOp(node_, op);
@@ -694,6 +692,7 @@ Reduction JSTypedLowering::ReduceJSEqualTypeOf(Node* node, bool invert) {
if (invert) {
replacement = graph()->NewNode(simplified()->BooleanNot(), replacement);
}
+ ReplaceWithValue(node, replacement);
return Replace(replacement);
}
return NoChange();
@@ -701,10 +700,7 @@ Reduction JSTypedLowering::ReduceJSEqualTypeOf(Node* node, bool invert) {
Reduction JSTypedLowering::ReduceJSEqual(Node* node, bool invert) {
Reduction const reduction = ReduceJSEqualTypeOf(node, invert);
- if (reduction.Changed()) {
- ReplaceWithValue(node, reduction.replacement());
- return reduction;
- }
+ if (reduction.Changed()) return reduction;
JSBinopReduction r(this, node);
@@ -769,10 +765,10 @@ Reduction JSTypedLowering::ReduceJSStrictEqual(Node* node, bool invert) {
return Replace(replacement);
}
}
+
Reduction const reduction = ReduceJSEqualTypeOf(node, invert);
- if (reduction.Changed()) {
- return reduction;
- }
+ if (reduction.Changed()) return reduction;
+
if (r.OneInputIs(the_hole_type_)) {
return r.ChangeToPureOperator(simplified()->ReferenceEqual(the_hole_type_),
invert);
@@ -804,10 +800,17 @@ Reduction JSTypedLowering::ReduceJSStrictEqual(Node* node, bool invert) {
if (r.BothInputsAre(Type::String())) {
return r.ChangeToPureOperator(simplified()->StringEqual(), invert);
}
- if (r.BothInputsAre(Type::Number())) {
+
+ NumberOperationHint hint;
+ if (r.BothInputsAre(Type::Signed32()) ||
+ r.BothInputsAre(Type::Unsigned32())) {
+ return r.ChangeToPureOperator(simplified()->NumberEqual(), invert);
+ } else if (r.GetCompareNumberOperationHint(&hint)) {
+ return r.ChangeToSpeculativeOperator(
+ simplified()->SpeculativeNumberEqual(hint), invert, Type::Boolean());
+ } else if (r.BothInputsAre(Type::Number())) {
return r.ChangeToPureOperator(simplified()->NumberEqual(), invert);
}
- // TODO(turbofan): js-typed-lowering of StrictEqual(mixed types)
return NoChange();
}
« no previous file with comments | « src/compiler/js-operator.cc ('k') | test/unittests/compiler/js-typed-lowering-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698