| OLD | NEW | 
|     1 // Copyright 2014 the V8 project authors. All rights reserved. |     1 // Copyright 2014 the V8 project authors. All rights reserved. | 
|     2 // Use of this source code is governed by a BSD-style license that can be |     2 // Use of this source code is governed by a BSD-style license that can be | 
|     3 // found in the LICENSE file. |     3 // found in the LICENSE file. | 
|     4  |     4  | 
|     5 #include "src/compiler/pipeline.h" |     5 #include "src/compiler/pipeline.h" | 
|     6  |     6  | 
|     7 #include <fstream>  // NOLINT(readability/streams) |     7 #include <fstream>  // NOLINT(readability/streams) | 
|     8 #include <sstream> |     8 #include <sstream> | 
|     9  |     9  | 
|    10 #include "src/base/adapters.h" |    10 #include "src/base/adapters.h" | 
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   359   AstGraphBuilderWithPositions(Zone* local_zone, CompilationInfo* info, |   359   AstGraphBuilderWithPositions(Zone* local_zone, CompilationInfo* info, | 
|   360                                JSGraph* jsgraph, |   360                                JSGraph* jsgraph, | 
|   361                                LoopAssignmentAnalysis* loop_assignment, |   361                                LoopAssignmentAnalysis* loop_assignment, | 
|   362                                JSTypeFeedbackTable* js_type_feedback, |   362                                JSTypeFeedbackTable* js_type_feedback, | 
|   363                                SourcePositionTable* source_positions) |   363                                SourcePositionTable* source_positions) | 
|   364       : AstGraphBuilder(local_zone, info, jsgraph, loop_assignment, |   364       : AstGraphBuilder(local_zone, info, jsgraph, loop_assignment, | 
|   365                         js_type_feedback), |   365                         js_type_feedback), | 
|   366         source_positions_(source_positions), |   366         source_positions_(source_positions), | 
|   367         start_position_(info->shared_info()->start_position()) {} |   367         start_position_(info->shared_info()->start_position()) {} | 
|   368  |   368  | 
|   369   bool CreateGraph(bool constant_context, bool stack_check) { |   369   bool CreateGraph(bool stack_check) { | 
|   370     SourcePositionTable::Scope pos_scope(source_positions_, start_position_); |   370     SourcePositionTable::Scope pos_scope(source_positions_, start_position_); | 
|   371     return AstGraphBuilder::CreateGraph(constant_context, stack_check); |   371     return AstGraphBuilder::CreateGraph(stack_check); | 
|   372   } |   372   } | 
|   373  |   373  | 
|   374 #define DEF_VISIT(type)                                               \ |   374 #define DEF_VISIT(type)                                               \ | 
|   375   void Visit##type(type* node) override {                             \ |   375   void Visit##type(type* node) override {                             \ | 
|   376     SourcePositionTable::Scope pos(source_positions_,                 \ |   376     SourcePositionTable::Scope pos(source_positions_,                 \ | 
|   377                                    SourcePosition(node->position())); \ |   377                                    SourcePosition(node->position())); \ | 
|   378     AstGraphBuilder::Visit##type(node);                               \ |   378     AstGraphBuilder::Visit##type(node);                               \ | 
|   379   } |   379   } | 
|   380   AST_NODE_LIST(DEF_VISIT) |   380   AST_NODE_LIST(DEF_VISIT) | 
|   381 #undef DEF_VISIT |   381 #undef DEF_VISIT | 
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   468     AstLoopAssignmentAnalyzer analyzer(data->graph_zone(), data->info()); |   468     AstLoopAssignmentAnalyzer analyzer(data->graph_zone(), data->info()); | 
|   469     LoopAssignmentAnalysis* loop_assignment = analyzer.Analyze(); |   469     LoopAssignmentAnalysis* loop_assignment = analyzer.Analyze(); | 
|   470     data->set_loop_assignment(loop_assignment); |   470     data->set_loop_assignment(loop_assignment); | 
|   471   } |   471   } | 
|   472 }; |   472 }; | 
|   473  |   473  | 
|   474  |   474  | 
|   475 struct GraphBuilderPhase { |   475 struct GraphBuilderPhase { | 
|   476   static const char* phase_name() { return "graph builder"; } |   476   static const char* phase_name() { return "graph builder"; } | 
|   477  |   477  | 
|   478   void Run(PipelineData* data, Zone* temp_zone, bool constant_context) { |   478   void Run(PipelineData* data, Zone* temp_zone) { | 
|   479     AstGraphBuilderWithPositions graph_builder( |   479     AstGraphBuilderWithPositions graph_builder( | 
|   480         temp_zone, data->info(), data->jsgraph(), data->loop_assignment(), |   480         temp_zone, data->info(), data->jsgraph(), data->loop_assignment(), | 
|   481         data->js_type_feedback(), data->source_positions()); |   481         data->js_type_feedback(), data->source_positions()); | 
|   482     bool stack_check = !data->info()->IsStub(); |   482     bool stack_check = !data->info()->IsStub(); | 
|   483     if (!graph_builder.CreateGraph(constant_context, stack_check)) { |   483     if (!graph_builder.CreateGraph(stack_check)) { | 
|   484       data->set_compilation_failed(); |   484       data->set_compilation_failed(); | 
|   485     } |   485     } | 
|   486   } |   486   } | 
|   487 }; |   487 }; | 
|   488  |   488  | 
|   489  |   489  | 
|   490 struct InliningPhase { |   490 struct InliningPhase { | 
|   491   static const char* phase_name() { return "inlining"; } |   491   static const char* phase_name() { return "inlining"; } | 
|   492  |   492  | 
|   493   void Run(PipelineData* data, Zone* temp_zone) { |   493   void Run(PipelineData* data, Zone* temp_zone) { | 
|   494     JSGraphReducer graph_reducer(data->jsgraph(), temp_zone); |   494     JSGraphReducer graph_reducer(data->jsgraph(), temp_zone); | 
|   495     DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(), |   495     DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(), | 
|   496                                               data->common()); |   496                                               data->common()); | 
|   497     CommonOperatorReducer common_reducer(&graph_reducer, data->graph(), |   497     CommonOperatorReducer common_reducer(&graph_reducer, data->graph(), | 
|   498                                          data->common(), data->machine()); |   498                                          data->common(), data->machine()); | 
|   499     JSContextSpecializer context_specializer(&graph_reducer, data->jsgraph()); |   499     JSContextSpecialization context_specialization( | 
 |   500         &graph_reducer, data->jsgraph(), data->info()->context()); | 
|   500     JSFrameSpecialization frame_specialization(data->info()->osr_frame(), |   501     JSFrameSpecialization frame_specialization(data->info()->osr_frame(), | 
|   501                                                data->jsgraph()); |   502                                                data->jsgraph()); | 
|   502     JSInliner inliner(&graph_reducer, data->info()->is_inlining_enabled() |   503     JSInliner inliner(&graph_reducer, data->info()->is_inlining_enabled() | 
|   503                                           ? JSInliner::kGeneralInlining |   504                                           ? JSInliner::kGeneralInlining | 
|   504                                           : JSInliner::kRestrictedInlining, |   505                                           : JSInliner::kRestrictedInlining, | 
|   505                       temp_zone, data->info(), data->jsgraph()); |   506                       temp_zone, data->info(), data->jsgraph()); | 
|   506     AddReducer(data, &graph_reducer, &dead_code_elimination); |   507     AddReducer(data, &graph_reducer, &dead_code_elimination); | 
|   507     AddReducer(data, &graph_reducer, &common_reducer); |   508     AddReducer(data, &graph_reducer, &common_reducer); | 
|   508     if (data->info()->is_frame_specializing()) { |   509     if (data->info()->is_frame_specializing()) { | 
|   509       AddReducer(data, &graph_reducer, &frame_specialization); |   510       AddReducer(data, &graph_reducer, &frame_specialization); | 
|   510     } |   511     } | 
|   511     if (data->info()->is_context_specializing()) { |   512     if (data->info()->is_context_specializing()) { | 
|   512       AddReducer(data, &graph_reducer, &context_specializer); |   513       AddReducer(data, &graph_reducer, &context_specialization); | 
|   513     } |   514     } | 
|   514     AddReducer(data, &graph_reducer, &inliner); |   515     AddReducer(data, &graph_reducer, &inliner); | 
|   515     graph_reducer.ReduceGraph(); |   516     graph_reducer.ReduceGraph(); | 
|   516   } |   517   } | 
|   517 }; |   518 }; | 
|   518  |   519  | 
|   519  |   520  | 
|   520 struct TyperPhase { |   521 struct TyperPhase { | 
|   521   static const char* phase_name() { return "typer"; } |   522   static const char* phase_name() { return "typer"; } | 
|   522  |   523  | 
| (...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1030     TurboCfgFile tcf(isolate()); |  1031     TurboCfgFile tcf(isolate()); | 
|  1031     tcf << AsC1VCompilation(info()); |  1032     tcf << AsC1VCompilation(info()); | 
|  1032   } |  1033   } | 
|  1033  |  1034  | 
|  1034   data.source_positions()->AddDecorator(); |  1035   data.source_positions()->AddDecorator(); | 
|  1035  |  1036  | 
|  1036   if (FLAG_loop_assignment_analysis) { |  1037   if (FLAG_loop_assignment_analysis) { | 
|  1037     Run<LoopAssignmentAnalysisPhase>(); |  1038     Run<LoopAssignmentAnalysisPhase>(); | 
|  1038   } |  1039   } | 
|  1039  |  1040  | 
|  1040   Run<GraphBuilderPhase>(info()->is_context_specializing()); |  1041   Run<GraphBuilderPhase>(); | 
|  1041   if (data.compilation_failed()) return Handle<Code>::null(); |  1042   if (data.compilation_failed()) return Handle<Code>::null(); | 
|  1042   RunPrintAndVerify("Initial untyped", true); |  1043   RunPrintAndVerify("Initial untyped", true); | 
|  1043  |  1044  | 
|  1044   // Perform OSR deconstruction. |  1045   // Perform OSR deconstruction. | 
|  1045   if (info()->is_osr()) { |  1046   if (info()->is_osr()) { | 
|  1046     Run<OsrDeconstructionPhase>(); |  1047     Run<OsrDeconstructionPhase>(); | 
|  1047     RunPrintAndVerify("OSR deconstruction", true); |  1048     RunPrintAndVerify("OSR deconstruction", true); | 
|  1048   } |  1049   } | 
|  1049  |  1050  | 
|  1050   // Perform context specialization and inlining (if enabled). |  1051   // Perform context specialization and inlining (if enabled). | 
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1356     tcf << AsC1VRegisterAllocationData("CodeGen", |  1357     tcf << AsC1VRegisterAllocationData("CodeGen", | 
|  1357                                        data->register_allocation_data()); |  1358                                        data->register_allocation_data()); | 
|  1358   } |  1359   } | 
|  1359  |  1360  | 
|  1360   data->DeleteRegisterAllocationZone(); |  1361   data->DeleteRegisterAllocationZone(); | 
|  1361 } |  1362 } | 
|  1362  |  1363  | 
|  1363 }  // namespace compiler |  1364 }  // namespace compiler | 
|  1364 }  // namespace internal |  1365 }  // namespace internal | 
|  1365 }  // namespace v8 |  1366 }  // namespace v8 | 
| OLD | NEW |