Index: src/compiler/js-context-specialization.cc |
diff --git a/src/compiler/js-context-specialization.cc b/src/compiler/js-context-specialization.cc |
index 9a2edc13e31ff1c830d829deb2ac2ae9aac99021..0deb7cb38b668bbaf92fc2bb831ce501e6ab2f72 100644 |
--- a/src/compiler/js-context-specialization.cc |
+++ b/src/compiler/js-context-specialization.cc |
@@ -7,6 +7,7 @@ |
#include "src/compiler/common-operator.h" |
#include "src/compiler/js-graph.h" |
#include "src/compiler/js-operator.h" |
+#include "src/compiler/linkage.h" |
#include "src/compiler/node-matchers.h" |
#include "src/compiler/node-properties.h" |
#include "src/contexts.h" |
@@ -18,6 +19,8 @@ namespace compiler { |
Reduction JSContextSpecialization::Reduce(Node* node) { |
switch (node->opcode()) { |
+ case IrOpcode::kParameter: |
+ return ReduceParameter(node); |
case IrOpcode::kJSLoadContext: |
return ReduceJSLoadContext(node); |
case IrOpcode::kJSStoreContext: |
@@ -28,6 +31,20 @@ Reduction JSContextSpecialization::Reduce(Node* node) { |
return NoChange(); |
} |
+Reduction JSContextSpecialization::ReduceParameter(Node* node) { |
+ DCHECK_EQ(IrOpcode::kParameter, node->opcode()); |
+ int const index = ParameterIndexOf(node->op()); |
+ if (index == Linkage::kJSCallClosureParamIndex) { |
+ // Constant-fold the function parameter {node}. |
+ Handle<JSFunction> function; |
+ if (closure().ToHandle(&function)) { |
+ Node* value = jsgraph()->HeapConstant(function); |
+ return Replace(value); |
+ } |
+ } |
+ return NoChange(); |
+} |
+ |
Reduction JSContextSpecialization::SimplifyJSLoadContext(Node* node, |
Node* new_context, |
size_t new_depth) { |