Chromium Code Reviews| Index: src/compiler.cc |
| diff --git a/src/compiler.cc b/src/compiler.cc |
| index ef21f1f46f9e65ff227bdefb703fe4132101c59e..59521e9b70f638270d3323e525eff58db3b45582 100644 |
| --- a/src/compiler.cc |
| +++ b/src/compiler.cc |
| @@ -331,6 +331,9 @@ class HOptimizedGraphBuilderWithPositions: public HOptimizedGraphBuilder { |
| }; |
| +OptimizedCompileJob::~OptimizedCompileJob() { delete pipeline_; } |
| + |
| + |
| OptimizedCompileJob::Status OptimizedCompileJob::CreateGraph() { |
| DCHECK(info()->IsOptimizing()); |
| DCHECK(!info()->IsCompilingForDebugging()); |
| @@ -400,11 +403,12 @@ OptimizedCompileJob::Status OptimizedCompileJob::CreateGraph() { |
| } |
| Timer t(this, &time_taken_to_create_graph_); |
| - compiler::Pipeline pipeline(info()); |
| - pipeline.GenerateCode(); |
| - if (!info()->code().is_null()) { |
| + pipeline_ = new compiler::Pipeline(info()); |
| + if (pipeline_->CreateGraph()) { |
| return SetLastStatus(SUCCEEDED); |
| } |
| + delete pipeline_; |
| + pipeline_ = nullptr; |
| } |
| if (!isolate()->use_crankshaft() || dont_crankshaft) { |
| @@ -483,8 +487,9 @@ OptimizedCompileJob::Status OptimizedCompileJob::OptimizeGraph() { |
| DCHECK(last_status() == SUCCEEDED); |
| // TODO(turbofan): Currently everything is done in the first phase. |
|
Michael Starzinger
2015/06/16 12:23:01
nit: TODO no longer applies, let's drop it.
Benedikt Meurer
2015/06/19 12:33:46
Done.
|
| - if (!info()->code().is_null()) { |
| - return last_status(); |
| + if (pipeline_) { |
|
Michael Starzinger
2015/06/16 12:23:01
Should we move this down a few lines so that it is
Benedikt Meurer
2015/06/19 12:33:46
Done.
|
| + if (pipeline_->OptimizeGraph()) return SetLastStatus(SUCCEEDED); |
| + return SetLastStatus(BAILED_OUT); |
| } |
| Timer t(this, &time_taken_to_optimize_); |
| @@ -505,14 +510,17 @@ OptimizedCompileJob::Status OptimizedCompileJob::OptimizeGraph() { |
| OptimizedCompileJob::Status OptimizedCompileJob::GenerateCode() { |
| DCHECK(last_status() == SUCCEEDED); |
| // TODO(turbofan): Currently everything is done in the first phase. |
|
Michael Starzinger
2015/06/16 12:23:01
nit: TODO no longer applies, let's drop it.
Benedikt Meurer
2015/06/19 12:33:46
Done.
|
| - if (!info()->code().is_null()) { |
| + if (pipeline_) { |
| + Handle<Code> optimized_code = pipeline_->CreateCode(); |
|
Michael Starzinger
2015/06/16 12:23:01
This can now be intergrated into the code below, s
Benedikt Meurer
2015/06/19 12:33:46
Done.
|
| + if (optimized_code.is_null()) return SetLastStatus(BAILED_OUT); |
| + DCHECK(optimized_code.is_identical_to(info()->code())); |
| info()->dependencies()->Commit(info()->code()); |
| if (info()->is_deoptimization_enabled()) { |
| info()->parse_info()->context()->native_context()->AddOptimizedCode( |
| *info()->code()); |
| } |
| RecordOptimizationStats(); |
| - return last_status(); |
| + return SetLastStatus(SUCCEEDED); |
| } |
| DCHECK(!info()->dependencies()->HasAborted()); |