Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(306)

Unified Diff: src/compiler/pipeline.cc

Issue 727733002: [turbofan] refactor pipeline to use hydrogen like Run calls (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/pipeline.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/pipeline.cc
diff --git a/src/compiler/pipeline.cc b/src/compiler/pipeline.cc
index a05e2b3e382657ebbe83e1e1ed0bdd7e333ad48a..edcb99ed020f14b3d371f2aa7d02efdf1362f2a8 100644
--- a/src/compiler/pipeline.cc
+++ b/src/compiler/pipeline.cc
@@ -43,12 +43,14 @@ namespace compiler {
class PipelineData {
public:
- explicit PipelineData(CompilationInfo* info, ZonePool* zone_pool,
- PipelineStatistics* pipeline_statistics)
+ PipelineData(CompilationInfo* info, ZonePool* zone_pool,
+ PipelineStatistics* pipeline_statistics)
: isolate_(info->zone()->isolate()),
+ info_(info),
outer_zone_(info->zone()),
zone_pool_(zone_pool),
pipeline_statistics_(pipeline_statistics),
+ compilation_failed_(false),
graph_zone_scope_(zone_pool_),
graph_zone_(graph_zone_scope_.zone()),
graph_(new (graph_zone()) Graph(graph_zone())),
@@ -61,25 +63,30 @@ class PipelineData {
jsgraph_(new (graph_zone())
JSGraph(graph(), common(), javascript(), machine())),
typer_(new Typer(graph(), info->context())),
- schedule_(NULL),
+ context_node_(nullptr),
+ schedule_(nullptr),
instruction_zone_scope_(zone_pool_),
instruction_zone_(instruction_zone_scope_.zone()) {}
+
// For machine graph testing only.
PipelineData(Graph* graph, Schedule* schedule, ZonePool* zone_pool)
: isolate_(graph->zone()->isolate()),
- outer_zone_(NULL),
+ info_(nullptr),
+ outer_zone_(nullptr),
zone_pool_(zone_pool),
- pipeline_statistics_(NULL),
+ pipeline_statistics_(nullptr),
+ compilation_failed_(false),
graph_zone_scope_(zone_pool_),
- graph_zone_(NULL),
+ graph_zone_(nullptr),
graph_(graph),
source_positions_(new SourcePositionTable(graph)),
- machine_(NULL),
- common_(NULL),
- javascript_(NULL),
- jsgraph_(NULL),
- typer_(NULL),
+ machine_(nullptr),
+ common_(nullptr),
+ javascript_(nullptr),
+ jsgraph_(nullptr),
+ typer_(nullptr),
+ context_node_(nullptr),
schedule_(schedule),
instruction_zone_scope_(zone_pool_),
instruction_zone_(instruction_zone_scope_.zone()) {}
@@ -90,8 +97,11 @@ class PipelineData {
}
Isolate* isolate() const { return isolate_; }
+ CompilationInfo* info() const { return info_; }
ZonePool* zone_pool() const { return zone_pool_; }
PipelineStatistics* pipeline_statistics() { return pipeline_statistics_; }
+ bool compilation_failed() const { return compilation_failed_; }
+ void set_compilation_failed() { compilation_failed_ = true; }
Zone* graph_zone() const { return graph_zone_; }
Graph* graph() const { return graph_; }
@@ -103,9 +113,12 @@ class PipelineData {
JSOperatorBuilder* javascript() const { return javascript_; }
JSGraph* jsgraph() const { return jsgraph_; }
Typer* typer() const { return typer_.get(); }
+ Node* context_node() const { return context_node_; }
+ void set_context_node(Node* context_node) { context_node_ = context_node; }
+
Schedule* schedule() const { return schedule_; }
void set_schedule(Schedule* schedule) {
- DCHECK_EQ(NULL, schedule_);
+ DCHECK_EQ(nullptr, schedule_);
schedule_ = schedule;
}
@@ -115,18 +128,19 @@ class PipelineData {
void DeleteGraphZone() {
// Destroy objects with destructors first.
- source_positions_.Reset(NULL);
- typer_.Reset(NULL);
- if (graph_zone_ == NULL) return;
+ source_positions_.Reset(nullptr);
+ typer_.Reset(nullptr);
+ if (graph_zone_ == nullptr) return;
// Destroy zone and clear pointers.
graph_zone_scope_.Destroy();
- graph_zone_ = NULL;
- graph_ = NULL;
- machine_ = NULL;
- common_ = NULL;
- javascript_ = NULL;
- jsgraph_ = NULL;
- schedule_ = NULL;
+ graph_zone_ = nullptr;
+ graph_ = nullptr;
+ machine_ = nullptr;
+ common_ = nullptr;
+ javascript_ = nullptr;
+ jsgraph_ = nullptr;
+ context_node_ = nullptr;
+ schedule_ = nullptr;
}
void DeleteInstructionZone() {
@@ -137,9 +151,11 @@ class PipelineData {
private:
Isolate* isolate_;
+ CompilationInfo* info_;
Zone* outer_zone_;
ZonePool* zone_pool_;
PipelineStatistics* pipeline_statistics_;
+ bool compilation_failed_;
ZonePool::Scope graph_zone_scope_;
Zone* graph_zone_;
@@ -154,6 +170,7 @@ class PipelineData {
JSGraph* jsgraph_;
// TODO(dcarney): make this into a ZoneObject.
SmartPointer<Typer> typer_;
+ Node* context_node_;
Schedule* schedule_;
// All objects in the following group of fields are allocated in
@@ -182,18 +199,221 @@ struct TurboCfgFile : public std::ofstream {
};
-void Pipeline::VerifyAndPrintGraph(
- Graph* graph, const char* phase, bool untyped) {
- if (FLAG_trace_turbo) {
+static void TraceSchedule(Schedule* schedule) {
+ if (!FLAG_trace_turbo) return;
+ OFStream os(stdout);
+ os << "-- Schedule --------------------------------------\n" << *schedule;
+}
+
+
+static SmartArrayPointer<char> GetDebugName(CompilationInfo* info) {
+ SmartArrayPointer<char> name;
+ if (info->IsStub()) {
+ if (info->code_stub() != NULL) {
+ CodeStub::Major major_key = info->code_stub()->MajorKey();
+ const char* major_name = CodeStub::MajorName(major_key, false);
+ size_t len = strlen(major_name);
+ name.Reset(new char[len]);
+ memcpy(name.get(), major_name, len);
+ }
+ } else {
+ AllowHandleDereference allow_deref;
+ name = info->function()->debug_name()->ToCString();
+ }
+ return name;
+}
+
+
+class AstGraphBuilderWithPositions : public AstGraphBuilder {
+ public:
+ explicit AstGraphBuilderWithPositions(Zone* local_zone, CompilationInfo* info,
+ JSGraph* jsgraph,
+ SourcePositionTable* source_positions)
+ : AstGraphBuilder(local_zone, info, jsgraph),
+ source_positions_(source_positions) {}
+
+ bool CreateGraph() {
+ SourcePositionTable::Scope pos(source_positions_,
+ SourcePosition::Unknown());
+ return AstGraphBuilder::CreateGraph();
+ }
+
+#define DEF_VISIT(type) \
+ virtual void Visit##type(type* node) OVERRIDE { \
+ SourcePositionTable::Scope pos(source_positions_, \
+ SourcePosition(node->position())); \
+ AstGraphBuilder::Visit##type(node); \
+ }
+ AST_NODE_LIST(DEF_VISIT)
+#undef DEF_VISIT
+
+ Node* GetFunctionContext() { return AstGraphBuilder::GetFunctionContext(); }
+
+ private:
+ SourcePositionTable* source_positions_;
+};
+
+
+struct GraphBuilderPhase {
+ void Run(PipelineData* data) {
titzer 2014/11/14 14:03:40 I like this a lot better! Can we pull the phase_s
+ PhaseScope phase_scope(data->pipeline_statistics(), "graph builder");
+ ZonePool::Scope zone_scope(data->zone_pool());
+ AstGraphBuilderWithPositions graph_builder(zone_scope.zone(), data->info(),
+ data->jsgraph(),
+ data->source_positions());
+ if (!graph_builder.CreateGraph()) {
+ data->set_compilation_failed();
+ return;
+ }
+ data->set_context_node(graph_builder.GetFunctionContext());
+ }
+};
+
+
+struct ContextSpecializerPhase {
+ void Run(PipelineData* data) {
+ SourcePositionTable::Scope pos(data->source_positions(),
+ SourcePosition::Unknown());
+ JSContextSpecializer spec(data->info(), data->jsgraph(),
+ data->context_node());
+ spec.SpecializeToContext();
+ }
+};
+
+
+struct InliningPhase {
+ void Run(PipelineData* data) {
+ PhaseScope phase_scope(data->pipeline_statistics(), "inlining");
+ ZonePool::Scope zone_scope(data->zone_pool());
+ SourcePositionTable::Scope pos(data->source_positions(),
+ SourcePosition::Unknown());
+ JSInliner inliner(zone_scope.zone(), data->info(), data->jsgraph());
+ inliner.Inline();
+ }
+};
+
+
+struct TyperPhase {
+ void Run(PipelineData* data) {
+ PhaseScope phase_scope(data->pipeline_statistics(), "typer");
+ ZonePool::Scope zone_scope(data->zone_pool());
+ data->typer()->Run();
+ }
+};
+
+
+struct TypedLoweringPhase {
+ void Run(PipelineData* data) {
+ PhaseScope phase_scope(data->pipeline_statistics(), "typed lowering");
+ ZonePool::Scope zone_scope(data->zone_pool());
+ SourcePositionTable::Scope pos(data->source_positions(),
+ SourcePosition::Unknown());
+ ValueNumberingReducer vn_reducer(data->graph_zone());
+ JSTypedLowering lowering(data->jsgraph());
+ SimplifiedOperatorReducer simple_reducer(data->jsgraph());
+ GraphReducer graph_reducer(data->graph());
+ graph_reducer.AddReducer(&vn_reducer);
+ graph_reducer.AddReducer(&lowering);
+ graph_reducer.AddReducer(&simple_reducer);
+ graph_reducer.ReduceGraph();
+ }
+};
+
+
+struct SimplifiedLoweringPhase {
+ void Run(PipelineData* data) {
+ PhaseScope phase_scope(data->pipeline_statistics(), "simplified lowering");
+ ZonePool::Scope zone_scope(data->zone_pool());
+ SourcePositionTable::Scope pos(data->source_positions(),
+ SourcePosition::Unknown());
+ SimplifiedLowering lowering(data->jsgraph());
+ lowering.LowerAllNodes();
+ ValueNumberingReducer vn_reducer(data->graph_zone());
+ SimplifiedOperatorReducer simple_reducer(data->jsgraph());
+ GraphReducer graph_reducer(data->graph());
+ graph_reducer.AddReducer(&vn_reducer);
+ graph_reducer.AddReducer(&simple_reducer);
+ graph_reducer.ReduceGraph();
+ }
+};
+
+
+struct ChangeLoweringPhase {
+ void Run(PipelineData* data) {
+ PhaseScope phase_scope(data->pipeline_statistics(), "change lowering");
+ ZonePool::Scope zone_scope(data->zone_pool());
+ SourcePositionTable::Scope pos(data->source_positions(),
+ SourcePosition::Unknown());
+ Linkage linkage(data->graph_zone(), data->info());
+ ValueNumberingReducer vn_reducer(data->graph_zone());
+ SimplifiedOperatorReducer simple_reducer(data->jsgraph());
+ ChangeLowering lowering(data->jsgraph(), &linkage);
+ MachineOperatorReducer mach_reducer(data->jsgraph());
+ GraphReducer graph_reducer(data->graph());
+ // TODO(titzer): Figure out if we should run all reducers at once here.
+ graph_reducer.AddReducer(&vn_reducer);
+ graph_reducer.AddReducer(&simple_reducer);
+ graph_reducer.AddReducer(&lowering);
+ graph_reducer.AddReducer(&mach_reducer);
+ graph_reducer.ReduceGraph();
+ }
+};
+
+
+struct ControlReductionPhase {
+ void Run(PipelineData* data, const char* phase_name) {
+ PhaseScope phase_scope(data->pipeline_statistics(), phase_name);
+ ZonePool::Scope zone_scope(data->zone_pool());
+ SourcePositionTable::Scope pos(data->source_positions(),
+ SourcePosition::Unknown());
+ ControlReducer::ReduceGraph(zone_scope.zone(), data->jsgraph(),
+ data->common());
+ }
+};
+
+
+struct GenericLoweringPhase {
+ void Run(PipelineData* data) {
+ PhaseScope phase_scope(data->pipeline_statistics(), "generic lowering");
+ ZonePool::Scope zone_scope(data->zone_pool());
+ SourcePositionTable::Scope pos(data->source_positions(),
+ SourcePosition::Unknown());
+ JSGenericLowering generic(data->info(), data->jsgraph());
+ SelectLowering select(data->jsgraph()->graph(), data->jsgraph()->common());
+ GraphReducer graph_reducer(data->graph());
+ graph_reducer.AddReducer(&generic);
+ graph_reducer.AddReducer(&select);
+ graph_reducer.ReduceGraph();
+ }
+};
+
+
+struct ComputeSchedulePhase {
+ void Run(PipelineData* data) {
+ PhaseScope phase_scope(data->pipeline_statistics(), "scheduling");
+ ZonePool::Scope zone_scope(data->zone_pool());
+ Schedule* schedule =
+ Scheduler::ComputeSchedule(zone_scope.zone(), data->graph());
+ TraceSchedule(schedule);
+ if (VerifyGraphs()) ScheduleVerifier::Run(schedule);
+ data->set_schedule(schedule);
+ }
+};
+
+
+struct PrintGraphPhase {
+ void Run(PipelineData* data, const char* phase) {
+ CompilationInfo* info = data->info();
+ Graph* graph = data->graph();
char buffer[256];
Vector<char> filename(buffer, sizeof(buffer));
SmartArrayPointer<char> functionname;
- if (!info_->shared_info().is_null()) {
- functionname = info_->shared_info()->DebugName()->ToCString();
+ if (!info->shared_info().is_null()) {
+ functionname = info->shared_info()->DebugName()->ToCString();
if (strlen(functionname.get()) > 0) {
SNPrintF(filename, "turbo-%s-%s", functionname.get(), phase);
} else {
- SNPrintF(filename, "turbo-%p-%s", static_cast<void*>(info_), phase);
+ SNPrintF(filename, "turbo-%p-%s", static_cast<void*>(info), phase);
}
} else {
SNPrintF(filename, "turbo-none-%s", phase);
@@ -221,63 +441,25 @@ void Pipeline::VerifyAndPrintGraph(
os << "-- " << phase << " graph printed to file " << filename.start()
<< "\n";
}
- if (VerifyGraphs()) {
- Verifier::Run(graph,
- FLAG_turbo_types && !untyped ? Verifier::TYPED : Verifier::UNTYPED);
- }
-}
-
-
-class AstGraphBuilderWithPositions : public AstGraphBuilder {
- public:
- explicit AstGraphBuilderWithPositions(Zone* local_zone, CompilationInfo* info,
- JSGraph* jsgraph,
- SourcePositionTable* source_positions)
- : AstGraphBuilder(local_zone, info, jsgraph),
- source_positions_(source_positions) {}
+};
- bool CreateGraph() {
- SourcePositionTable::Scope pos(source_positions_,
- SourcePosition::Unknown());
- return AstGraphBuilder::CreateGraph();
- }
-#define DEF_VISIT(type) \
- virtual void Visit##type(type* node) OVERRIDE { \
- SourcePositionTable::Scope pos(source_positions_, \
- SourcePosition(node->position())); \
- AstGraphBuilder::Visit##type(node); \
+struct VerifyGraphPhase {
+ void Run(PipelineData* data, const bool untyped) {
+ Verifier::Run(data->graph(), FLAG_turbo_types && !untyped
+ ? Verifier::TYPED
+ : Verifier::UNTYPED);
}
- AST_NODE_LIST(DEF_VISIT)
-#undef DEF_VISIT
-
- private:
- SourcePositionTable* source_positions_;
};
-static void TraceSchedule(Schedule* schedule) {
- if (!FLAG_trace_turbo) return;
- OFStream os(stdout);
- os << "-- Schedule --------------------------------------\n" << *schedule;
-}
-
-
-static SmartArrayPointer<char> GetDebugName(CompilationInfo* info) {
- SmartArrayPointer<char> name;
- if (info->IsStub()) {
- if (info->code_stub() != NULL) {
- CodeStub::Major major_key = info->code_stub()->MajorKey();
- const char* major_name = CodeStub::MajorName(major_key, false);
- size_t len = strlen(major_name);
- name.Reset(new char[len]);
- memcpy(name.get(), major_name, len);
- }
- } else {
- AllowHandleDereference allow_deref;
- name = info->function()->debug_name()->ToCString();
+void Pipeline::RunPrintAndVerify(const char* phase, bool untyped) {
+ if (FLAG_trace_turbo) {
+ Run<PrintGraphPhase>(phase);
+ }
+ if (VerifyGraphs()) {
+ Run<VerifyGraphPhase>(untyped);
}
- return name;
}
@@ -297,13 +479,16 @@ Handle<Code> Pipeline::GenerateCode() {
}
ZonePool zone_pool(isolate());
-
SmartPointer<PipelineStatistics> pipeline_statistics;
+
if (FLAG_turbo_stats) {
pipeline_statistics.Reset(new PipelineStatistics(info(), &zone_pool));
pipeline_statistics->BeginPhaseKind("graph creation");
}
+ PipelineData data(info(), &zone_pool, pipeline_statistics.get());
+ this->data_ = &data;
+
if (FLAG_trace_turbo) {
OFStream os(stdout);
os << "---------------------------------------------------\n"
@@ -313,56 +498,28 @@ Handle<Code> Pipeline::GenerateCode() {
tcf << AsC1VCompilation(info());
}
- // Initialize the graph and builders.
- PipelineData data(info(), &zone_pool, pipeline_statistics.get());
-
data.source_positions()->AddDecorator();
- Node* context_node;
- {
- PhaseScope phase_scope(pipeline_statistics.get(), "graph builder");
- ZonePool::Scope zone_scope(data.zone_pool());
- AstGraphBuilderWithPositions graph_builder(
- zone_scope.zone(), info(), data.jsgraph(), data.source_positions());
- if (!graph_builder.CreateGraph()) return Handle<Code>::null();
- context_node = graph_builder.GetFunctionContext();
- }
-
- VerifyAndPrintGraph(data.graph(), "Initial untyped", true);
+ Run<GraphBuilderPhase>();
+ if (data.compilation_failed()) return Handle<Code>::null();
+ RunPrintAndVerify("Initial untyped", true);
- {
- PhaseScope phase_scope(pipeline_statistics.get(),
- "early control reduction");
- SourcePositionTable::Scope pos(data.source_positions(),
- SourcePosition::Unknown());
- ZonePool::Scope zone_scope(data.zone_pool());
- ControlReducer::ReduceGraph(zone_scope.zone(), data.jsgraph(),
- data.common());
-
- VerifyAndPrintGraph(data.graph(), "Early Control reduced", true);
- }
+ Run<ControlReductionPhase>("early control reduction");
+ RunPrintAndVerify("Early Control reduced", true);
if (info()->is_context_specializing()) {
- SourcePositionTable::Scope pos(data.source_positions(),
- SourcePosition::Unknown());
// Specialize the code to the context as aggressively as possible.
- JSContextSpecializer spec(info(), data.jsgraph(), context_node);
- spec.SpecializeToContext();
- VerifyAndPrintGraph(data.graph(), "Context specialized", true);
+ Run<ContextSpecializerPhase>();
+ RunPrintAndVerify("Context specialized", true);
}
if (info()->is_inlining_enabled()) {
- PhaseScope phase_scope(pipeline_statistics.get(), "inlining");
- SourcePositionTable::Scope pos(data.source_positions(),
- SourcePosition::Unknown());
- ZonePool::Scope zone_scope(data.zone_pool());
- JSInliner inliner(zone_scope.zone(), info(), data.jsgraph());
- inliner.Inline();
- VerifyAndPrintGraph(data.graph(), "Inlined", true);
+ Run<InliningPhase>();
+ RunPrintAndVerify("Inlined", true);
}
- // Print a replay of the initial graph.
if (FLAG_print_turbo_replay) {
+ // Print a replay of the initial graph.
GraphReplayPrinter::PrintReplay(data.graph());
}
@@ -370,110 +527,46 @@ Handle<Code> Pipeline::GenerateCode() {
if (!SupportedTarget()) return Handle<Code>::null();
if (info()->is_typing_enabled()) {
- {
- // Type the graph.
- PhaseScope phase_scope(pipeline_statistics.get(), "typer");
- data.typer()->Run();
- VerifyAndPrintGraph(data.graph(), "Typed");
- }
+ // Type the graph.
+ Run<TyperPhase>();
+ RunPrintAndVerify("Typed");
}
if (!pipeline_statistics.is_empty()) {
- pipeline_statistics->BeginPhaseKind("lowering");
+ data.pipeline_statistics()->BeginPhaseKind("lowering");
}
if (info()->is_typing_enabled()) {
- {
- // Lower JSOperators where we can determine types.
- PhaseScope phase_scope(pipeline_statistics.get(), "typed lowering");
- SourcePositionTable::Scope pos(data.source_positions(),
- SourcePosition::Unknown());
- ValueNumberingReducer vn_reducer(data.graph_zone());
- JSTypedLowering lowering(data.jsgraph());
- SimplifiedOperatorReducer simple_reducer(data.jsgraph());
- GraphReducer graph_reducer(data.graph());
- graph_reducer.AddReducer(&vn_reducer);
- graph_reducer.AddReducer(&lowering);
- graph_reducer.AddReducer(&simple_reducer);
- graph_reducer.ReduceGraph();
-
- VerifyAndPrintGraph(data.graph(), "Lowered typed");
- }
- {
- // Lower simplified operators and insert changes.
- PhaseScope phase_scope(pipeline_statistics.get(), "simplified lowering");
- SourcePositionTable::Scope pos(data.source_positions(),
- SourcePosition::Unknown());
- SimplifiedLowering lowering(data.jsgraph());
- lowering.LowerAllNodes();
- ValueNumberingReducer vn_reducer(data.graph_zone());
- SimplifiedOperatorReducer simple_reducer(data.jsgraph());
- GraphReducer graph_reducer(data.graph());
- graph_reducer.AddReducer(&vn_reducer);
- graph_reducer.AddReducer(&simple_reducer);
- graph_reducer.ReduceGraph();
-
- VerifyAndPrintGraph(data.graph(), "Lowered simplified");
- }
- {
- // Lower changes that have been inserted before.
- PhaseScope phase_scope(pipeline_statistics.get(), "change lowering");
- SourcePositionTable::Scope pos(data.source_positions(),
- SourcePosition::Unknown());
- Linkage linkage(data.graph_zone(), info());
- ValueNumberingReducer vn_reducer(data.graph_zone());
- SimplifiedOperatorReducer simple_reducer(data.jsgraph());
- ChangeLowering lowering(data.jsgraph(), &linkage);
- MachineOperatorReducer mach_reducer(data.jsgraph());
- GraphReducer graph_reducer(data.graph());
- // TODO(titzer): Figure out if we should run all reducers at once here.
- graph_reducer.AddReducer(&vn_reducer);
- graph_reducer.AddReducer(&simple_reducer);
- graph_reducer.AddReducer(&lowering);
- graph_reducer.AddReducer(&mach_reducer);
- graph_reducer.ReduceGraph();
-
- // TODO(jarin, rossberg): Remove UNTYPED once machine typing works.
- VerifyAndPrintGraph(data.graph(), "Lowered changes", true);
- }
+ // Lower JSOperators where we can determine types.
+ Run<TypedLoweringPhase>();
+ RunPrintAndVerify("Lowered typed");
- {
- PhaseScope phase_scope(pipeline_statistics.get(),
- "late control reduction");
- SourcePositionTable::Scope pos(data.source_positions(),
- SourcePosition::Unknown());
- ZonePool::Scope zone_scope(data.zone_pool());
- ControlReducer::ReduceGraph(zone_scope.zone(), data.jsgraph(),
- data.common());
+ // Lower simplified operators and insert changes.
+ Run<SimplifiedLoweringPhase>();
+ RunPrintAndVerify("Lowered simplified");
- VerifyAndPrintGraph(data.graph(), "Late Control reduced");
- }
- }
+ // Lower changes that have been inserted before.
+ Run<ChangeLoweringPhase>();
+ // // TODO(jarin, rossberg): Remove UNTYPED once machine typing works.
+ RunPrintAndVerify("Lowered changes", true);
- {
- // Lower any remaining generic JSOperators.
- PhaseScope phase_scope(pipeline_statistics.get(), "generic lowering");
- SourcePositionTable::Scope pos(data.source_positions(),
- SourcePosition::Unknown());
- JSGenericLowering generic(info(), data.jsgraph());
- SelectLowering select(data.jsgraph()->graph(), data.jsgraph()->common());
- GraphReducer graph_reducer(data.graph());
- graph_reducer.AddReducer(&generic);
- graph_reducer.AddReducer(&select);
- graph_reducer.ReduceGraph();
-
- // TODO(jarin, rossberg): Remove UNTYPED once machine typing works.
- VerifyAndPrintGraph(data.graph(), "Lowered generic", true);
+ Run<ControlReductionPhase>("late control reduction");
+ RunPrintAndVerify("Late Control reduced");
}
+ // Lower any remaining generic JSOperators.
+ Run<GenericLoweringPhase>();
+ // TODO(jarin, rossberg): Remove UNTYPED once machine typing works.
+ RunPrintAndVerify("Lowered generic", true);
+
if (!pipeline_statistics.is_empty()) {
- pipeline_statistics->BeginPhaseKind("block building");
+ data.pipeline_statistics()->BeginPhaseKind("block building");
}
data.source_positions()->RemoveDecorator();
// Compute a schedule.
- ComputeSchedule(&data);
+ Run<ComputeSchedulePhase>();
Handle<Code> code = Handle<Code>::null();
{
@@ -497,27 +590,17 @@ Handle<Code> Pipeline::GenerateCode() {
}
-void Pipeline::ComputeSchedule(PipelineData* data) {
- PhaseScope phase_scope(data->pipeline_statistics(), "scheduling");
- ZonePool::Scope zone_scope(data->zone_pool());
- Schedule* schedule =
- Scheduler::ComputeSchedule(zone_scope.zone(), data->graph());
- TraceSchedule(schedule);
- if (VerifyGraphs()) ScheduleVerifier::Run(schedule);
- data->set_schedule(schedule);
-}
-
-
Handle<Code> Pipeline::GenerateCodeForMachineGraph(Linkage* linkage,
Graph* graph,
Schedule* schedule) {
ZonePool zone_pool(isolate());
CHECK(SupportedBackend());
PipelineData data(graph, schedule, &zone_pool);
+ this->data_ = &data;
if (schedule == NULL) {
// TODO(rossberg): Should this really be untyped?
- VerifyAndPrintGraph(graph, "Machine", true);
- ComputeSchedule(&data);
+ RunPrintAndVerify("Machine", true);
+ Run<ComputeSchedulePhase>();
} else {
TraceSchedule(schedule);
}
« no previous file with comments | « src/compiler/pipeline.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698