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/js-context-specialization.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/generic-node.h ('k') | src/compiler/js-inlining.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/js-context-specialization.cc
diff --git a/src/compiler/js-context-specialization.cc b/src/compiler/js-context-specialization.cc
index b54d5d99c2058cf17d1674b5f9cc7e3e01953741..bdf142763a8887ca3db22cdda719b94eae24f86a 100644
--- a/src/compiler/js-context-specialization.cc
+++ b/src/compiler/js-context-specialization.cc
@@ -15,6 +15,26 @@ namespace v8 {
namespace internal {
namespace compiler {
+// TODO(titzer): factor this out to a common routine with js-typed-lowering.
+static void ReplaceEffectfulWithValue(Node* node, Node* value) {
+ Node* effect = NULL;
+ if (OperatorProperties::HasEffectInput(node->op())) {
+ effect = NodeProperties::GetEffectInput(node);
+ }
+
+ // Requires distinguishing between value and effect edges.
+ UseIter iter = node->uses().begin();
+ while (iter != node->uses().end()) {
+ if (NodeProperties::IsEffectEdge(iter.edge())) {
+ DCHECK_NE(NULL, effect);
+ iter = iter.UpdateToAndIncrement(effect);
+ } else {
+ iter = iter.UpdateToAndIncrement(value);
+ }
+ }
+}
+
+
class ContextSpecializationVisitor : public NullNodeVisitor {
public:
explicit ContextSpecializationVisitor(JSContextSpecializer* spec)
@@ -25,16 +45,14 @@ class ContextSpecializationVisitor : public NullNodeVisitor {
case IrOpcode::kJSLoadContext: {
Reduction r = spec_->ReduceJSLoadContext(node);
if (r.Changed() && r.replacement() != node) {
- NodeProperties::ReplaceWithValue(node, r.replacement());
- node->RemoveAllInputs();
+ ReplaceEffectfulWithValue(node, r.replacement());
}
break;
}
case IrOpcode::kJSStoreContext: {
Reduction r = spec_->ReduceJSStoreContext(node);
if (r.Changed() && r.replacement() != node) {
- NodeProperties::ReplaceWithValue(node, r.replacement());
- node->RemoveAllInputs();
+ ReplaceEffectfulWithValue(node, r.replacement());
}
break;
}
@@ -50,8 +68,7 @@ class ContextSpecializationVisitor : public NullNodeVisitor {
void JSContextSpecializer::SpecializeToContext() {
- NodeProperties::ReplaceWithValue(context_,
- jsgraph_->Constant(info_->context()));
+ ReplaceEffectfulWithValue(context_, jsgraph_->Constant(info_->context()));
ContextSpecializationVisitor visitor(this);
jsgraph_->graph()->VisitNodeInputsFromEnd(&visitor);
« no previous file with comments | « src/compiler/generic-node.h ('k') | src/compiler/js-inlining.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698