| Index: src/compiler.cc
|
| diff --git a/src/compiler.cc b/src/compiler.cc
|
| index 4be483a88edf88a314095c5d7cefa8262e0b2860..a39ed4744437416334f5352d5d43ca00257d3d12 100644
|
| --- a/src/compiler.cc
|
| +++ b/src/compiler.cc
|
| @@ -719,14 +719,19 @@ bool GetOptimizedCodeNow(CompilationInfo* info) {
|
| TimerEventScope<TimerEventOptimizeCode> optimize_code_timer(isolate);
|
| TRACE_EVENT0("v8", "V8.OptimizeCode");
|
|
|
| - if (!Compiler::ParseAndAnalyze(info->parse_info())) return false;
|
| + bool use_turbofan = UseTurboFan(info);
|
| + OptimizedCompileJob* job = use_turbofan
|
| + ? compiler::Pipeline::NewCompilationJob(info)
|
| + : new (info->zone()) HCompilationJob(info);
|
| +
|
| + // Parsing is not required when optimizing from existing bytecode.
|
| + if (!use_turbofan || !info->shared_info()->HasBytecodeArray()) {
|
| + if (!Compiler::ParseAndAnalyze(info->parse_info())) return false;
|
| + }
|
|
|
| TimerEventScope<TimerEventRecompileSynchronous> timer(isolate);
|
| TRACE_EVENT0("v8", "V8.RecompileSynchronous");
|
|
|
| - OptimizedCompileJob* job = UseTurboFan(info)
|
| - ? compiler::Pipeline::NewCompilationJob(info)
|
| - : new (info->zone()) HCompilationJob(info);
|
| if (job->CreateGraph() != OptimizedCompileJob::SUCCEEDED ||
|
| job->OptimizeGraph() != OptimizedCompileJob::SUCCEEDED ||
|
| job->GenerateCode() != OptimizedCompileJob::SUCCEEDED) {
|
| @@ -762,8 +767,19 @@ bool GetOptimizedCodeLater(CompilationInfo* info) {
|
| return false;
|
| }
|
|
|
| + bool use_turbofan = UseTurboFan(info);
|
| + OptimizedCompileJob* job = use_turbofan
|
| + ? compiler::Pipeline::NewCompilationJob(info)
|
| + : new (info->zone()) HCompilationJob(info);
|
| +
|
| + // All handles below this point will be allocated in a deferred handle scope
|
| + // that is detached and handed off to the background thread when we return.
|
| CompilationHandleScope handle_scope(info);
|
| - if (!Compiler::ParseAndAnalyze(info->parse_info())) return false;
|
| +
|
| + // Parsing is not required when optimizing from existing bytecode.
|
| + if (!use_turbofan || !info->shared_info()->HasBytecodeArray()) {
|
| + if (!Compiler::ParseAndAnalyze(info->parse_info())) return false;
|
| + }
|
|
|
| // Reopen handles in the new CompilationHandleScope.
|
| info->ReopenHandlesInNewHandleScope();
|
| @@ -772,11 +788,7 @@ bool GetOptimizedCodeLater(CompilationInfo* info) {
|
| TimerEventScope<TimerEventRecompileSynchronous> timer(info->isolate());
|
| TRACE_EVENT0("v8", "V8.RecompileSynchronous");
|
|
|
| - OptimizedCompileJob* job = UseTurboFan(info)
|
| - ? compiler::Pipeline::NewCompilationJob(info)
|
| - : new (info->zone()) HCompilationJob(info);
|
| - OptimizedCompileJob::Status status = job->CreateGraph();
|
| - if (status != OptimizedCompileJob::SUCCEEDED) return false;
|
| + if (job->CreateGraph() != OptimizedCompileJob::SUCCEEDED) return false;
|
| isolate->optimizing_compile_dispatcher()->QueueForOptimization(job);
|
|
|
| if (FLAG_trace_concurrent_recompilation) {
|
|
|