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

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: 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 | « no previous file | src/compiler/pipeline.cc » ('j') | src/compiler/pipeline.cc » ('J')
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 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) {
« no previous file with comments | « no previous file | src/compiler/pipeline.cc » ('j') | src/compiler/pipeline.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698