| 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);
|
|
|
|
|