| 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/platform/elapsed-timer.h" | 10 #include "src/base/platform/elapsed-timer.h" |
| 11 #include "src/compiler/ast-graph-builder.h" | 11 #include "src/compiler/ast-graph-builder.h" |
| 12 #include "src/compiler/ast-loop-assignment-analyzer.h" | 12 #include "src/compiler/ast-loop-assignment-analyzer.h" |
| 13 #include "src/compiler/basic-block-instrumentor.h" | 13 #include "src/compiler/basic-block-instrumentor.h" |
| 14 #include "src/compiler/change-lowering.h" | 14 #include "src/compiler/change-lowering.h" |
| 15 #include "src/compiler/code-generator.h" | 15 #include "src/compiler/code-generator.h" |
| 16 #include "src/compiler/common-operator-reducer.h" | 16 #include "src/compiler/common-operator-reducer.h" |
| 17 #include "src/compiler/control-flow-optimizer.h" | 17 #include "src/compiler/control-flow-optimizer.h" |
| 18 #include "src/compiler/control-reducer.h" | 18 #include "src/compiler/control-reducer.h" |
| 19 #include "src/compiler/graph-replay.h" | 19 #include "src/compiler/graph-replay.h" |
| 20 #include "src/compiler/graph-visualizer.h" | 20 #include "src/compiler/graph-visualizer.h" |
| 21 #include "src/compiler/instruction.h" | 21 #include "src/compiler/instruction.h" |
| 22 #include "src/compiler/instruction-selector.h" | 22 #include "src/compiler/instruction-selector.h" |
| 23 #include "src/compiler/js-builtin-reducer.h" | 23 #include "src/compiler/js-builtin-reducer.h" |
| 24 #include "src/compiler/js-context-specialization.h" | 24 #include "src/compiler/js-context-specialization.h" |
| 25 #include "src/compiler/js-generic-lowering.h" | 25 #include "src/compiler/js-generic-lowering.h" |
| 26 #include "src/compiler/js-inlining.h" | 26 #include "src/compiler/js-inlining.h" |
| 27 #include "src/compiler/js-intrinsic-lowering.h" | 27 #include "src/compiler/js-intrinsic-lowering.h" |
| 28 #include "src/compiler/js-type-feedback.h" |
| 28 #include "src/compiler/js-typed-lowering.h" | 29 #include "src/compiler/js-typed-lowering.h" |
| 29 #include "src/compiler/jump-threading.h" | 30 #include "src/compiler/jump-threading.h" |
| 30 #include "src/compiler/load-elimination.h" | 31 #include "src/compiler/load-elimination.h" |
| 31 #include "src/compiler/loop-analysis.h" | 32 #include "src/compiler/loop-analysis.h" |
| 32 #include "src/compiler/loop-peeling.h" | 33 #include "src/compiler/loop-peeling.h" |
| 33 #include "src/compiler/machine-operator-reducer.h" | 34 #include "src/compiler/machine-operator-reducer.h" |
| 34 #include "src/compiler/move-optimizer.h" | 35 #include "src/compiler/move-optimizer.h" |
| 35 #include "src/compiler/osr.h" | 36 #include "src/compiler/osr.h" |
| 36 #include "src/compiler/pipeline-statistics.h" | 37 #include "src/compiler/pipeline-statistics.h" |
| 37 #include "src/compiler/register-allocator.h" | 38 #include "src/compiler/register-allocator.h" |
| 38 #include "src/compiler/register-allocator-verifier.h" | 39 #include "src/compiler/register-allocator-verifier.h" |
| 39 #include "src/compiler/schedule.h" | 40 #include "src/compiler/schedule.h" |
| 40 #include "src/compiler/scheduler.h" | 41 #include "src/compiler/scheduler.h" |
| 41 #include "src/compiler/select-lowering.h" | 42 #include "src/compiler/select-lowering.h" |
| 42 #include "src/compiler/simplified-lowering.h" | 43 #include "src/compiler/simplified-lowering.h" |
| 43 #include "src/compiler/simplified-operator-reducer.h" | 44 #include "src/compiler/simplified-operator-reducer.h" |
| 44 #include "src/compiler/typer.h" | 45 #include "src/compiler/typer.h" |
| 45 #include "src/compiler/value-numbering-reducer.h" | 46 #include "src/compiler/value-numbering-reducer.h" |
| 46 #include "src/compiler/verifier.h" | 47 #include "src/compiler/verifier.h" |
| 47 #include "src/compiler/zone-pool.h" | 48 #include "src/compiler/zone-pool.h" |
| 48 #include "src/ostreams.h" | 49 #include "src/ostreams.h" |
| 50 #include "src/type-info.h" |
| 49 #include "src/utils.h" | 51 #include "src/utils.h" |
| 50 | 52 |
| 51 namespace v8 { | 53 namespace v8 { |
| 52 namespace internal { | 54 namespace internal { |
| 53 namespace compiler { | 55 namespace compiler { |
| 54 | 56 |
| 55 class PipelineData { | 57 class PipelineData { |
| 56 public: | 58 public: |
| 57 // For main entry point. | 59 // For main entry point. |
| 58 PipelineData(ZonePool* zone_pool, CompilationInfo* info, | 60 PipelineData(ZonePool* zone_pool, CompilationInfo* info, |
| 59 PipelineStatistics* pipeline_statistics) | 61 PipelineStatistics* pipeline_statistics) |
| 60 : isolate_(info->isolate()), | 62 : isolate_(info->isolate()), |
| 61 info_(info), | 63 info_(info), |
| 62 outer_zone_(info_->zone()), | 64 outer_zone_(info_->zone()), |
| 63 zone_pool_(zone_pool), | 65 zone_pool_(zone_pool), |
| 64 pipeline_statistics_(pipeline_statistics), | 66 pipeline_statistics_(pipeline_statistics), |
| 65 compilation_failed_(false), | 67 compilation_failed_(false), |
| 66 code_(Handle<Code>::null()), | 68 code_(Handle<Code>::null()), |
| 67 graph_zone_scope_(zone_pool_), | 69 graph_zone_scope_(zone_pool_), |
| 68 graph_zone_(graph_zone_scope_.zone()), | 70 graph_zone_(graph_zone_scope_.zone()), |
| 69 graph_(nullptr), | 71 graph_(nullptr), |
| 70 loop_assignment_(nullptr), | 72 loop_assignment_(nullptr), |
| 71 machine_(nullptr), | 73 machine_(nullptr), |
| 72 common_(nullptr), | 74 common_(nullptr), |
| 73 javascript_(nullptr), | 75 javascript_(nullptr), |
| 74 jsgraph_(nullptr), | 76 jsgraph_(nullptr), |
| 77 js_type_feedback_(nullptr), |
| 75 typer_(nullptr), | 78 typer_(nullptr), |
| 76 schedule_(nullptr), | 79 schedule_(nullptr), |
| 77 instruction_zone_scope_(zone_pool_), | 80 instruction_zone_scope_(zone_pool_), |
| 78 instruction_zone_(instruction_zone_scope_.zone()), | 81 instruction_zone_(instruction_zone_scope_.zone()), |
| 79 sequence_(nullptr), | 82 sequence_(nullptr), |
| 80 frame_(nullptr), | 83 frame_(nullptr), |
| 81 register_allocator_(nullptr) { | 84 register_allocator_(nullptr) { |
| 82 PhaseScope scope(pipeline_statistics, "init pipeline data"); | 85 PhaseScope scope(pipeline_statistics, "init pipeline data"); |
| 83 graph_ = new (graph_zone_) Graph(graph_zone_); | 86 graph_ = new (graph_zone_) Graph(graph_zone_); |
| 84 source_positions_.Reset(new SourcePositionTable(graph_)); | 87 source_positions_.Reset(new SourcePositionTable(graph_)); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 104 code_(Handle<Code>::null()), | 107 code_(Handle<Code>::null()), |
| 105 graph_zone_scope_(zone_pool_), | 108 graph_zone_scope_(zone_pool_), |
| 106 graph_zone_(nullptr), | 109 graph_zone_(nullptr), |
| 107 graph_(graph), | 110 graph_(graph), |
| 108 source_positions_(new SourcePositionTable(graph_)), | 111 source_positions_(new SourcePositionTable(graph_)), |
| 109 loop_assignment_(nullptr), | 112 loop_assignment_(nullptr), |
| 110 machine_(nullptr), | 113 machine_(nullptr), |
| 111 common_(nullptr), | 114 common_(nullptr), |
| 112 javascript_(nullptr), | 115 javascript_(nullptr), |
| 113 jsgraph_(nullptr), | 116 jsgraph_(nullptr), |
| 117 js_type_feedback_(nullptr), |
| 114 typer_(nullptr), | 118 typer_(nullptr), |
| 115 schedule_(schedule), | 119 schedule_(schedule), |
| 116 instruction_zone_scope_(zone_pool_), | 120 instruction_zone_scope_(zone_pool_), |
| 117 instruction_zone_(instruction_zone_scope_.zone()), | 121 instruction_zone_(instruction_zone_scope_.zone()), |
| 118 sequence_(nullptr), | 122 sequence_(nullptr), |
| 119 frame_(nullptr), | 123 frame_(nullptr), |
| 120 register_allocator_(nullptr) {} | 124 register_allocator_(nullptr) {} |
| 121 | 125 |
| 122 // For register allocation testing entry point. | 126 // For register allocation testing entry point. |
| 123 PipelineData(ZonePool* zone_pool, CompilationInfo* info, | 127 PipelineData(ZonePool* zone_pool, CompilationInfo* info, |
| 124 InstructionSequence* sequence) | 128 InstructionSequence* sequence) |
| 125 : isolate_(info->isolate()), | 129 : isolate_(info->isolate()), |
| 126 info_(info), | 130 info_(info), |
| 127 outer_zone_(nullptr), | 131 outer_zone_(nullptr), |
| 128 zone_pool_(zone_pool), | 132 zone_pool_(zone_pool), |
| 129 pipeline_statistics_(nullptr), | 133 pipeline_statistics_(nullptr), |
| 130 compilation_failed_(false), | 134 compilation_failed_(false), |
| 131 code_(Handle<Code>::null()), | 135 code_(Handle<Code>::null()), |
| 132 graph_zone_scope_(zone_pool_), | 136 graph_zone_scope_(zone_pool_), |
| 133 graph_zone_(nullptr), | 137 graph_zone_(nullptr), |
| 134 graph_(nullptr), | 138 graph_(nullptr), |
| 135 loop_assignment_(nullptr), | 139 loop_assignment_(nullptr), |
| 136 machine_(nullptr), | 140 machine_(nullptr), |
| 137 common_(nullptr), | 141 common_(nullptr), |
| 138 javascript_(nullptr), | 142 javascript_(nullptr), |
| 139 jsgraph_(nullptr), | 143 jsgraph_(nullptr), |
| 144 js_type_feedback_(nullptr), |
| 140 typer_(nullptr), | 145 typer_(nullptr), |
| 141 schedule_(nullptr), | 146 schedule_(nullptr), |
| 142 instruction_zone_scope_(zone_pool_), | 147 instruction_zone_scope_(zone_pool_), |
| 143 instruction_zone_(sequence->zone()), | 148 instruction_zone_(sequence->zone()), |
| 144 sequence_(sequence), | 149 sequence_(sequence), |
| 145 frame_(nullptr), | 150 frame_(nullptr), |
| 146 register_allocator_(nullptr) {} | 151 register_allocator_(nullptr) {} |
| 147 | 152 |
| 148 ~PipelineData() { | 153 ~PipelineData() { |
| 149 DeleteInstructionZone(); | 154 DeleteInstructionZone(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 167 | 172 |
| 168 Zone* graph_zone() const { return graph_zone_; } | 173 Zone* graph_zone() const { return graph_zone_; } |
| 169 Graph* graph() const { return graph_; } | 174 Graph* graph() const { return graph_; } |
| 170 SourcePositionTable* source_positions() const { | 175 SourcePositionTable* source_positions() const { |
| 171 return source_positions_.get(); | 176 return source_positions_.get(); |
| 172 } | 177 } |
| 173 MachineOperatorBuilder* machine() const { return machine_; } | 178 MachineOperatorBuilder* machine() const { return machine_; } |
| 174 CommonOperatorBuilder* common() const { return common_; } | 179 CommonOperatorBuilder* common() const { return common_; } |
| 175 JSOperatorBuilder* javascript() const { return javascript_; } | 180 JSOperatorBuilder* javascript() const { return javascript_; } |
| 176 JSGraph* jsgraph() const { return jsgraph_; } | 181 JSGraph* jsgraph() const { return jsgraph_; } |
| 182 JSTypeFeedbackTable* js_type_feedback() { return js_type_feedback_; } |
| 183 void set_js_type_feedback(JSTypeFeedbackTable* js_type_feedback) { |
| 184 js_type_feedback_ = js_type_feedback; |
| 185 } |
| 177 Typer* typer() const { return typer_.get(); } | 186 Typer* typer() const { return typer_.get(); } |
| 178 | 187 |
| 179 LoopAssignmentAnalysis* loop_assignment() const { return loop_assignment_; } | 188 LoopAssignmentAnalysis* loop_assignment() const { return loop_assignment_; } |
| 180 void set_loop_assignment(LoopAssignmentAnalysis* loop_assignment) { | 189 void set_loop_assignment(LoopAssignmentAnalysis* loop_assignment) { |
| 181 DCHECK(!loop_assignment_); | 190 DCHECK(!loop_assignment_); |
| 182 loop_assignment_ = loop_assignment; | 191 loop_assignment_ = loop_assignment; |
| 183 } | 192 } |
| 184 | 193 |
| 185 Schedule* schedule() const { return schedule_; } | 194 Schedule* schedule() const { return schedule_; } |
| 186 void set_schedule(Schedule* schedule) { | 195 void set_schedule(Schedule* schedule) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 200 if (graph_zone_ == nullptr) return; | 209 if (graph_zone_ == nullptr) return; |
| 201 // Destroy zone and clear pointers. | 210 // Destroy zone and clear pointers. |
| 202 graph_zone_scope_.Destroy(); | 211 graph_zone_scope_.Destroy(); |
| 203 graph_zone_ = nullptr; | 212 graph_zone_ = nullptr; |
| 204 graph_ = nullptr; | 213 graph_ = nullptr; |
| 205 loop_assignment_ = nullptr; | 214 loop_assignment_ = nullptr; |
| 206 machine_ = nullptr; | 215 machine_ = nullptr; |
| 207 common_ = nullptr; | 216 common_ = nullptr; |
| 208 javascript_ = nullptr; | 217 javascript_ = nullptr; |
| 209 jsgraph_ = nullptr; | 218 jsgraph_ = nullptr; |
| 219 js_type_feedback_ = nullptr; |
| 210 schedule_ = nullptr; | 220 schedule_ = nullptr; |
| 211 } | 221 } |
| 212 | 222 |
| 213 void DeleteInstructionZone() { | 223 void DeleteInstructionZone() { |
| 214 if (instruction_zone_ == nullptr) return; | 224 if (instruction_zone_ == nullptr) return; |
| 215 instruction_zone_scope_.Destroy(); | 225 instruction_zone_scope_.Destroy(); |
| 216 instruction_zone_ = nullptr; | 226 instruction_zone_ = nullptr; |
| 217 sequence_ = nullptr; | 227 sequence_ = nullptr; |
| 218 frame_ = nullptr; | 228 frame_ = nullptr; |
| 219 register_allocator_ = nullptr; | 229 register_allocator_ = nullptr; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 ZonePool::Scope graph_zone_scope_; | 262 ZonePool::Scope graph_zone_scope_; |
| 253 Zone* graph_zone_; | 263 Zone* graph_zone_; |
| 254 Graph* graph_; | 264 Graph* graph_; |
| 255 // TODO(dcarney): make this into a ZoneObject. | 265 // TODO(dcarney): make this into a ZoneObject. |
| 256 SmartPointer<SourcePositionTable> source_positions_; | 266 SmartPointer<SourcePositionTable> source_positions_; |
| 257 LoopAssignmentAnalysis* loop_assignment_; | 267 LoopAssignmentAnalysis* loop_assignment_; |
| 258 MachineOperatorBuilder* machine_; | 268 MachineOperatorBuilder* machine_; |
| 259 CommonOperatorBuilder* common_; | 269 CommonOperatorBuilder* common_; |
| 260 JSOperatorBuilder* javascript_; | 270 JSOperatorBuilder* javascript_; |
| 261 JSGraph* jsgraph_; | 271 JSGraph* jsgraph_; |
| 272 JSTypeFeedbackTable* js_type_feedback_; |
| 262 // TODO(dcarney): make this into a ZoneObject. | 273 // TODO(dcarney): make this into a ZoneObject. |
| 263 SmartPointer<Typer> typer_; | 274 SmartPointer<Typer> typer_; |
| 264 Schedule* schedule_; | 275 Schedule* schedule_; |
| 265 | 276 |
| 266 // All objects in the following group of fields are allocated in | 277 // All objects in the following group of fields are allocated in |
| 267 // instruction_zone_. They are all set to NULL when the instruction_zone_ is | 278 // instruction_zone_. They are all set to NULL when the instruction_zone_ is |
| 268 // destroyed. | 279 // destroyed. |
| 269 ZonePool::Scope instruction_zone_scope_; | 280 ZonePool::Scope instruction_zone_scope_; |
| 270 Zone* instruction_zone_; | 281 Zone* instruction_zone_; |
| 271 InstructionSequence* sequence_; | 282 InstructionSequence* sequence_; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 return info->function()->debug_name()->ToCString(); | 314 return info->function()->debug_name()->ToCString(); |
| 304 } | 315 } |
| 305 } | 316 } |
| 306 | 317 |
| 307 | 318 |
| 308 class AstGraphBuilderWithPositions : public AstGraphBuilder { | 319 class AstGraphBuilderWithPositions : public AstGraphBuilder { |
| 309 public: | 320 public: |
| 310 AstGraphBuilderWithPositions(Zone* local_zone, CompilationInfo* info, | 321 AstGraphBuilderWithPositions(Zone* local_zone, CompilationInfo* info, |
| 311 JSGraph* jsgraph, | 322 JSGraph* jsgraph, |
| 312 LoopAssignmentAnalysis* loop_assignment, | 323 LoopAssignmentAnalysis* loop_assignment, |
| 324 JSTypeFeedbackTable* js_type_feedback, |
| 313 SourcePositionTable* source_positions) | 325 SourcePositionTable* source_positions) |
| 314 : AstGraphBuilder(local_zone, info, jsgraph, loop_assignment), | 326 : AstGraphBuilder(local_zone, info, jsgraph, loop_assignment, |
| 327 js_type_feedback), |
| 315 source_positions_(source_positions), | 328 source_positions_(source_positions), |
| 316 start_position_(info->shared_info()->start_position()) {} | 329 start_position_(info->shared_info()->start_position()) {} |
| 317 | 330 |
| 318 bool CreateGraph(bool constant_context, bool stack_check) { | 331 bool CreateGraph(bool constant_context, bool stack_check) { |
| 319 SourcePositionTable::Scope pos_scope(source_positions_, start_position_); | 332 SourcePositionTable::Scope pos_scope(source_positions_, start_position_); |
| 320 return AstGraphBuilder::CreateGraph(constant_context, stack_check); | 333 return AstGraphBuilder::CreateGraph(constant_context, stack_check); |
| 321 } | 334 } |
| 322 | 335 |
| 323 #define DEF_VISIT(type) \ | 336 #define DEF_VISIT(type) \ |
| 324 void Visit##type(type* node) OVERRIDE { \ | 337 void Visit##type(type* node) OVERRIDE { \ |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 } | 425 } |
| 413 }; | 426 }; |
| 414 | 427 |
| 415 | 428 |
| 416 struct GraphBuilderPhase { | 429 struct GraphBuilderPhase { |
| 417 static const char* phase_name() { return "graph builder"; } | 430 static const char* phase_name() { return "graph builder"; } |
| 418 | 431 |
| 419 void Run(PipelineData* data, Zone* temp_zone, bool constant_context) { | 432 void Run(PipelineData* data, Zone* temp_zone, bool constant_context) { |
| 420 AstGraphBuilderWithPositions graph_builder( | 433 AstGraphBuilderWithPositions graph_builder( |
| 421 temp_zone, data->info(), data->jsgraph(), data->loop_assignment(), | 434 temp_zone, data->info(), data->jsgraph(), data->loop_assignment(), |
| 422 data->source_positions()); | 435 data->js_type_feedback(), data->source_positions()); |
| 423 bool stack_check = !data->info()->IsStub(); | 436 bool stack_check = !data->info()->IsStub(); |
| 424 if (!graph_builder.CreateGraph(constant_context, stack_check)) { | 437 if (!graph_builder.CreateGraph(constant_context, stack_check)) { |
| 425 data->set_compilation_failed(); | 438 data->set_compilation_failed(); |
| 426 } | 439 } |
| 427 } | 440 } |
| 428 }; | 441 }; |
| 429 | 442 |
| 430 | 443 |
| 431 struct ContextSpecializerPhase { | 444 struct ContextSpecializerPhase { |
| 432 static const char* phase_name() { return "context specializing"; } | 445 static const char* phase_name() { return "context specializing"; } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 SourcePositionTable::Scope pos(data->source_positions(), | 486 SourcePositionTable::Scope pos(data->source_positions(), |
| 474 SourcePosition::Unknown()); | 487 SourcePosition::Unknown()); |
| 475 OsrHelper osr_helper(data->info()); | 488 OsrHelper osr_helper(data->info()); |
| 476 bool success = | 489 bool success = |
| 477 osr_helper.Deconstruct(data->jsgraph(), data->common(), temp_zone); | 490 osr_helper.Deconstruct(data->jsgraph(), data->common(), temp_zone); |
| 478 if (!success) data->info()->RetryOptimization(kOsrCompileFailed); | 491 if (!success) data->info()->RetryOptimization(kOsrCompileFailed); |
| 479 } | 492 } |
| 480 }; | 493 }; |
| 481 | 494 |
| 482 | 495 |
| 496 struct JSTypeFeedbackPhase { |
| 497 static const char* phase_name() { return "type feedback specializing"; } |
| 498 |
| 499 void Run(PipelineData* data, Zone* temp_zone) { |
| 500 SourcePositionTable::Scope pos(data->source_positions(), |
| 501 SourcePosition::Unknown()); |
| 502 Handle<Context> native_context(data->info()->context()->native_context()); |
| 503 TypeFeedbackOracle oracle(data->isolate(), temp_zone, |
| 504 data->info()->unoptimized_code(), |
| 505 data->info()->feedback_vector(), native_context); |
| 506 GraphReducer graph_reducer(data->graph(), temp_zone); |
| 507 JSTypeFeedbackSpecializer specializer(data->jsgraph(), |
| 508 data->js_type_feedback(), &oracle); |
| 509 AddReducer(data, &graph_reducer, &specializer); |
| 510 graph_reducer.ReduceGraph(); |
| 511 } |
| 512 }; |
| 513 |
| 514 |
| 483 struct TypedLoweringPhase { | 515 struct TypedLoweringPhase { |
| 484 static const char* phase_name() { return "typed lowering"; } | 516 static const char* phase_name() { return "typed lowering"; } |
| 485 | 517 |
| 486 void Run(PipelineData* data, Zone* temp_zone) { | 518 void Run(PipelineData* data, Zone* temp_zone) { |
| 487 SourcePositionTable::Scope pos(data->source_positions(), | 519 SourcePositionTable::Scope pos(data->source_positions(), |
| 488 SourcePosition::Unknown()); | 520 SourcePosition::Unknown()); |
| 489 LoadElimination load_elimination; | 521 LoadElimination load_elimination; |
| 490 JSBuiltinReducer builtin_reducer(data->jsgraph()); | 522 JSBuiltinReducer builtin_reducer(data->jsgraph()); |
| 491 JSTypedLowering typed_lowering(data->jsgraph(), temp_zone); | 523 JSTypedLowering typed_lowering(data->jsgraph(), temp_zone); |
| 492 JSIntrinsicLowering intrinsic_lowering(data->jsgraph()); | 524 JSIntrinsicLowering intrinsic_lowering(data->jsgraph()); |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 877 } | 909 } |
| 878 } | 910 } |
| 879 json_of << "\",\n\"phases\":["; | 911 json_of << "\",\n\"phases\":["; |
| 880 fclose(json_file); | 912 fclose(json_file); |
| 881 } | 913 } |
| 882 } | 914 } |
| 883 | 915 |
| 884 PipelineData data(&zone_pool, info(), pipeline_statistics.get()); | 916 PipelineData data(&zone_pool, info(), pipeline_statistics.get()); |
| 885 this->data_ = &data; | 917 this->data_ = &data; |
| 886 | 918 |
| 919 if (info()->is_type_feedback_enabled()) { |
| 920 data.set_js_type_feedback(new (data.graph_zone()) |
| 921 JSTypeFeedbackTable(data.graph_zone())); |
| 922 } |
| 923 |
| 887 BeginPhaseKind("graph creation"); | 924 BeginPhaseKind("graph creation"); |
| 888 | 925 |
| 889 if (FLAG_trace_turbo) { | 926 if (FLAG_trace_turbo) { |
| 890 OFStream os(stdout); | 927 OFStream os(stdout); |
| 891 os << "---------------------------------------------------\n" | 928 os << "---------------------------------------------------\n" |
| 892 << "Begin compiling method " << GetDebugName(info()).get() | 929 << "Begin compiling method " << GetDebugName(info()).get() |
| 893 << " using Turbofan" << std::endl; | 930 << " using Turbofan" << std::endl; |
| 894 TurboCfgFile tcf(isolate()); | 931 TurboCfgFile tcf(isolate()); |
| 895 tcf << AsC1VCompilation(info()); | 932 tcf << AsC1VCompilation(info()); |
| 896 } | 933 } |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 944 Run<StressLoopPeelingPhase>(); | 981 Run<StressLoopPeelingPhase>(); |
| 945 RunPrintAndVerify("Loop peeled", true); | 982 RunPrintAndVerify("Loop peeled", true); |
| 946 } | 983 } |
| 947 | 984 |
| 948 if (info()->is_osr()) { | 985 if (info()->is_osr()) { |
| 949 Run<OsrDeconstructionPhase>(); | 986 Run<OsrDeconstructionPhase>(); |
| 950 if (info()->bailout_reason() != kNoReason) return Handle<Code>::null(); | 987 if (info()->bailout_reason() != kNoReason) return Handle<Code>::null(); |
| 951 RunPrintAndVerify("OSR deconstruction"); | 988 RunPrintAndVerify("OSR deconstruction"); |
| 952 } | 989 } |
| 953 | 990 |
| 991 if (info()->is_type_feedback_enabled()) { |
| 992 Run<JSTypeFeedbackPhase>(); |
| 993 RunPrintAndVerify("JSType feedback"); |
| 994 } |
| 995 |
| 954 // Lower simplified operators and insert changes. | 996 // Lower simplified operators and insert changes. |
| 955 Run<SimplifiedLoweringPhase>(); | 997 Run<SimplifiedLoweringPhase>(); |
| 956 RunPrintAndVerify("Lowered simplified"); | 998 RunPrintAndVerify("Lowered simplified"); |
| 957 | 999 |
| 958 // Optimize control flow. | 1000 // Optimize control flow. |
| 959 if (FLAG_turbo_cf_optimization) { | 1001 if (FLAG_turbo_cf_optimization) { |
| 960 Run<ControlFlowOptimizationPhase>(); | 1002 Run<ControlFlowOptimizationPhase>(); |
| 961 RunPrintAndVerify("Control flow optimized"); | 1003 RunPrintAndVerify("Control flow optimized"); |
| 962 } | 1004 } |
| 963 | 1005 |
| 964 // Lower changes that have been inserted before. | 1006 // Lower changes that have been inserted before. |
| 965 Run<ChangeLoweringPhase>(); | 1007 Run<ChangeLoweringPhase>(); |
| 966 // // TODO(jarin, rossberg): Remove UNTYPED once machine typing works. | 1008 // TODO(jarin, rossberg): Remove UNTYPED once machine typing works. |
| 967 RunPrintAndVerify("Lowered changes", true); | 1009 RunPrintAndVerify("Lowered changes", true); |
| 968 | 1010 |
| 969 Run<LateControlReductionPhase>(); | 1011 Run<LateControlReductionPhase>(); |
| 970 RunPrintAndVerify("Late Control reduced"); | 1012 RunPrintAndVerify("Late Control reduced"); |
| 971 } else { | 1013 } else { |
| 972 if (info()->is_osr()) { | 1014 if (info()->is_osr()) { |
| 973 Run<OsrDeconstructionPhase>(); | 1015 Run<OsrDeconstructionPhase>(); |
| 974 if (info()->bailout_reason() != kNoReason) return Handle<Code>::null(); | 1016 if (info()->bailout_reason() != kNoReason) return Handle<Code>::null(); |
| 975 RunPrintAndVerify("OSR deconstruction"); | 1017 RunPrintAndVerify("OSR deconstruction"); |
| 976 } | 1018 } |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1194 | 1236 |
| 1195 if (FLAG_trace_turbo && !data->MayHaveUnverifiableGraph()) { | 1237 if (FLAG_trace_turbo && !data->MayHaveUnverifiableGraph()) { |
| 1196 TurboCfgFile tcf(data->isolate()); | 1238 TurboCfgFile tcf(data->isolate()); |
| 1197 tcf << AsC1VAllocator("CodeGen", data->register_allocator()); | 1239 tcf << AsC1VAllocator("CodeGen", data->register_allocator()); |
| 1198 } | 1240 } |
| 1199 } | 1241 } |
| 1200 | 1242 |
| 1201 } // namespace compiler | 1243 } // namespace compiler |
| 1202 } // namespace internal | 1244 } // namespace internal |
| 1203 } // namespace v8 | 1245 } // namespace v8 |
| OLD | NEW |