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

Unified Diff: src/compiler.cc

Issue 1891663004: [compiler] Prevent unnecessary parsing with interpreter. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased. Created 4 years, 8 months 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.h ('k') | src/compiler/pipeline.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler.cc
diff --git a/src/compiler.cc b/src/compiler.cc
index b40c153684eee91ea2215e4efc8420fe71870aa0..7ef75a164234752dce6b742145fdb9fad150e99a 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -708,14 +708,21 @@ 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;
+ } else {
+ info->MarkAsOptimizeFromBytecode();
+ }
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) {
@@ -751,8 +758,21 @@ 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;
+ } else {
+ info->MarkAsOptimizeFromBytecode();
+ }
// Reopen handles in the new CompilationHandleScope.
info->ReopenHandlesInNewHandleScope();
@@ -761,11 +781,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) {
« no previous file with comments | « src/compiler.h ('k') | src/compiler/pipeline.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698