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

Unified Diff: src/compiler/pipeline.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 | « src/compiler/js-inlining.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/pipeline.cc
diff --git a/src/compiler/pipeline.cc b/src/compiler/pipeline.cc
index 1f2e768522c7d75a634c1e19129d3bad62b20c80..9cc4460ee594f3a636d429654aca00e192bb28e0 100644
--- a/src/compiler/pipeline.cc
+++ b/src/compiler/pipeline.cc
@@ -496,6 +496,34 @@ struct GraphBuilderPhase {
};
+struct NativeContextSpecializationPhase {
+ static const char* phase_name() { return "native context specialization"; }
+
+ void Run(PipelineData* data, Zone* temp_zone) {
+ JSGraphReducer graph_reducer(data->jsgraph(), temp_zone);
+ DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(),
+ data->common());
+ CommonOperatorReducer common_reducer(&graph_reducer, data->graph(),
+ data->common(), data->machine());
+ JSGlobalSpecialization::Flags flags = JSGlobalSpecialization::kNoFlags;
+ if (data->info()->is_deoptimization_enabled()) {
+ flags |= JSGlobalSpecialization::kDeoptimizationEnabled;
+ }
+ if (data->info()->is_typing_enabled()) {
+ flags |= JSGlobalSpecialization::kTypingEnabled;
+ }
+ JSGlobalSpecialization global_specialization(
+ &graph_reducer, data->jsgraph(), flags,
+ handle(data->info()->global_object(), data->isolate()),
+ data->info()->dependencies());
+ AddReducer(data, &graph_reducer, &dead_code_elimination);
+ AddReducer(data, &graph_reducer, &common_reducer);
+ AddReducer(data, &graph_reducer, &global_specialization);
+ graph_reducer.ReduceGraph();
+ }
+};
+
+
struct InliningPhase {
static const char* phase_name() { return "inlining"; }
@@ -512,20 +540,6 @@ struct InliningPhase {
: MaybeHandle<Context>());
JSFrameSpecialization frame_specialization(data->info()->osr_frame(),
data->jsgraph());
- JSGlobalSpecialization::Flags global_flags =
- JSGlobalSpecialization::kNoFlags;
- if (data->info()->is_deoptimization_enabled()) {
- global_flags |= JSGlobalSpecialization::kDeoptimizationEnabled;
- }
- if (data->info()->is_typing_enabled()) {
- global_flags |= JSGlobalSpecialization::kTypingEnabled;
- }
- JSGlobalSpecialization global_specialization(
- &graph_reducer, data->jsgraph(), global_flags,
- data->info()->has_global_object()
- ? handle(data->info()->global_object())
- : Handle<GlobalObject>(),
- data->info()->dependencies());
JSInliningHeuristic inlining(&graph_reducer,
data->info()->is_inlining_enabled()
? JSInliningHeuristic::kGeneralInlining
@@ -536,9 +550,6 @@ struct InliningPhase {
if (data->info()->is_frame_specializing()) {
AddReducer(data, &graph_reducer, &frame_specialization);
}
- if (data->info()->is_native_context_specializing()) {
- AddReducer(data, &graph_reducer, &global_specialization);
- }
AddReducer(data, &graph_reducer, &context_specialization);
AddReducer(data, &graph_reducer, &inlining);
graph_reducer.ReduceGraph();
@@ -1095,7 +1106,13 @@ Handle<Code> Pipeline::GenerateCode() {
RunPrintAndVerify("OSR deconstruction", true);
}
- // Perform context specialization and inlining (if enabled).
+ // Perform native context specialization (if enabled).
+ if (info()->is_native_context_specializing()) {
+ Run<NativeContextSpecializationPhase>();
+ RunPrintAndVerify("Native context specialized", true);
+ }
+
+ // Perform function context specialization and inlining (if enabled).
Run<InliningPhase>();
RunPrintAndVerify("Inlined", true);
« no previous file with comments | « src/compiler/js-inlining.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698