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

Unified Diff: src/compiler/js-context-specialization.cc

Issue 1221103003: [turbofan] Move context specialization into JSContextSpecializer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix predicate. Created 5 years, 6 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
Index: src/compiler/js-context-specialization.cc
diff --git a/src/compiler/js-context-specialization.cc b/src/compiler/js-context-specialization.cc
index bb44f5928bb0efe87537c116b605189550f6ea49..b837a6277310784d4ee0ccf98f361dd2f282026d 100644
--- a/src/compiler/js-context-specialization.cc
+++ b/src/compiler/js-context-specialization.cc
@@ -16,11 +16,26 @@ namespace internal {
namespace compiler {
Reduction JSContextSpecializer::Reduce(Node* node) {
- if (node->opcode() == IrOpcode::kJSLoadContext) {
- return ReduceJSLoadContext(node);
+ switch (node->opcode()) {
+ case IrOpcode::kParameter:
+ return ReduceParameter(node);
+ case IrOpcode::kJSLoadContext:
+ return ReduceJSLoadContext(node);
+ case IrOpcode::kJSStoreContext:
+ return ReduceJSStoreContext(node);
+ default:
+ break;
}
- if (node->opcode() == IrOpcode::kJSStoreContext) {
- return ReduceJSStoreContext(node);
+ return NoChange();
+}
+
+
+Reduction JSContextSpecializer::ReduceParameter(Node* node) {
+ DCHECK_EQ(IrOpcode::kParameter, node->opcode());
+ Handle<Context> context_constant;
+ if (ParameterIndexOf(node->op()) == context_index() &&
+ context().ToHandle(&context_constant)) {
+ return Replace(jsgraph()->Constant(context_constant));
}
return NoChange();
}

Powered by Google App Engine
This is Rietveld 408576698