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

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

Issue 1369313004: [turbofan] Make string comparisons effectful. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 3 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-typed-lowering.cc ('k') | src/compiler/simplified-operator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/simplified-lowering.cc
diff --git a/src/compiler/simplified-lowering.cc b/src/compiler/simplified-lowering.cc
index ecfba7f5fa264e6842815ed65b9a4584085c3fc5..7d495bf9839b0759046fa5bfeb1593bb1e770f50 100644
--- a/src/compiler/simplified-lowering.cc
+++ b/src/compiler/simplified-lowering.cc
@@ -1363,7 +1363,9 @@ Node* SimplifiedLowering::StringComparison(Node* node) {
return graph()->NewNode(
common()->Call(desc), jsgraph()->HeapConstant(callable.code()),
NodeProperties::GetValueInput(node, 0),
- NodeProperties::GetValueInput(node, 1), jsgraph()->NoContextConstant());
+ NodeProperties::GetValueInput(node, 1), jsgraph()->NoContextConstant(),
+ NodeProperties::GetEffectInput(node),
+ NodeProperties::GetControlInput(node));
}
@@ -1627,23 +1629,49 @@ void SimplifiedLowering::DoShift(Node* node, Operator const* op) {
}
+namespace {
+
+void ReplaceEffectUses(Node* node, Node* replacement) {
+ // Requires distinguishing between value and effect edges.
+ DCHECK(replacement->op()->EffectOutputCount() > 0);
+ for (Edge edge : node->use_edges()) {
+ if (NodeProperties::IsEffectEdge(edge)) {
+ edge.UpdateTo(replacement);
+ } else {
+ DCHECK(NodeProperties::IsValueEdge(edge));
+ }
+ }
+}
+
+} // namespace
+
+
void SimplifiedLowering::DoStringEqual(Node* node) {
- node->ReplaceInput(0, StringComparison(node));
+ Node* comparison = StringComparison(node);
+ ReplaceEffectUses(node, comparison);
+ node->ReplaceInput(0, comparison);
node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL));
+ node->TrimInputCount(2);
NodeProperties::ChangeOp(node, machine()->WordEqual());
}
void SimplifiedLowering::DoStringLessThan(Node* node) {
- node->ReplaceInput(0, StringComparison(node));
+ Node* comparison = StringComparison(node);
+ ReplaceEffectUses(node, comparison);
+ node->ReplaceInput(0, comparison);
node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL));
+ node->TrimInputCount(2);
NodeProperties::ChangeOp(node, machine()->IntLessThan());
}
void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) {
- node->ReplaceInput(0, StringComparison(node));
+ Node* comparison = StringComparison(node);
+ ReplaceEffectUses(node, comparison);
+ node->ReplaceInput(0, comparison);
node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL));
+ node->TrimInputCount(2);
NodeProperties::ChangeOp(node, machine()->IntLessThanOrEqual());
}
« no previous file with comments | « src/compiler/js-typed-lowering.cc ('k') | src/compiler/simplified-operator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698