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

Unified Diff: src/compiler/js-inlining.cc

Issue 1404123002: [turbofan] Move native context specialization before inlining. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: No more JSGraphReducer in JSInliner Created 5 years, 2 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
« no previous file with comments | « no previous file | src/compiler/pipeline.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | src/compiler/pipeline.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698