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 { ...@@ -49,7 +49,7 @@ class V8_EXPORT_PRIVATE CompilerDispatcherJob {
// Even though the name does not imply this, ShortPrint() must only be invoked // Even though the name does not imply this, ShortPrint() must only be invoked
// on the main thread. // on the main thread.
virtual void ShortPrint() = 0; virtual void ShortPrintOnMainThread() = 0;
// Casts to implementations. // Casts to implementations.
const UnoptimizedCompileJob* AsUnoptimizedCompileJob() const; const UnoptimizedCompileJob* AsUnoptimizedCompileJob() const;
......
...@@ -226,7 +226,7 @@ CompilerDispatcher::JobId CompilerDispatcher::EnqueueAndStep( ...@@ -226,7 +226,7 @@ CompilerDispatcher::JobId CompilerDispatcher::EnqueueAndStep(
JobMap::const_iterator it = InsertJob(std::move(job)); JobMap::const_iterator it = InsertJob(std::move(job));
if (trace_compiler_dispatcher_) { if (trace_compiler_dispatcher_) {
PrintF("CompilerDispatcher: stepping "); PrintF("CompilerDispatcher: stepping ");
it->second->ShortPrint(); it->second->ShortPrintOnMainThread();
PrintF("\n"); PrintF("\n");
} }
DoNextStepOnMainThread(isolate_, it->second.get(), DoNextStepOnMainThread(isolate_, it->second.get(),
...@@ -331,7 +331,7 @@ void CompilerDispatcher::WaitForJobIfRunningOnBackground( ...@@ -331,7 +331,7 @@ void CompilerDispatcher::WaitForJobIfRunningOnBackground(
bool CompilerDispatcher::FinishNow(CompilerDispatcherJob* job) { bool CompilerDispatcher::FinishNow(CompilerDispatcherJob* job) {
if (trace_compiler_dispatcher_) { if (trace_compiler_dispatcher_) {
PrintF("CompilerDispatcher: finishing "); PrintF("CompilerDispatcher: finishing ");
job->ShortPrint(); job->ShortPrintOnMainThread();
PrintF(" now\n"); PrintF(" now\n");
} }
WaitForJobIfRunningOnBackground(job); WaitForJobIfRunningOnBackground(job);
...@@ -386,7 +386,7 @@ void CompilerDispatcher::AbortAll(BlockingBehavior blocking) { ...@@ -386,7 +386,7 @@ void CompilerDispatcher::AbortAll(BlockingBehavior blocking) {
WaitForJobIfRunningOnBackground(it.second.get()); WaitForJobIfRunningOnBackground(it.second.get());
if (trace_compiler_dispatcher_) { if (trace_compiler_dispatcher_) {
PrintF("CompilerDispatcher: aborted "); PrintF("CompilerDispatcher: aborted ");
it.second->ShortPrint(); it.second->ShortPrintOnMainThread();
PrintF("\n"); PrintF("\n");
} }
it.second->ResetOnMainThread(isolate_); it.second->ResetOnMainThread(isolate_);
...@@ -434,7 +434,7 @@ void CompilerDispatcher::AbortInactiveJobs() { ...@@ -434,7 +434,7 @@ void CompilerDispatcher::AbortInactiveJobs() {
} }
if (trace_compiler_dispatcher_) { if (trace_compiler_dispatcher_) {
PrintF("CompilerDispatcher: aborted "); PrintF("CompilerDispatcher: aborted ");
job->second->ShortPrint(); job->second->ShortPrintOnMainThread();
PrintF("\n"); PrintF("\n");
} }
it = RemoveJob(job); it = RemoveJob(job);
...@@ -676,7 +676,7 @@ CompilerDispatcher::JobMap::const_iterator CompilerDispatcher::RemoveIfFinished( ...@@ -676,7 +676,7 @@ CompilerDispatcher::JobMap::const_iterator CompilerDispatcher::RemoveIfFinished(
if (trace_compiler_dispatcher_) { if (trace_compiler_dispatcher_) {
bool result = !job->second->IsFailed(); bool result = !job->second->IsFailed();
PrintF("CompilerDispatcher: finished working on "); PrintF("CompilerDispatcher: finished working on ");
job->second->ShortPrint(); job->second->ShortPrintOnMainThread();
PrintF(": %s\n", result ? "success" : "failure"); PrintF(": %s\n", result ? "success" : "failure");
tracer_->DumpStatistics(); tracer_->DumpStatistics();
} }
......
...@@ -105,7 +105,7 @@ UnoptimizedCompileJob::UnoptimizedCompileJob( ...@@ -105,7 +105,7 @@ UnoptimizedCompileJob::UnoptimizedCompileJob(
if (trace_compiler_dispatcher_jobs_) { if (trace_compiler_dispatcher_jobs_) {
PrintF("UnoptimizedCompileJob[%p] created for ", static_cast<void*>(this)); PrintF("UnoptimizedCompileJob[%p] created for ", static_cast<void*>(this));
ShortPrint(); ShortPrintOnMainThread();
PrintF(" in ready to parse state.\n"); PrintF(" in ready to parse state.\n");
} }
} }
...@@ -127,7 +127,7 @@ UnoptimizedCompileJob::UnoptimizedCompileJob(Isolate* isolate, ...@@ -127,7 +127,7 @@ UnoptimizedCompileJob::UnoptimizedCompileJob(Isolate* isolate,
Handle<String> source(String::cast(script->source()), isolate); Handle<String> source(String::cast(script->source()), isolate);
if (trace_compiler_dispatcher_jobs_) { if (trace_compiler_dispatcher_jobs_) {
PrintF("UnoptimizedCompileJob[%p] created for ", static_cast<void*>(this)); PrintF("UnoptimizedCompileJob[%p] created for ", static_cast<void*>(this));
ShortPrint(); ShortPrintOnMainThread();
PrintF(" in initial state.\n"); PrintF(" in initial state.\n");
} }
} }
...@@ -546,9 +546,9 @@ double UnoptimizedCompileJob::EstimateRuntimeOfNextStepInMs() const { ...@@ -546,9 +546,9 @@ double UnoptimizedCompileJob::EstimateRuntimeOfNextStepInMs() const {
UNREACHABLE(); UNREACHABLE();
} }
void UnoptimizedCompileJob::ShortPrint() { void UnoptimizedCompileJob::ShortPrintOnMainThread() {
DCHECK_EQ(ThreadId::Current().ToInteger(), main_thread_id_);
if (!shared_.is_null()) { if (!shared_.is_null()) {
DCHECK_EQ(ThreadId::Current().ToInteger(), main_thread_id_);
shared_->ShortPrint(); shared_->ShortPrint();
} else { } else {
// TODO(wiktorg) more useful info in those cases // TODO(wiktorg) more useful info in those cases
......
...@@ -102,9 +102,7 @@ class V8_EXPORT_PRIVATE UnoptimizedCompileJob : public CompilerDispatcherJob { ...@@ -102,9 +102,7 @@ class V8_EXPORT_PRIVATE UnoptimizedCompileJob : public CompilerDispatcherJob {
// Estimate how long the next step will take using the tracer. // Estimate how long the next step will take using the tracer.
double EstimateRuntimeOfNextStepInMs() const override; double EstimateRuntimeOfNextStepInMs() const override;
// Even though the name does not imply this, ShortPrint() must only be invoked void ShortPrintOnMainThread() override;
// on the main thread.
void ShortPrint() override;
private: private:
friend class CompilerDispatcherTest; 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