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

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

Issue 481413002: Revert "Add initial support for inlining." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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-inlining.cc ('k') | src/compiler/node-properties.h » ('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 4c166e0dc53d3b2e6dd2319873de41bd230417cc..361cb94f058c3e39ce117c69ba3b44c32a91039c 100644
--- a/src/compiler/js-typed-lowering.cc
+++ b/src/compiler/js-typed-lowering.cc
@@ -17,18 +17,39 @@ namespace compiler {
// - relax effects from generic but not-side-effecting operations
// - relax effects for ToNumber(mixed)
+// Replace value uses of {node} with {value} and effect uses of {node} with
+// {effect}. If {effect == NULL}, then use the effect input to {node}.
+// TODO(titzer): move into a GraphEditor?
+static void ReplaceUses(Node* node, Node* value, Node* effect) {
+ if (value == effect) {
+ // Effect and value updates are the same; no special iteration needed.
+ if (value != node) node->ReplaceUses(value);
+ return;
+ }
+
+ if (effect == NULL) effect = NodeProperties::GetEffectInput(node);
+
+ // The iteration requires distinguishing between value and effect edges.
+ UseIter iter = node->uses().begin();
+ while (iter != node->uses().end()) {
+ if (NodeProperties::IsEffectEdge(iter.edge())) {
+ iter = iter.UpdateToAndIncrement(effect);
+ } else {
+ iter = iter.UpdateToAndIncrement(value);
+ }
+ }
+}
+
// Relax the effects of {node} by immediately replacing effect uses of {node}
// with the effect input to {node}.
// TODO(turbofan): replace the effect input to {node} with {graph->start()}.
// TODO(titzer): move into a GraphEditor?
-static void RelaxEffects(Node* node) {
- NodeProperties::ReplaceWithValue(node, node, NULL);
-}
+static void RelaxEffects(Node* node) { ReplaceUses(node, node, NULL); }
Reduction JSTypedLowering::ReplaceEagerly(Node* old, Node* node) {
- NodeProperties::ReplaceWithValue(old, node, node);
+ ReplaceUses(old, node, node);
return Reducer::Changed(node);
}
@@ -501,7 +522,7 @@ Reduction JSTypedLowering::ReduceJSToBooleanInput(Node* input) {
static Reduction ReplaceWithReduction(Node* node, Reduction reduction) {
if (reduction.Changed()) {
- NodeProperties::ReplaceWithValue(node, reduction.replacement());
+ ReplaceUses(node, reduction.replacement(), NULL);
return reduction;
}
return Reducer::NoChange();
@@ -552,13 +573,13 @@ Reduction JSTypedLowering::Reduce(Node* node) {
// !x => BooleanNot(x)
value =
graph()->NewNode(simplified()->BooleanNot(), result.replacement());
- NodeProperties::ReplaceWithValue(node, value);
+ ReplaceUses(node, value, NULL);
return Changed(value);
} else {
// !x => BooleanNot(JSToBoolean(x))
value = graph()->NewNode(simplified()->BooleanNot(), node);
node->set_op(javascript()->ToBoolean());
- NodeProperties::ReplaceWithValue(node, value, node);
+ ReplaceUses(node, value, node);
// Note: ReplaceUses() smashes all uses, so smash it back here.
value->ReplaceInput(0, node);
return ReplaceWith(value);
« no previous file with comments | « src/compiler/js-inlining.cc ('k') | src/compiler/node-properties.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698