Commit 488b3e61 authored by Leszek Swirski's avatar Leszek Swirski Committed by Commit Bot

[compiler-dispatcher] Rename ShortPrint to ShortPrintOnMainThread

Also enforce that it is called on the main thread.

Change-Id: I827beefe625bebf6c03fce5220cfbbd68e807984
Reviewed-on: https://chromium-review.googlesource.com/591372Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47000}
parent 3f820ebb
......@@ -49,7 +49,7 @@ class V8_EXPORT_PRIVATE CompilerDispatcherJob {
// Even though the name does not imply this, ShortPrint() must only be invoked
// on the main thread.
virtual void ShortPrint() = 0;
virtual void ShortPrintOnMainThread() = 0;
// Casts to implementations.
const UnoptimizedCompileJob* AsUnoptimizedCompileJob() const;
......
......@@ -226,7 +226,7 @@ CompilerDispatcher::JobId CompilerDispatcher::EnqueueAndStep(
JobMap::const_iterator it = InsertJob(std::move(job));
if (trace_compiler_dispatcher_) {
PrintF("CompilerDispatcher: stepping ");
it->second->ShortPrint();
it->second->ShortPrintOnMainThread();
PrintF("\n");
}
DoNextStepOnMainThread(isolate_, it->second.get(),
......@@ -331,7 +331,7 @@ void CompilerDispatcher::WaitForJobIfRunningOnBackground(
bool CompilerDispatcher::FinishNow(CompilerDispatcherJob* job) {
if (trace_compiler_dispatcher_) {
PrintF("CompilerDispatcher: finishing ");
job->ShortPrint();
job->ShortPrintOnMainThread();
PrintF(" now\n");
}
WaitForJobIfRunningOnBackground(job);
......@@ -386,7 +386,7 @@ void CompilerDispatcher::AbortAll(BlockingBehavior blocking) {
WaitForJobIfRunningOnBackground(it.second.get());
if (trace_compiler_dispatcher_) {
PrintF("CompilerDispatcher: aborted ");
it.second->ShortPrint();
it.second->ShortPrintOnMainThread();
PrintF("\n");
}
it.second->ResetOnMainThread(isolate_);
......@@ -434,7 +434,7 @@ void CompilerDispatcher::AbortInactiveJobs() {
}
if (trace_compiler_dispatcher_) {
PrintF("CompilerDispatcher: aborted ");
job->second->ShortPrint();
job->second->ShortPrintOnMainThread();
PrintF("\n");
}
it = RemoveJob(job);
......@@ -676,7 +676,7 @@ CompilerDispatcher::JobMap::const_iterator CompilerDispatcher::RemoveIfFinished(
if (trace_compiler_dispatcher_) {
bool result = !job->second->IsFailed();
PrintF("CompilerDispatcher: finished working on ");
job->second->ShortPrint();
job->second->ShortPrintOnMainThread();
PrintF(": %s\n", result ? "success" : "failure");
tracer_->DumpStatistics();
}
......
......@@ -105,7 +105,7 @@ UnoptimizedCompileJob::UnoptimizedCompileJob(
if (trace_compiler_dispatcher_jobs_) {
PrintF("UnoptimizedCompileJob[%p] created for ", static_cast<void*>(this));
ShortPrint();
ShortPrintOnMainThread();
PrintF(" in ready to parse state.\n");
}
}
......@@ -127,7 +127,7 @@ UnoptimizedCompileJob::UnoptimizedCompileJob(Isolate* isolate,
Handle<String> source(String::cast(script->source()), isolate);
if (trace_compiler_dispatcher_jobs_) {
PrintF("UnoptimizedCompileJob[%p] created for ", static_cast<void*>(this));
ShortPrint();
ShortPrintOnMainThread();
PrintF(" in initial state.\n");
}
}
......@@ -546,9 +546,9 @@ double UnoptimizedCompileJob::EstimateRuntimeOfNextStepInMs() const {
UNREACHABLE();
}
void UnoptimizedCompileJob::ShortPrint() {
void UnoptimizedCompileJob::ShortPrintOnMainThread() {
DCHECK_EQ(ThreadId::Current().ToInteger(), main_thread_id_);
if (!shared_.is_null()) {
DCHECK_EQ(ThreadId::Current().ToInteger(), main_thread_id_);
shared_->ShortPrint();
} else {
// TODO(wiktorg) more useful info in those cases
......
......@@ -102,9 +102,7 @@ class V8_EXPORT_PRIVATE UnoptimizedCompileJob : public CompilerDispatcherJob {
// Estimate how long the next step will take using the tracer.
double EstimateRuntimeOfNextStepInMs() const override;
// Even though the name does not imply this, ShortPrint() must only be invoked
// on the main thread.
void ShortPrint() override;
void ShortPrintOnMainThread() override;
private:
friend class CompilerDispatcherTest;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment