Disposing an OSR job should only restore the back edge state.

R=titzer@chromium.org
BUG=

Review URL: https://codereview.chromium.org/24725002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16978 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
yangguo@chromium.org 2013-09-27 09:37:18 +00:00
parent 77c60c9a84
commit 42d7071422
2 changed files with 19 additions and 16 deletions

View File

@ -534,7 +534,7 @@ class RecompileJob: public ZoneObject {
}
void WaitForInstall() {
ASSERT(!info_->osr_ast_id().IsNone());
ASSERT(info_->is_osr());
awaiting_install_ = true;
}

View File

@ -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;
}