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

Unified Diff: src/optimizing-compiler-thread.cc

Issue 24725002: Disposing an OSR job should only restore the back edge state. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments Created 7 years, 3 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') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/optimizing-compiler-thread.cc
diff --git a/src/optimizing-compiler-thread.cc b/src/optimizing-compiler-thread.cc
index e6467f1547f641c60c8de772726760eaa3d8bc53..d9c82ce70152abea0200a6e9d78a43a87de1bb61 100644
--- a/src/optimizing-compiler-thread.cc
+++ b/src/optimizing-compiler-thread.cc
@@ -114,13 +114,17 @@ void OptimizingCompilerThread::CompileNext() {
}
-static void DisposeRecompileJob(RecompileJob* compiler,
+static void DisposeRecompileJob(RecompileJob* job,
bool restore_function_code) {
// The recompile job is allocated in the CompilationInfo's zone.
- CompilationInfo* info = compiler->info();
+ CompilationInfo* info = job->info();
if (restore_function_code) {
- Handle<JSFunction> function = info->closure();
- function->ReplaceCode(function->shared()->code());
+ if (info->is_osr()) {
+ if (!job->IsWaitingForInstall()) BackEdgeTable::RemoveStackCheck(info);
+ } else {
+ Handle<JSFunction> function = info->closure();
+ function->ReplaceCode(function->shared()->code());
+ }
}
delete info;
}
@@ -132,8 +136,8 @@ void OptimizingCompilerThread::FlushInputQueue(bool restore_function_code) {
// This should not block, since we have one signal on the input queue
// semaphore corresponding to each element in the input queue.
input_queue_semaphore_.Wait();
- if (job->info()->osr_ast_id().IsNone()) {
- // OSR jobs are dealt with separately.
+ // OSR jobs are dealt with separately.
+ if (!job->info()->is_osr()) {
DisposeRecompileJob(job, restore_function_code);
}
}
@@ -147,8 +151,8 @@ void OptimizingCompilerThread::FlushOutputQueue(bool restore_function_code) {
{ LockGuard<Mutex> access_queue(&queue_mutex_);
if (!output_queue_.Dequeue(&job)) break;
}
- if (job->info()->osr_ast_id().IsNone()) {
- // OSR jobs are dealt with separately.
+ // OSR jobs are dealt with separately.
+ if (!job->info()->is_osr()) {
DisposeRecompileJob(job, restore_function_code);
}
}
@@ -221,9 +225,7 @@ void OptimizingCompilerThread::InstallOptimizedFunctions() {
if (!output_queue_.Dequeue(&job)) break;
}
CompilationInfo* info = job->info();
- if (info->osr_ast_id().IsNone()) {
- Compiler::InstallOptimizedCode(job);
- } else {
+ if (info->is_osr()) {
if (FLAG_trace_osr) {
PrintF("[COSR - ");
info->closure()->PrintName();
@@ -232,6 +234,8 @@ void OptimizingCompilerThread::InstallOptimizedFunctions() {
}
job->WaitForInstall();
BackEdgeTable::RemoveStackCheck(info);
+ } else {
+ Compiler::InstallOptimizedCode(job);
}
}
}
@@ -242,9 +246,7 @@ void OptimizingCompilerThread::QueueForOptimization(RecompileJob* job) {
ASSERT(!IsOptimizerThread());
Barrier_AtomicIncrement(&queue_length_, static_cast<Atomic32>(1));
CompilationInfo* info = job->info();
- if (info->osr_ast_id().IsNone()) {
- info->closure()->MarkInRecompileQueue();
- } else {
+ if (info->is_osr()) {
if (FLAG_trace_concurrent_recompilation) {
PrintF(" ** Queueing ");
info->closure()->PrintName();
@@ -253,6 +255,8 @@ void OptimizingCompilerThread::QueueForOptimization(RecompileJob* job) {
AddToOsrBuffer(job);
osr_attempts_++;
BackEdgeTable::AddStackCheck(info);
+ } else {
+ info->closure()->MarkInRecompileQueue();
}
input_queue_.Enqueue(job);
input_queue_semaphore_.Signal();
@@ -317,7 +321,6 @@ void OptimizingCompilerThread::AddToOsrBuffer(RecompileJob* job) {
info->closure()->PrintName();
PrintF(", AST id %d]\n", info->osr_ast_id().ToInt());
}
- BackEdgeTable::RemoveStackCheck(info);
DisposeRecompileJob(stale, false);
break;
}
« no previous file with comments | « src/compiler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698