Reviewers: titzer,
Description:
Disposing an OSR job should only restore the back edge state.
[email protected]
BUG=
Please review this at https://codereview.chromium.org/24725002/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+24, -21 lines):
M src/compiler.h
M src/optimizing-compiler-thread.cc
Index: src/compiler.h
diff --git a/src/compiler.h b/src/compiler.h
index
dc7c19f7b21094b8fb506c903f52d15d932a4988..59558e3c14594425e20dba179e55e212667e2f35
100644
--- a/src/compiler.h
+++ b/src/compiler.h
@@ -533,8 +533,10 @@ class RecompileJob: public ZoneObject {
return SetLastStatus(BAILED_OUT);
}
+ bool IsCompilingForOSR() { return !info()->osr_ast_id().IsNone(); }
+
void WaitForInstall() {
- ASSERT(!info_->osr_ast_id().IsNone());
+ ASSERT(IsCompilingForOSR());
awaiting_install_ = true;
}
Index: src/optimizing-compiler-thread.cc
diff --git a/src/optimizing-compiler-thread.cc
b/src/optimizing-compiler-thread.cc
index
e6467f1547f641c60c8de772726760eaa3d8bc53..71f6c5f159f2a32dcd72ffe1973b26db373c168d
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 (job->IsCompilingForOSR()) {
+ if (!job->IsWaitingForInstall())
BackEdgeTable::RemoveStackCheck(info);
+ } else {
+ Handle<JSFunction> function = info->closure();
+ function->ReplaceCode(function->shared()->code());
+ }
}
delete info;
}
@@ -132,10 +136,9 @@ 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.
- DisposeRecompileJob(job, restore_function_code);
- }
+ // OSR jobs are dealt with separately.
+ if (job->IsCompilingForOSR()) continue;
+ DisposeRecompileJob(job, restore_function_code);
}
Release_Store(&queue_length_, static_cast<AtomicWord>(0));
}
@@ -147,10 +150,9 @@ 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.
- DisposeRecompileJob(job, restore_function_code);
- }
+ // OSR jobs are dealt with separately.
+ if (job->IsCompilingForOSR()) continue;
+ DisposeRecompileJob(job, restore_function_code);
}
}
@@ -220,10 +222,8 @@ void
OptimizingCompilerThread::InstallOptimizedFunctions() {
{ LockGuard<Mutex> access_queue(&queue_mutex_);
if (!output_queue_.Dequeue(&job)) break;
}
- CompilationInfo* info = job->info();
- if (info->osr_ast_id().IsNone()) {
- Compiler::InstallOptimizedCode(job);
- } else {
+ if (job->IsCompilingForOSR()) {
+ CompilationInfo* info = job->info();
if (FLAG_trace_osr) {
PrintF("[COSR - ");
info->closure()->PrintName();
@@ -232,6 +232,8 @@ void
OptimizingCompilerThread::InstallOptimizedFunctions() {
}
job->WaitForInstall();
BackEdgeTable::RemoveStackCheck(info);
+ } else {
+ Compiler::InstallOptimizedCode(job);
}
}
}
@@ -242,9 +244,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 (job->IsCompilingForOSR()) {
if (FLAG_trace_concurrent_recompilation) {
PrintF(" ** Queueing ");
info->closure()->PrintName();
@@ -253,6 +253,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 +319,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;
}
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.