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(); |
} |