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

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

Issue 1893543004: [turbofan] JSTypeOf, JSStrictEqual, JSStrictNotEqual and JSToBoolean are pure. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Really disable all broken tests. Created 4 years, 8 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') | src/compiler/simplified-lowering.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 a39b91ce7dc512d4f6c2510e818fe85850ad47c7..5ba81a4855ccd1cd2f41c13643d246b2d1ef80dd 100644
--- a/src/compiler/js-typed-lowering.cc
+++ b/src/compiler/js-typed-lowering.cc
@@ -107,32 +107,6 @@ class JSBinopReduction final {
return lowering_->Changed(node_);
}
- Reduction ChangeToStringComparisonOperator(const Operator* op,
- bool invert = false) {
- if (node_->op()->ControlInputCount() > 0) {
- lowering_->RelaxControls(node_);
- }
- // String comparison operators need effect and control inputs, so copy them
- // over.
- Node* effect = NodeProperties::GetEffectInput(node_);
- Node* control = NodeProperties::GetControlInput(node_);
- node_->ReplaceInput(2, effect);
- node_->ReplaceInput(3, control);
-
- node_->TrimInputCount(4);
- NodeProperties::ChangeOp(node_, op);
-
- if (invert) {
- // Insert a boolean-not to invert the value.
- Node* value = graph()->NewNode(simplified()->BooleanNot(), node_);
- node_->ReplaceUses(value);
- // Note: ReplaceUses() smashes all uses, so smash it back here.
- value->ReplaceInput(0, node_);
- return lowering_->Replace(value);
- }
- return lowering_->Changed(node_);
- }
-
Reduction ChangeToPureOperator(const Operator* op, Type* type) {
return ChangeToPureOperator(op, false, type);
}
@@ -477,7 +451,7 @@ Reduction JSTypedLowering::ReduceJSComparison(Node* node) {
default:
return NoChange();
}
- r.ChangeToStringComparisonOperator(stringOp);
+ r.ChangeToPureOperator(stringOp);
return Changed(node);
}
if (r.OneInputCannotBe(Type::StringOrReceiver())) {
@@ -531,8 +505,7 @@ Reduction JSTypedLowering::ReduceJSEqual(Node* node, bool invert) {
return r.ChangeToPureOperator(simplified()->NumberEqual(), invert);
}
if (r.BothInputsAre(Type::String())) {
- return r.ChangeToStringComparisonOperator(simplified()->StringEqual(),
- invert);
+ return r.ChangeToPureOperator(simplified()->StringEqual(), invert);
}
if (r.BothInputsAre(Type::Boolean())) {
return r.ChangeToPureOperator(simplified()->ReferenceEqual(Type::Boolean()),
@@ -611,8 +584,7 @@ Reduction JSTypedLowering::ReduceJSStrictEqual(Node* node, bool invert) {
invert);
}
if (r.BothInputsAre(Type::String())) {
- return r.ChangeToStringComparisonOperator(simplified()->StringEqual(),
- invert);
+ return r.ChangeToPureOperator(simplified()->StringEqual(), invert);
}
if (r.BothInputsAre(Type::NumberOrUndefined())) {
return r.ChangeToPureOperator(simplified()->NumberEqual(), invert);
@@ -625,10 +597,8 @@ Reduction JSTypedLowering::ReduceJSStrictEqual(Node* node, bool invert) {
Reduction JSTypedLowering::ReduceJSToBoolean(Node* node) {
Node* const input = node->InputAt(0);
Type* const input_type = NodeProperties::GetType(input);
- Node* const effect = NodeProperties::GetEffectInput(node);
if (input_type->Is(Type::Boolean())) {
// JSToBoolean(x:boolean) => x
- ReplaceWithValue(node, input, effect);
return Replace(input);
} else if (input_type->Is(Type::OrderedNumber())) {
// JSToBoolean(x:ordered-number) => BooleanNot(NumberEqual(x,#0))
@@ -642,11 +612,10 @@ Reduction JSTypedLowering::ReduceJSToBoolean(Node* node) {
// JSToBoolean(x:string) => NumberLessThan(#0,x.length)
FieldAccess const access = AccessBuilder::ForStringLength();
Node* length = graph()->NewNode(simplified()->LoadField(access), input,
- effect, graph()->start());
+ graph()->start(), graph()->start());
ReplaceWithValue(node, node, length);
node->ReplaceInput(0, jsgraph()->ZeroConstant());
node->ReplaceInput(1, length);
- node->TrimInputCount(2);
NodeProperties::ChangeOp(node, simplified()->NumberLessThan());
return Changed(node);
}
« no previous file with comments | « src/compiler/js-operator.cc ('k') | src/compiler/simplified-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698