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

Unified Diff: src/compiler/pipeline.cc

Issue 2528033002: [wasm] Add a flag --wasm-opt to test optimizations in the WASM pipeline. (Closed)
Patch Set: [wasm] Add a flag --wasm-opt to test optimizations in the WASM pipeline. Created 4 years 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') | src/compiler/wasm-compiler.cc » ('j') | 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 ba5facc57d171064e1c92077ef8d071df413e9fa..c54861ad99f762575c8d64fb20c1a58cca781a12 100644
--- a/src/compiler/pipeline.cc
+++ b/src/compiler/pipeline.cc
@@ -113,15 +113,19 @@ class PipelineData {
}
// For WASM compile entry point.
- PipelineData(ZoneStats* zone_stats, CompilationInfo* info, Graph* graph,
+ PipelineData(ZoneStats* zone_stats, CompilationInfo* info, JSGraph* jsgraph,
SourcePositionTable* source_positions)
: isolate_(info->isolate()),
info_(info),
debug_name_(info_->GetDebugName()),
zone_stats_(zone_stats),
graph_zone_scope_(zone_stats_, ZONE_NAME),
- graph_(graph),
+ graph_(jsgraph->graph()),
source_positions_(source_positions),
+ machine_(jsgraph->machine()),
+ common_(jsgraph->common()),
+ javascript_(jsgraph->javascript()),
+ jsgraph_(jsgraph),
instruction_zone_scope_(zone_stats_, ZONE_NAME),
instruction_zone_(instruction_zone_scope_.zone()),
register_allocation_zone_scope_(zone_stats_, ZONE_NAME),
@@ -603,13 +607,13 @@ PipelineCompilationJob::Status PipelineCompilationJob::FinalizeJobImpl() {
class PipelineWasmCompilationJob final : public CompilationJob {
public:
- explicit PipelineWasmCompilationJob(CompilationInfo* info, Graph* graph,
+ explicit PipelineWasmCompilationJob(CompilationInfo* info, JSGraph* jsgraph,
CallDescriptor* descriptor,
SourcePositionTable* source_positions)
: CompilationJob(info->isolate(), info, "TurboFan",
State::kReadyToExecute),
zone_stats_(info->isolate()->allocator()),
- data_(&zone_stats_, info, graph, source_positions),
+ data_(&zone_stats_, info, jsgraph, source_positions),
pipeline_(&data_),
linkage_(descriptor) {}
@@ -640,6 +644,23 @@ PipelineWasmCompilationJob::ExecuteJobImpl() {
}
pipeline_.RunPrintAndVerify("Machine", true);
+ if (FLAG_wasm_opt) {
+ PipelineData* data = &data_;
+ PipelineRunScope scope(data, "WASM optimization");
+ JSGraphReducer graph_reducer(data->jsgraph(), scope.zone());
+ DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(),
+ data->common());
+ ValueNumberingReducer value_numbering(scope.zone(), data->graph()->zone());
+ MachineOperatorReducer machine_reducer(data->jsgraph());
+ CommonOperatorReducer common_reducer(&graph_reducer, data->graph(),
+ data->common(), data->machine());
+ AddReducer(data, &graph_reducer, &dead_code_elimination);
+ AddReducer(data, &graph_reducer, &value_numbering);
+ AddReducer(data, &graph_reducer, &machine_reducer);
+ AddReducer(data, &graph_reducer, &common_reducer);
+ graph_reducer.ReduceGraph();
+ pipeline_.RunPrintAndVerify("Optimized Machine", true);
+ }
if (!pipeline_.ScheduleAndSelectInstructions(&linkage_, true)) return FAILED;
return SUCCEEDED;
@@ -1703,9 +1724,9 @@ CompilationJob* Pipeline::NewCompilationJob(Handle<JSFunction> function) {
// static
CompilationJob* Pipeline::NewWasmCompilationJob(
- CompilationInfo* info, Graph* graph, CallDescriptor* descriptor,
+ CompilationInfo* info, JSGraph* jsgraph, CallDescriptor* descriptor,
SourcePositionTable* source_positions) {
- return new PipelineWasmCompilationJob(info, graph, descriptor,
+ return new PipelineWasmCompilationJob(info, jsgraph, descriptor,
source_positions);
}
« no previous file with comments | « src/compiler/pipeline.h ('k') | src/compiler/wasm-compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698