Index: src/compiler/js-inlining.cc |
diff --git a/src/compiler/js-inlining.cc b/src/compiler/js-inlining.cc |
index d5e1af984f5c649c32c2bb5fd1729b93b83984fc..14c7393ed996bdede00a9384364f97091e9e1df2 100644 |
--- a/src/compiler/js-inlining.cc |
+++ b/src/compiler/js-inlining.cc |
@@ -10,6 +10,10 @@ |
#include "src/compiler/all-nodes.h" |
#include "src/compiler/ast-graph-builder.h" |
#include "src/compiler/common-operator.h" |
+#include "src/compiler/common-operator-reducer.h" |
+#include "src/compiler/dead-code-elimination.h" |
+#include "src/compiler/graph-reducer.h" |
+#include "src/compiler/js-global-specialization.h" |
#include "src/compiler/js-operator.h" |
#include "src/compiler/node-matchers.h" |
#include "src/compiler/node-properties.h" |
@@ -310,7 +314,15 @@ Reduction JSInliner::ReduceJSCallFunction(Node* node, |
Zone zone; |
ParseInfo parse_info(&zone, function); |
CompilationInfo info(&parse_info); |
- if (info_->is_deoptimization_enabled()) info.MarkAsDeoptimizationEnabled(); |
+ if (info_->is_deoptimization_enabled()) { |
+ info.MarkAsDeoptimizationEnabled(); |
+ } |
+ if (info_->is_native_context_specializing()) { |
+ info.MarkAsNativeContextSpecializing(); |
+ } |
+ if (info_->is_typing_enabled()) { |
+ info.MarkAsTypingEnabled(); |
+ } |
if (!Compiler::ParseAndAnalyze(info.parse_info())) { |
TRACE("Not inlining %s into %s because parsing failed\n", |
@@ -339,6 +351,30 @@ Reduction JSInliner::ReduceJSCallFunction(Node* node, |
AstGraphBuilder graph_builder(local_zone_, &info, &jsgraph); |
graph_builder.CreateGraph(false); |
+ // TODO(mstarzinger): Unify this with the Pipeline once JSInliner refactoring |
+ // starts. |
+ if (info.is_native_context_specializing()) { |
+ GraphReducer graph_reducer(local_zone_, &graph, jsgraph.Dead()); |
+ DeadCodeElimination dead_code_elimination(&graph_reducer, &graph, |
+ jsgraph.common()); |
+ CommonOperatorReducer common_reducer(&graph_reducer, &graph, |
+ jsgraph.common(), jsgraph.machine()); |
+ JSGlobalSpecialization::Flags flags = JSGlobalSpecialization::kNoFlags; |
+ if (info.is_deoptimization_enabled()) { |
+ flags |= JSGlobalSpecialization::kDeoptimizationEnabled; |
+ } |
+ if (info.is_typing_enabled()) { |
+ flags |= JSGlobalSpecialization::kTypingEnabled; |
+ } |
+ JSGlobalSpecialization global_specialization( |
+ &graph_reducer, &jsgraph, flags, |
+ handle(info.global_object(), info.isolate()), info_->dependencies()); |
+ graph_reducer.AddReducer(&dead_code_elimination); |
+ graph_reducer.AddReducer(&common_reducer); |
+ graph_reducer.AddReducer(&global_specialization); |
+ graph_reducer.ReduceGraph(); |
+ } |
+ |
// The inlinee specializes to the context from the JSFunction object. |
// TODO(turbofan): We might want to load the context from the JSFunction at |
// runtime in case we only know the SharedFunctionInfo once we have dynamic |