diff options
Diffstat (limited to 'deps/v8/src/compiler/js-context-specialization.cc')
-rw-r--r-- | deps/v8/src/compiler/js-context-specialization.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/deps/v8/src/compiler/js-context-specialization.cc b/deps/v8/src/compiler/js-context-specialization.cc index 9a2edc13e3..0deb7cb38b 100644 --- a/deps/v8/src/compiler/js-context-specialization.cc +++ b/deps/v8/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) { |