| 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 16 matching lines...) Expand all Loading... |
| 27 #include "src/compiler/instruction.h" | 27 #include "src/compiler/instruction.h" |
| 28 #include "src/compiler/instruction-selector.h" | 28 #include "src/compiler/instruction-selector.h" |
| 29 #include "src/compiler/js-builtin-reducer.h" | 29 #include "src/compiler/js-builtin-reducer.h" |
| 30 #include "src/compiler/js-context-relaxation.h" | 30 #include "src/compiler/js-context-relaxation.h" |
| 31 #include "src/compiler/js-context-specialization.h" | 31 #include "src/compiler/js-context-specialization.h" |
| 32 #include "src/compiler/js-frame-specialization.h" | 32 #include "src/compiler/js-frame-specialization.h" |
| 33 #include "src/compiler/js-generic-lowering.h" | 33 #include "src/compiler/js-generic-lowering.h" |
| 34 #include "src/compiler/js-inlining-heuristic.h" | 34 #include "src/compiler/js-inlining-heuristic.h" |
| 35 #include "src/compiler/js-intrinsic-lowering.h" | 35 #include "src/compiler/js-intrinsic-lowering.h" |
| 36 #include "src/compiler/js-native-context-specialization.h" | 36 #include "src/compiler/js-native-context-specialization.h" |
| 37 #include "src/compiler/js-type-feedback.h" | |
| 38 #include "src/compiler/js-type-feedback-lowering.h" | |
| 39 #include "src/compiler/js-typed-lowering.h" | 37 #include "src/compiler/js-typed-lowering.h" |
| 40 #include "src/compiler/jump-threading.h" | 38 #include "src/compiler/jump-threading.h" |
| 41 #include "src/compiler/live-range-separator.h" | 39 #include "src/compiler/live-range-separator.h" |
| 42 #include "src/compiler/load-elimination.h" | 40 #include "src/compiler/load-elimination.h" |
| 43 #include "src/compiler/loop-analysis.h" | 41 #include "src/compiler/loop-analysis.h" |
| 44 #include "src/compiler/loop-peeling.h" | 42 #include "src/compiler/loop-peeling.h" |
| 45 #include "src/compiler/machine-operator-reducer.h" | 43 #include "src/compiler/machine-operator-reducer.h" |
| 46 #include "src/compiler/move-optimizer.h" | 44 #include "src/compiler/move-optimizer.h" |
| 47 #include "src/compiler/osr.h" | 45 #include "src/compiler/osr.h" |
| 48 #include "src/compiler/pipeline-statistics.h" | 46 #include "src/compiler/pipeline-statistics.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 code_(Handle<Code>::null()), | 80 code_(Handle<Code>::null()), |
| 83 graph_zone_scope_(zone_pool_), | 81 graph_zone_scope_(zone_pool_), |
| 84 graph_zone_(graph_zone_scope_.zone()), | 82 graph_zone_(graph_zone_scope_.zone()), |
| 85 graph_(nullptr), | 83 graph_(nullptr), |
| 86 loop_assignment_(nullptr), | 84 loop_assignment_(nullptr), |
| 87 simplified_(nullptr), | 85 simplified_(nullptr), |
| 88 machine_(nullptr), | 86 machine_(nullptr), |
| 89 common_(nullptr), | 87 common_(nullptr), |
| 90 javascript_(nullptr), | 88 javascript_(nullptr), |
| 91 jsgraph_(nullptr), | 89 jsgraph_(nullptr), |
| 92 js_type_feedback_(nullptr), | |
| 93 schedule_(nullptr), | 90 schedule_(nullptr), |
| 94 instruction_zone_scope_(zone_pool_), | 91 instruction_zone_scope_(zone_pool_), |
| 95 instruction_zone_(instruction_zone_scope_.zone()), | 92 instruction_zone_(instruction_zone_scope_.zone()), |
| 96 sequence_(nullptr), | 93 sequence_(nullptr), |
| 97 frame_(nullptr), | 94 frame_(nullptr), |
| 98 register_allocation_zone_scope_(zone_pool_), | 95 register_allocation_zone_scope_(zone_pool_), |
| 99 register_allocation_zone_(register_allocation_zone_scope_.zone()), | 96 register_allocation_zone_(register_allocation_zone_scope_.zone()), |
| 100 register_allocation_data_(nullptr) { | 97 register_allocation_data_(nullptr) { |
| 101 PhaseScope scope(pipeline_statistics, "init pipeline data"); | 98 PhaseScope scope(pipeline_statistics, "init pipeline data"); |
| 102 graph_ = new (graph_zone_) Graph(graph_zone_); | 99 graph_ = new (graph_zone_) Graph(graph_zone_); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 124 graph_zone_scope_(zone_pool_), | 121 graph_zone_scope_(zone_pool_), |
| 125 graph_zone_(nullptr), | 122 graph_zone_(nullptr), |
| 126 graph_(graph), | 123 graph_(graph), |
| 127 source_positions_(new SourcePositionTable(graph_)), | 124 source_positions_(new SourcePositionTable(graph_)), |
| 128 loop_assignment_(nullptr), | 125 loop_assignment_(nullptr), |
| 129 simplified_(nullptr), | 126 simplified_(nullptr), |
| 130 machine_(nullptr), | 127 machine_(nullptr), |
| 131 common_(nullptr), | 128 common_(nullptr), |
| 132 javascript_(nullptr), | 129 javascript_(nullptr), |
| 133 jsgraph_(nullptr), | 130 jsgraph_(nullptr), |
| 134 js_type_feedback_(nullptr), | |
| 135 schedule_(schedule), | 131 schedule_(schedule), |
| 136 instruction_zone_scope_(zone_pool_), | 132 instruction_zone_scope_(zone_pool_), |
| 137 instruction_zone_(instruction_zone_scope_.zone()), | 133 instruction_zone_(instruction_zone_scope_.zone()), |
| 138 sequence_(nullptr), | 134 sequence_(nullptr), |
| 139 frame_(nullptr), | 135 frame_(nullptr), |
| 140 register_allocation_zone_scope_(zone_pool_), | 136 register_allocation_zone_scope_(zone_pool_), |
| 141 register_allocation_zone_(register_allocation_zone_scope_.zone()), | 137 register_allocation_zone_(register_allocation_zone_scope_.zone()), |
| 142 register_allocation_data_(nullptr) {} | 138 register_allocation_data_(nullptr) {} |
| 143 | 139 |
| 144 // For register allocation testing entry point. | 140 // For register allocation testing entry point. |
| 145 PipelineData(ZonePool* zone_pool, CompilationInfo* info, | 141 PipelineData(ZonePool* zone_pool, CompilationInfo* info, |
| 146 InstructionSequence* sequence) | 142 InstructionSequence* sequence) |
| 147 : isolate_(info->isolate()), | 143 : isolate_(info->isolate()), |
| 148 info_(info), | 144 info_(info), |
| 149 outer_zone_(nullptr), | 145 outer_zone_(nullptr), |
| 150 zone_pool_(zone_pool), | 146 zone_pool_(zone_pool), |
| 151 pipeline_statistics_(nullptr), | 147 pipeline_statistics_(nullptr), |
| 152 compilation_failed_(false), | 148 compilation_failed_(false), |
| 153 code_(Handle<Code>::null()), | 149 code_(Handle<Code>::null()), |
| 154 graph_zone_scope_(zone_pool_), | 150 graph_zone_scope_(zone_pool_), |
| 155 graph_zone_(nullptr), | 151 graph_zone_(nullptr), |
| 156 graph_(nullptr), | 152 graph_(nullptr), |
| 157 loop_assignment_(nullptr), | 153 loop_assignment_(nullptr), |
| 158 simplified_(nullptr), | 154 simplified_(nullptr), |
| 159 machine_(nullptr), | 155 machine_(nullptr), |
| 160 common_(nullptr), | 156 common_(nullptr), |
| 161 javascript_(nullptr), | 157 javascript_(nullptr), |
| 162 jsgraph_(nullptr), | 158 jsgraph_(nullptr), |
| 163 js_type_feedback_(nullptr), | |
| 164 schedule_(nullptr), | 159 schedule_(nullptr), |
| 165 instruction_zone_scope_(zone_pool_), | 160 instruction_zone_scope_(zone_pool_), |
| 166 instruction_zone_(sequence->zone()), | 161 instruction_zone_(sequence->zone()), |
| 167 sequence_(sequence), | 162 sequence_(sequence), |
| 168 frame_(nullptr), | 163 frame_(nullptr), |
| 169 register_allocation_zone_scope_(zone_pool_), | 164 register_allocation_zone_scope_(zone_pool_), |
| 170 register_allocation_zone_(register_allocation_zone_scope_.zone()), | 165 register_allocation_zone_(register_allocation_zone_scope_.zone()), |
| 171 register_allocation_data_(nullptr) {} | 166 register_allocation_data_(nullptr) {} |
| 172 | 167 |
| 173 ~PipelineData() { | 168 ~PipelineData() { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 193 | 188 |
| 194 Zone* graph_zone() const { return graph_zone_; } | 189 Zone* graph_zone() const { return graph_zone_; } |
| 195 Graph* graph() const { return graph_; } | 190 Graph* graph() const { return graph_; } |
| 196 SourcePositionTable* source_positions() const { | 191 SourcePositionTable* source_positions() const { |
| 197 return source_positions_.get(); | 192 return source_positions_.get(); |
| 198 } | 193 } |
| 199 MachineOperatorBuilder* machine() const { return machine_; } | 194 MachineOperatorBuilder* machine() const { return machine_; } |
| 200 CommonOperatorBuilder* common() const { return common_; } | 195 CommonOperatorBuilder* common() const { return common_; } |
| 201 JSOperatorBuilder* javascript() const { return javascript_; } | 196 JSOperatorBuilder* javascript() const { return javascript_; } |
| 202 JSGraph* jsgraph() const { return jsgraph_; } | 197 JSGraph* jsgraph() const { return jsgraph_; } |
| 203 JSTypeFeedbackTable* js_type_feedback() { return js_type_feedback_; } | |
| 204 void set_js_type_feedback(JSTypeFeedbackTable* js_type_feedback) { | |
| 205 js_type_feedback_ = js_type_feedback; | |
| 206 } | |
| 207 | 198 |
| 208 LoopAssignmentAnalysis* loop_assignment() const { return loop_assignment_; } | 199 LoopAssignmentAnalysis* loop_assignment() const { return loop_assignment_; } |
| 209 void set_loop_assignment(LoopAssignmentAnalysis* loop_assignment) { | 200 void set_loop_assignment(LoopAssignmentAnalysis* loop_assignment) { |
| 210 DCHECK(!loop_assignment_); | 201 DCHECK(!loop_assignment_); |
| 211 loop_assignment_ = loop_assignment; | 202 loop_assignment_ = loop_assignment; |
| 212 } | 203 } |
| 213 | 204 |
| 214 Schedule* schedule() const { return schedule_; } | 205 Schedule* schedule() const { return schedule_; } |
| 215 void set_schedule(Schedule* schedule) { | 206 void set_schedule(Schedule* schedule) { |
| 216 DCHECK(!schedule_); | 207 DCHECK(!schedule_); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 233 // Destroy zone and clear pointers. | 224 // Destroy zone and clear pointers. |
| 234 graph_zone_scope_.Destroy(); | 225 graph_zone_scope_.Destroy(); |
| 235 graph_zone_ = nullptr; | 226 graph_zone_ = nullptr; |
| 236 graph_ = nullptr; | 227 graph_ = nullptr; |
| 237 loop_assignment_ = nullptr; | 228 loop_assignment_ = nullptr; |
| 238 simplified_ = nullptr; | 229 simplified_ = nullptr; |
| 239 machine_ = nullptr; | 230 machine_ = nullptr; |
| 240 common_ = nullptr; | 231 common_ = nullptr; |
| 241 javascript_ = nullptr; | 232 javascript_ = nullptr; |
| 242 jsgraph_ = nullptr; | 233 jsgraph_ = nullptr; |
| 243 js_type_feedback_ = nullptr; | |
| 244 schedule_ = nullptr; | 234 schedule_ = nullptr; |
| 245 } | 235 } |
| 246 | 236 |
| 247 void DeleteInstructionZone() { | 237 void DeleteInstructionZone() { |
| 248 if (instruction_zone_ == nullptr) return; | 238 if (instruction_zone_ == nullptr) return; |
| 249 instruction_zone_scope_.Destroy(); | 239 instruction_zone_scope_.Destroy(); |
| 250 instruction_zone_ = nullptr; | 240 instruction_zone_ = nullptr; |
| 251 sequence_ = nullptr; | 241 sequence_ = nullptr; |
| 252 frame_ = nullptr; | 242 frame_ = nullptr; |
| 253 } | 243 } |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 Zone* graph_zone_; | 291 Zone* graph_zone_; |
| 302 Graph* graph_; | 292 Graph* graph_; |
| 303 // TODO(dcarney): make this into a ZoneObject. | 293 // TODO(dcarney): make this into a ZoneObject. |
| 304 base::SmartPointer<SourcePositionTable> source_positions_; | 294 base::SmartPointer<SourcePositionTable> source_positions_; |
| 305 LoopAssignmentAnalysis* loop_assignment_; | 295 LoopAssignmentAnalysis* loop_assignment_; |
| 306 SimplifiedOperatorBuilder* simplified_; | 296 SimplifiedOperatorBuilder* simplified_; |
| 307 MachineOperatorBuilder* machine_; | 297 MachineOperatorBuilder* machine_; |
| 308 CommonOperatorBuilder* common_; | 298 CommonOperatorBuilder* common_; |
| 309 JSOperatorBuilder* javascript_; | 299 JSOperatorBuilder* javascript_; |
| 310 JSGraph* jsgraph_; | 300 JSGraph* jsgraph_; |
| 311 JSTypeFeedbackTable* js_type_feedback_; | |
| 312 Schedule* schedule_; | 301 Schedule* schedule_; |
| 313 | 302 |
| 314 // All objects in the following group of fields are allocated in | 303 // All objects in the following group of fields are allocated in |
| 315 // instruction_zone_. They are all set to NULL when the instruction_zone_ is | 304 // instruction_zone_. They are all set to NULL when the instruction_zone_ is |
| 316 // destroyed. | 305 // destroyed. |
| 317 ZonePool::Scope instruction_zone_scope_; | 306 ZonePool::Scope instruction_zone_scope_; |
| 318 Zone* instruction_zone_; | 307 Zone* instruction_zone_; |
| 319 InstructionSequence* sequence_; | 308 InstructionSequence* sequence_; |
| 320 Frame* frame_; | 309 Frame* frame_; |
| 321 | 310 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 OFStream os(stdout); | 348 OFStream os(stdout); |
| 360 os << "-- Schedule --------------------------------------\n" << *schedule; | 349 os << "-- Schedule --------------------------------------\n" << *schedule; |
| 361 } | 350 } |
| 362 | 351 |
| 363 | 352 |
| 364 class AstGraphBuilderWithPositions final : public AstGraphBuilder { | 353 class AstGraphBuilderWithPositions final : public AstGraphBuilder { |
| 365 public: | 354 public: |
| 366 AstGraphBuilderWithPositions(Zone* local_zone, CompilationInfo* info, | 355 AstGraphBuilderWithPositions(Zone* local_zone, CompilationInfo* info, |
| 367 JSGraph* jsgraph, | 356 JSGraph* jsgraph, |
| 368 LoopAssignmentAnalysis* loop_assignment, | 357 LoopAssignmentAnalysis* loop_assignment, |
| 369 JSTypeFeedbackTable* js_type_feedback, | |
| 370 SourcePositionTable* source_positions) | 358 SourcePositionTable* source_positions) |
| 371 : AstGraphBuilder(local_zone, info, jsgraph, loop_assignment, | 359 : AstGraphBuilder(local_zone, info, jsgraph, loop_assignment), |
| 372 js_type_feedback), | |
| 373 source_positions_(source_positions), | 360 source_positions_(source_positions), |
| 374 start_position_(info->shared_info()->start_position()) {} | 361 start_position_(info->shared_info()->start_position()) {} |
| 375 | 362 |
| 376 bool CreateGraph(bool stack_check) { | 363 bool CreateGraph(bool stack_check) { |
| 377 SourcePositionTable::Scope pos_scope(source_positions_, start_position_); | 364 SourcePositionTable::Scope pos_scope(source_positions_, start_position_); |
| 378 return AstGraphBuilder::CreateGraph(stack_check); | 365 return AstGraphBuilder::CreateGraph(stack_check); |
| 379 } | 366 } |
| 380 | 367 |
| 381 #define DEF_VISIT(type) \ | 368 #define DEF_VISIT(type) \ |
| 382 void Visit##type(type* node) override { \ | 369 void Visit##type(type* node) override { \ |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 bool stack_check = !data->info()->IsStub(); | 473 bool stack_check = !data->info()->IsStub(); |
| 487 bool succeeded = false; | 474 bool succeeded = false; |
| 488 | 475 |
| 489 if (data->info()->shared_info()->HasBytecodeArray()) { | 476 if (data->info()->shared_info()->HasBytecodeArray()) { |
| 490 BytecodeGraphBuilder graph_builder(temp_zone, data->info(), | 477 BytecodeGraphBuilder graph_builder(temp_zone, data->info(), |
| 491 data->jsgraph()); | 478 data->jsgraph()); |
| 492 succeeded = graph_builder.CreateGraph(stack_check); | 479 succeeded = graph_builder.CreateGraph(stack_check); |
| 493 } else { | 480 } else { |
| 494 AstGraphBuilderWithPositions graph_builder( | 481 AstGraphBuilderWithPositions graph_builder( |
| 495 temp_zone, data->info(), data->jsgraph(), data->loop_assignment(), | 482 temp_zone, data->info(), data->jsgraph(), data->loop_assignment(), |
| 496 data->js_type_feedback(), data->source_positions()); | 483 data->source_positions()); |
| 497 succeeded = graph_builder.CreateGraph(stack_check); | 484 succeeded = graph_builder.CreateGraph(stack_check); |
| 498 } | 485 } |
| 499 | 486 |
| 500 if (!succeeded) { | 487 if (!succeeded) { |
| 501 data->set_compilation_failed(); | 488 data->set_compilation_failed(); |
| 502 } | 489 } |
| 503 } | 490 } |
| 504 }; | 491 }; |
| 505 | 492 |
| 506 | 493 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 struct OsrDeconstructionPhase { | 563 struct OsrDeconstructionPhase { |
| 577 static const char* phase_name() { return "OSR deconstruction"; } | 564 static const char* phase_name() { return "OSR deconstruction"; } |
| 578 | 565 |
| 579 void Run(PipelineData* data, Zone* temp_zone) { | 566 void Run(PipelineData* data, Zone* temp_zone) { |
| 580 OsrHelper osr_helper(data->info()); | 567 OsrHelper osr_helper(data->info()); |
| 581 osr_helper.Deconstruct(data->jsgraph(), data->common(), temp_zone); | 568 osr_helper.Deconstruct(data->jsgraph(), data->common(), temp_zone); |
| 582 } | 569 } |
| 583 }; | 570 }; |
| 584 | 571 |
| 585 | 572 |
| 586 struct JSTypeFeedbackPhase { | |
| 587 static const char* phase_name() { return "type feedback specializing"; } | |
| 588 | |
| 589 void Run(PipelineData* data, Zone* temp_zone) { | |
| 590 Handle<Context> native_context(data->info()->context()->native_context()); | |
| 591 TypeFeedbackOracle oracle(data->isolate(), temp_zone, | |
| 592 data->info()->unoptimized_code(), | |
| 593 data->info()->feedback_vector(), native_context); | |
| 594 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone); | |
| 595 Handle<GlobalObject> global_object = Handle<GlobalObject>::null(); | |
| 596 if (data->info()->has_global_object()) { | |
| 597 global_object = | |
| 598 Handle<GlobalObject>(data->info()->global_object(), data->isolate()); | |
| 599 } | |
| 600 // TODO(titzer): introduce a specialization mode/flags enum to control | |
| 601 // specializing to the global object here. | |
| 602 JSTypeFeedbackSpecializer specializer( | |
| 603 &graph_reducer, data->jsgraph(), data->js_type_feedback(), &oracle, | |
| 604 global_object, data->info()->is_deoptimization_enabled() | |
| 605 ? JSTypeFeedbackSpecializer::kDeoptimizationEnabled | |
| 606 : JSTypeFeedbackSpecializer::kDeoptimizationDisabled, | |
| 607 data->info()->dependencies()); | |
| 608 AddReducer(data, &graph_reducer, &specializer); | |
| 609 graph_reducer.ReduceGraph(); | |
| 610 } | |
| 611 }; | |
| 612 | |
| 613 | |
| 614 struct TypedLoweringPhase { | 573 struct TypedLoweringPhase { |
| 615 static const char* phase_name() { return "typed lowering"; } | 574 static const char* phase_name() { return "typed lowering"; } |
| 616 | 575 |
| 617 void Run(PipelineData* data, Zone* temp_zone) { | 576 void Run(PipelineData* data, Zone* temp_zone) { |
| 618 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone); | 577 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone); |
| 619 DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(), | 578 DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(), |
| 620 data->common()); | 579 data->common()); |
| 621 LoadElimination load_elimination(&graph_reducer); | 580 LoadElimination load_elimination(&graph_reducer); |
| 622 JSBuiltinReducer builtin_reducer(&graph_reducer, data->jsgraph()); | 581 JSBuiltinReducer builtin_reducer(&graph_reducer, data->jsgraph()); |
| 623 JSTypedLowering typed_lowering(&graph_reducer, data->jsgraph(), temp_zone); | 582 JSTypedLowering typed_lowering(&graph_reducer, data->jsgraph(), temp_zone); |
| 624 JSTypeFeedbackLowering type_feedback_lowering( | |
| 625 &graph_reducer, data->info()->is_deoptimization_enabled() | |
| 626 ? JSTypeFeedbackLowering::kDeoptimizationEnabled | |
| 627 : JSTypeFeedbackLowering::kNoFlags, | |
| 628 data->jsgraph()); | |
| 629 JSIntrinsicLowering intrinsic_lowering( | 583 JSIntrinsicLowering intrinsic_lowering( |
| 630 &graph_reducer, data->jsgraph(), | 584 &graph_reducer, data->jsgraph(), |
| 631 data->info()->is_deoptimization_enabled() | 585 data->info()->is_deoptimization_enabled() |
| 632 ? JSIntrinsicLowering::kDeoptimizationEnabled | 586 ? JSIntrinsicLowering::kDeoptimizationEnabled |
| 633 : JSIntrinsicLowering::kDeoptimizationDisabled); | 587 : JSIntrinsicLowering::kDeoptimizationDisabled); |
| 634 CommonOperatorReducer common_reducer(&graph_reducer, data->graph(), | 588 CommonOperatorReducer common_reducer(&graph_reducer, data->graph(), |
| 635 data->common(), data->machine()); | 589 data->common(), data->machine()); |
| 636 AddReducer(data, &graph_reducer, &dead_code_elimination); | 590 AddReducer(data, &graph_reducer, &dead_code_elimination); |
| 637 AddReducer(data, &graph_reducer, &builtin_reducer); | 591 AddReducer(data, &graph_reducer, &builtin_reducer); |
| 638 AddReducer(data, &graph_reducer, &typed_lowering); | 592 AddReducer(data, &graph_reducer, &typed_lowering); |
| 639 AddReducer(data, &graph_reducer, &intrinsic_lowering); | 593 AddReducer(data, &graph_reducer, &intrinsic_lowering); |
| 640 AddReducer(data, &graph_reducer, &type_feedback_lowering); | |
| 641 AddReducer(data, &graph_reducer, &load_elimination); | 594 AddReducer(data, &graph_reducer, &load_elimination); |
| 642 AddReducer(data, &graph_reducer, &common_reducer); | 595 AddReducer(data, &graph_reducer, &common_reducer); |
| 643 graph_reducer.ReduceGraph(); | 596 graph_reducer.ReduceGraph(); |
| 644 } | 597 } |
| 645 }; | 598 }; |
| 646 | 599 |
| 647 | 600 |
| 648 struct BranchEliminationPhase { | 601 struct BranchEliminationPhase { |
| 649 static const char* phase_name() { return "branch condition elimination"; } | 602 static const char* phase_name() { return "branch condition elimination"; } |
| 650 | 603 |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1088 } | 1041 } |
| 1089 } | 1042 } |
| 1090 json_of << "\",\n\"phases\":["; | 1043 json_of << "\",\n\"phases\":["; |
| 1091 fclose(json_file); | 1044 fclose(json_file); |
| 1092 } | 1045 } |
| 1093 } | 1046 } |
| 1094 | 1047 |
| 1095 PipelineData data(&zone_pool, info(), pipeline_statistics.get()); | 1048 PipelineData data(&zone_pool, info(), pipeline_statistics.get()); |
| 1096 this->data_ = &data; | 1049 this->data_ = &data; |
| 1097 | 1050 |
| 1098 if (info()->is_type_feedback_enabled()) { | |
| 1099 data.set_js_type_feedback(new (data.graph_zone()) | |
| 1100 JSTypeFeedbackTable(data.graph_zone())); | |
| 1101 } | |
| 1102 | |
| 1103 BeginPhaseKind("graph creation"); | 1051 BeginPhaseKind("graph creation"); |
| 1104 | 1052 |
| 1105 if (FLAG_trace_turbo) { | 1053 if (FLAG_trace_turbo) { |
| 1106 OFStream os(stdout); | 1054 OFStream os(stdout); |
| 1107 os << "---------------------------------------------------\n" | 1055 os << "---------------------------------------------------\n" |
| 1108 << "Begin compiling method " << info()->GetDebugName().get() | 1056 << "Begin compiling method " << info()->GetDebugName().get() |
| 1109 << " using Turbofan" << std::endl; | 1057 << " using Turbofan" << std::endl; |
| 1110 TurboCfgFile tcf(isolate()); | 1058 TurboCfgFile tcf(isolate()); |
| 1111 tcf << AsC1VCompilation(info()); | 1059 tcf << AsC1VCompilation(info()); |
| 1112 } | 1060 } |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1159 if (info()->is_typing_enabled()) { | 1107 if (info()->is_typing_enabled()) { |
| 1160 // Lower JSOperators where we can determine types. | 1108 // Lower JSOperators where we can determine types. |
| 1161 Run<TypedLoweringPhase>(); | 1109 Run<TypedLoweringPhase>(); |
| 1162 RunPrintAndVerify("Lowered typed"); | 1110 RunPrintAndVerify("Lowered typed"); |
| 1163 | 1111 |
| 1164 if (FLAG_turbo_stress_loop_peeling) { | 1112 if (FLAG_turbo_stress_loop_peeling) { |
| 1165 Run<StressLoopPeelingPhase>(); | 1113 Run<StressLoopPeelingPhase>(); |
| 1166 RunPrintAndVerify("Loop peeled"); | 1114 RunPrintAndVerify("Loop peeled"); |
| 1167 } | 1115 } |
| 1168 | 1116 |
| 1169 if (info()->is_type_feedback_enabled()) { | |
| 1170 Run<JSTypeFeedbackPhase>(); | |
| 1171 RunPrintAndVerify("JSType feedback"); | |
| 1172 } | |
| 1173 | |
| 1174 // Lower simplified operators and insert changes. | 1117 // Lower simplified operators and insert changes. |
| 1175 Run<SimplifiedLoweringPhase>(); | 1118 Run<SimplifiedLoweringPhase>(); |
| 1176 RunPrintAndVerify("Lowered simplified"); | 1119 RunPrintAndVerify("Lowered simplified"); |
| 1177 | 1120 |
| 1178 Run<BranchEliminationPhase>(); | 1121 Run<BranchEliminationPhase>(); |
| 1179 RunPrintAndVerify("Branch conditions eliminated"); | 1122 RunPrintAndVerify("Branch conditions eliminated"); |
| 1180 | 1123 |
| 1181 // Optimize control flow. | 1124 // Optimize control flow. |
| 1182 if (FLAG_turbo_cf_optimization) { | 1125 if (FLAG_turbo_cf_optimization) { |
| 1183 Run<ControlFlowOptimizationPhase>(); | 1126 Run<ControlFlowOptimizationPhase>(); |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1471 tcf << AsC1VRegisterAllocationData("CodeGen", | 1414 tcf << AsC1VRegisterAllocationData("CodeGen", |
| 1472 data->register_allocation_data()); | 1415 data->register_allocation_data()); |
| 1473 } | 1416 } |
| 1474 | 1417 |
| 1475 data->DeleteRegisterAllocationZone(); | 1418 data->DeleteRegisterAllocationZone(); |
| 1476 } | 1419 } |
| 1477 | 1420 |
| 1478 } // namespace compiler | 1421 } // namespace compiler |
| 1479 } // namespace internal | 1422 } // namespace internal |
| 1480 } // namespace v8 | 1423 } // namespace v8 |
| OLD | NEW |