| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 44 #include "src/compiler/machine-operator-reducer.h" | 44 #include "src/compiler/machine-operator-reducer.h" | 
| 45 #include "src/compiler/move-optimizer.h" | 45 #include "src/compiler/move-optimizer.h" | 
| 46 #include "src/compiler/osr.h" | 46 #include "src/compiler/osr.h" | 
| 47 #include "src/compiler/pipeline-statistics.h" | 47 #include "src/compiler/pipeline-statistics.h" | 
| 48 #include "src/compiler/register-allocator.h" | 48 #include "src/compiler/register-allocator.h" | 
| 49 #include "src/compiler/register-allocator-verifier.h" | 49 #include "src/compiler/register-allocator-verifier.h" | 
| 50 #include "src/compiler/schedule.h" | 50 #include "src/compiler/schedule.h" | 
| 51 #include "src/compiler/scheduler.h" | 51 #include "src/compiler/scheduler.h" | 
| 52 #include "src/compiler/select-lowering.h" | 52 #include "src/compiler/select-lowering.h" | 
| 53 #include "src/compiler/simplified-lowering.h" | 53 #include "src/compiler/simplified-lowering.h" | 
|  | 54 #include "src/compiler/simplified-operator.h" | 
| 54 #include "src/compiler/simplified-operator-reducer.h" | 55 #include "src/compiler/simplified-operator-reducer.h" | 
| 55 #include "src/compiler/tail-call-optimization.h" | 56 #include "src/compiler/tail-call-optimization.h" | 
| 56 #include "src/compiler/typer.h" | 57 #include "src/compiler/typer.h" | 
| 57 #include "src/compiler/value-numbering-reducer.h" | 58 #include "src/compiler/value-numbering-reducer.h" | 
| 58 #include "src/compiler/verifier.h" | 59 #include "src/compiler/verifier.h" | 
| 59 #include "src/compiler/zone-pool.h" | 60 #include "src/compiler/zone-pool.h" | 
| 60 #include "src/ostreams.h" | 61 #include "src/ostreams.h" | 
| 61 #include "src/register-configuration.h" | 62 #include "src/register-configuration.h" | 
| 62 #include "src/type-info.h" | 63 #include "src/type-info.h" | 
| 63 #include "src/utils.h" | 64 #include "src/utils.h" | 
| (...skipping 11 matching lines...) Expand all  Loading... | 
| 75         info_(info), | 76         info_(info), | 
| 76         outer_zone_(info_->zone()), | 77         outer_zone_(info_->zone()), | 
| 77         zone_pool_(zone_pool), | 78         zone_pool_(zone_pool), | 
| 78         pipeline_statistics_(pipeline_statistics), | 79         pipeline_statistics_(pipeline_statistics), | 
| 79         compilation_failed_(false), | 80         compilation_failed_(false), | 
| 80         code_(Handle<Code>::null()), | 81         code_(Handle<Code>::null()), | 
| 81         graph_zone_scope_(zone_pool_), | 82         graph_zone_scope_(zone_pool_), | 
| 82         graph_zone_(graph_zone_scope_.zone()), | 83         graph_zone_(graph_zone_scope_.zone()), | 
| 83         graph_(nullptr), | 84         graph_(nullptr), | 
| 84         loop_assignment_(nullptr), | 85         loop_assignment_(nullptr), | 
|  | 86         simplified_(nullptr), | 
| 85         machine_(nullptr), | 87         machine_(nullptr), | 
| 86         common_(nullptr), | 88         common_(nullptr), | 
| 87         javascript_(nullptr), | 89         javascript_(nullptr), | 
| 88         jsgraph_(nullptr), | 90         jsgraph_(nullptr), | 
| 89         js_type_feedback_(nullptr), | 91         js_type_feedback_(nullptr), | 
| 90         schedule_(nullptr), | 92         schedule_(nullptr), | 
| 91         instruction_zone_scope_(zone_pool_), | 93         instruction_zone_scope_(zone_pool_), | 
| 92         instruction_zone_(instruction_zone_scope_.zone()), | 94         instruction_zone_(instruction_zone_scope_.zone()), | 
| 93         sequence_(nullptr), | 95         sequence_(nullptr), | 
| 94         frame_(nullptr), | 96         frame_(nullptr), | 
| 95         register_allocation_zone_scope_(zone_pool_), | 97         register_allocation_zone_scope_(zone_pool_), | 
| 96         register_allocation_zone_(register_allocation_zone_scope_.zone()), | 98         register_allocation_zone_(register_allocation_zone_scope_.zone()), | 
| 97         register_allocation_data_(nullptr) { | 99         register_allocation_data_(nullptr) { | 
| 98     PhaseScope scope(pipeline_statistics, "init pipeline data"); | 100     PhaseScope scope(pipeline_statistics, "init pipeline data"); | 
| 99     graph_ = new (graph_zone_) Graph(graph_zone_); | 101     graph_ = new (graph_zone_) Graph(graph_zone_); | 
| 100     source_positions_.Reset(new SourcePositionTable(graph_)); | 102     source_positions_.Reset(new SourcePositionTable(graph_)); | 
|  | 103     simplified_ = new (graph_zone_) SimplifiedOperatorBuilder(graph_zone_); | 
| 101     machine_ = new (graph_zone_) MachineOperatorBuilder( | 104     machine_ = new (graph_zone_) MachineOperatorBuilder( | 
| 102         graph_zone_, kMachPtr, | 105         graph_zone_, kMachPtr, | 
| 103         InstructionSelector::SupportedMachineOperatorFlags()); | 106         InstructionSelector::SupportedMachineOperatorFlags()); | 
| 104     common_ = new (graph_zone_) CommonOperatorBuilder(graph_zone_); | 107     common_ = new (graph_zone_) CommonOperatorBuilder(graph_zone_); | 
| 105     javascript_ = new (graph_zone_) JSOperatorBuilder(graph_zone_); | 108     javascript_ = new (graph_zone_) JSOperatorBuilder(graph_zone_); | 
| 106     jsgraph_ = new (graph_zone_) | 109     jsgraph_ = new (graph_zone_) | 
| 107         JSGraph(isolate_, graph_, common_, javascript_, machine_); | 110         JSGraph(isolate_, graph_, common_, javascript_, simplified_, machine_); | 
| 108   } | 111   } | 
| 109 | 112 | 
| 110   // For machine graph testing entry point. | 113   // For machine graph testing entry point. | 
| 111   PipelineData(ZonePool* zone_pool, CompilationInfo* info, Graph* graph, | 114   PipelineData(ZonePool* zone_pool, CompilationInfo* info, Graph* graph, | 
| 112                Schedule* schedule) | 115                Schedule* schedule) | 
| 113       : isolate_(info->isolate()), | 116       : isolate_(info->isolate()), | 
| 114         info_(info), | 117         info_(info), | 
| 115         outer_zone_(nullptr), | 118         outer_zone_(nullptr), | 
| 116         zone_pool_(zone_pool), | 119         zone_pool_(zone_pool), | 
| 117         pipeline_statistics_(nullptr), | 120         pipeline_statistics_(nullptr), | 
| 118         compilation_failed_(false), | 121         compilation_failed_(false), | 
| 119         code_(Handle<Code>::null()), | 122         code_(Handle<Code>::null()), | 
| 120         graph_zone_scope_(zone_pool_), | 123         graph_zone_scope_(zone_pool_), | 
| 121         graph_zone_(nullptr), | 124         graph_zone_(nullptr), | 
| 122         graph_(graph), | 125         graph_(graph), | 
| 123         source_positions_(new SourcePositionTable(graph_)), | 126         source_positions_(new SourcePositionTable(graph_)), | 
| 124         loop_assignment_(nullptr), | 127         loop_assignment_(nullptr), | 
|  | 128         simplified_(nullptr), | 
| 125         machine_(nullptr), | 129         machine_(nullptr), | 
| 126         common_(nullptr), | 130         common_(nullptr), | 
| 127         javascript_(nullptr), | 131         javascript_(nullptr), | 
| 128         jsgraph_(nullptr), | 132         jsgraph_(nullptr), | 
| 129         js_type_feedback_(nullptr), | 133         js_type_feedback_(nullptr), | 
| 130         schedule_(schedule), | 134         schedule_(schedule), | 
| 131         instruction_zone_scope_(zone_pool_), | 135         instruction_zone_scope_(zone_pool_), | 
| 132         instruction_zone_(instruction_zone_scope_.zone()), | 136         instruction_zone_(instruction_zone_scope_.zone()), | 
| 133         sequence_(nullptr), | 137         sequence_(nullptr), | 
| 134         frame_(nullptr), | 138         frame_(nullptr), | 
| 135         register_allocation_zone_scope_(zone_pool_), | 139         register_allocation_zone_scope_(zone_pool_), | 
| 136         register_allocation_zone_(register_allocation_zone_scope_.zone()), | 140         register_allocation_zone_(register_allocation_zone_scope_.zone()), | 
| 137         register_allocation_data_(nullptr) {} | 141         register_allocation_data_(nullptr) {} | 
| 138 | 142 | 
| 139   // For register allocation testing entry point. | 143   // For register allocation testing entry point. | 
| 140   PipelineData(ZonePool* zone_pool, CompilationInfo* info, | 144   PipelineData(ZonePool* zone_pool, CompilationInfo* info, | 
| 141                InstructionSequence* sequence) | 145                InstructionSequence* sequence) | 
| 142       : isolate_(info->isolate()), | 146       : isolate_(info->isolate()), | 
| 143         info_(info), | 147         info_(info), | 
| 144         outer_zone_(nullptr), | 148         outer_zone_(nullptr), | 
| 145         zone_pool_(zone_pool), | 149         zone_pool_(zone_pool), | 
| 146         pipeline_statistics_(nullptr), | 150         pipeline_statistics_(nullptr), | 
| 147         compilation_failed_(false), | 151         compilation_failed_(false), | 
| 148         code_(Handle<Code>::null()), | 152         code_(Handle<Code>::null()), | 
| 149         graph_zone_scope_(zone_pool_), | 153         graph_zone_scope_(zone_pool_), | 
| 150         graph_zone_(nullptr), | 154         graph_zone_(nullptr), | 
| 151         graph_(nullptr), | 155         graph_(nullptr), | 
| 152         loop_assignment_(nullptr), | 156         loop_assignment_(nullptr), | 
|  | 157         simplified_(nullptr), | 
| 153         machine_(nullptr), | 158         machine_(nullptr), | 
| 154         common_(nullptr), | 159         common_(nullptr), | 
| 155         javascript_(nullptr), | 160         javascript_(nullptr), | 
| 156         jsgraph_(nullptr), | 161         jsgraph_(nullptr), | 
| 157         js_type_feedback_(nullptr), | 162         js_type_feedback_(nullptr), | 
| 158         schedule_(nullptr), | 163         schedule_(nullptr), | 
| 159         instruction_zone_scope_(zone_pool_), | 164         instruction_zone_scope_(zone_pool_), | 
| 160         instruction_zone_(sequence->zone()), | 165         instruction_zone_(sequence->zone()), | 
| 161         sequence_(sequence), | 166         sequence_(sequence), | 
| 162         frame_(nullptr), | 167         frame_(nullptr), | 
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 222 | 227 | 
| 223   void DeleteGraphZone() { | 228   void DeleteGraphZone() { | 
| 224     // Destroy objects with destructors first. | 229     // Destroy objects with destructors first. | 
| 225     source_positions_.Reset(nullptr); | 230     source_positions_.Reset(nullptr); | 
| 226     if (graph_zone_ == nullptr) return; | 231     if (graph_zone_ == nullptr) return; | 
| 227     // Destroy zone and clear pointers. | 232     // Destroy zone and clear pointers. | 
| 228     graph_zone_scope_.Destroy(); | 233     graph_zone_scope_.Destroy(); | 
| 229     graph_zone_ = nullptr; | 234     graph_zone_ = nullptr; | 
| 230     graph_ = nullptr; | 235     graph_ = nullptr; | 
| 231     loop_assignment_ = nullptr; | 236     loop_assignment_ = nullptr; | 
|  | 237     simplified_ = nullptr; | 
| 232     machine_ = nullptr; | 238     machine_ = nullptr; | 
| 233     common_ = nullptr; | 239     common_ = nullptr; | 
| 234     javascript_ = nullptr; | 240     javascript_ = nullptr; | 
| 235     jsgraph_ = nullptr; | 241     jsgraph_ = nullptr; | 
| 236     js_type_feedback_ = nullptr; | 242     js_type_feedback_ = nullptr; | 
| 237     schedule_ = nullptr; | 243     schedule_ = nullptr; | 
| 238   } | 244   } | 
| 239 | 245 | 
| 240   void DeleteInstructionZone() { | 246   void DeleteInstructionZone() { | 
| 241     if (instruction_zone_ == nullptr) return; | 247     if (instruction_zone_ == nullptr) return; | 
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 289   Handle<Code> code_; | 295   Handle<Code> code_; | 
| 290 | 296 | 
| 291   // All objects in the following group of fields are allocated in graph_zone_. | 297   // All objects in the following group of fields are allocated in graph_zone_. | 
| 292   // They are all set to NULL when the graph_zone_ is destroyed. | 298   // They are all set to NULL when the graph_zone_ is destroyed. | 
| 293   ZonePool::Scope graph_zone_scope_; | 299   ZonePool::Scope graph_zone_scope_; | 
| 294   Zone* graph_zone_; | 300   Zone* graph_zone_; | 
| 295   Graph* graph_; | 301   Graph* graph_; | 
| 296   // TODO(dcarney): make this into a ZoneObject. | 302   // TODO(dcarney): make this into a ZoneObject. | 
| 297   base::SmartPointer<SourcePositionTable> source_positions_; | 303   base::SmartPointer<SourcePositionTable> source_positions_; | 
| 298   LoopAssignmentAnalysis* loop_assignment_; | 304   LoopAssignmentAnalysis* loop_assignment_; | 
|  | 305   SimplifiedOperatorBuilder* simplified_; | 
| 299   MachineOperatorBuilder* machine_; | 306   MachineOperatorBuilder* machine_; | 
| 300   CommonOperatorBuilder* common_; | 307   CommonOperatorBuilder* common_; | 
| 301   JSOperatorBuilder* javascript_; | 308   JSOperatorBuilder* javascript_; | 
| 302   JSGraph* jsgraph_; | 309   JSGraph* jsgraph_; | 
| 303   JSTypeFeedbackTable* js_type_feedback_; | 310   JSTypeFeedbackTable* js_type_feedback_; | 
| 304   Schedule* schedule_; | 311   Schedule* schedule_; | 
| 305 | 312 | 
| 306   // All objects in the following group of fields are allocated in | 313   // All objects in the following group of fields are allocated in | 
| 307   // instruction_zone_.  They are all set to NULL when the instruction_zone_ is | 314   // instruction_zone_.  They are all set to NULL when the instruction_zone_ is | 
| 308   // destroyed. | 315   // destroyed. | 
| (...skipping 1135 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1444     tcf << AsC1VRegisterAllocationData("CodeGen", | 1451     tcf << AsC1VRegisterAllocationData("CodeGen", | 
| 1445                                        data->register_allocation_data()); | 1452                                        data->register_allocation_data()); | 
| 1446   } | 1453   } | 
| 1447 | 1454 | 
| 1448   data->DeleteRegisterAllocationZone(); | 1455   data->DeleteRegisterAllocationZone(); | 
| 1449 } | 1456 } | 
| 1450 | 1457 | 
| 1451 }  // namespace compiler | 1458 }  // namespace compiler | 
| 1452 }  // namespace internal | 1459 }  // namespace internal | 
| 1453 }  // namespace v8 | 1460 }  // namespace v8 | 
| OLD | NEW | 
|---|