Instrument callers of Semaphore::Signal to help with investigation of

flaky crashes.

BUG=chromium:609249
LOG=NO

Review-Url: https://codereview.chromium.org/1961893002
Cr-Commit-Position: refs/heads/master@{#36106}
This commit is contained in:
ulan 2016-05-09 04:55:14 -07:00 committed by Commit bot
parent bcb1b8732a
commit 5d9f6da654
7 changed files with 16 additions and 14 deletions

View File

@ -34,11 +34,11 @@ Semaphore::~Semaphore() {
USE(result);
}
void Semaphore::Signal() {
void Semaphore::Signal(const char* caller) {
kern_return_t result = semaphore_signal(native_handle_);
DCHECK_EQ(KERN_SUCCESS, result);
USE(result);
USE(caller);
}
@ -104,11 +104,11 @@ Semaphore::~Semaphore() {
USE(result);
}
void Semaphore::Signal() {
void Semaphore::Signal(const char* caller) {
int result = sem_post(&native_handle_);
if (result != 0) {
V8_Fatal(__FILE__, __LINE__, "Semaphore signal failure: %d\n", errno);
V8_Fatal(__FILE__, __LINE__,
"Semaphore signal failure: %d called by '%s'\n", errno, caller);
}
}
@ -177,12 +177,12 @@ Semaphore::~Semaphore() {
USE(result);
}
void Semaphore::Signal() {
void Semaphore::Signal(const char* caller) {
LONG dummy;
BOOL result = ReleaseSemaphore(native_handle_, 1, &dummy);
DCHECK(result);
USE(result);
USE(caller);
}

View File

@ -37,7 +37,8 @@ class Semaphore final {
~Semaphore();
// Increments the semaphore counter.
void Signal();
// TODO(ulan): remove caller parameter once crbug.com/609249 is fixed.
void Signal(const char* caller = nullptr);
// Suspends the calling thread until the semaphore counter is non zero
// and then decrements the semaphore counter.

View File

@ -2159,7 +2159,7 @@ void Debug::EnqueueCommandMessage(Vector<const uint16_t> command,
client_data);
isolate_->logger()->DebugTag("Put command on command_queue.");
command_queue_.Put(message);
command_received_.Signal();
command_received_.Signal("Debug::EnqueueCommandMessage");
// Set the debug command break flag to have the command processed.
if (!in_debug_scope()) isolate_->stack_guard()->RequestDebugCommand();

View File

@ -480,7 +480,7 @@ class MarkCompactCollector::Sweeper::SweeperTask : public v8::Task {
DCHECK_LE(space_id, LAST_PAGED_SPACE);
sweeper_->ParallelSweepSpace(static_cast<AllocationSpace>(space_id), 0);
}
pending_sweeper_tasks_->Signal();
pending_sweeper_tasks_->Signal("SweeperTask::Run");
}
Sweeper* sweeper_;
@ -585,7 +585,7 @@ bool MarkCompactCollector::Sweeper::IsSweepingCompleted() {
base::TimeDelta::FromSeconds(0))) {
return false;
}
pending_sweeper_tasks_semaphore_.Signal();
pending_sweeper_tasks_semaphore_.Signal("Sweeper::IsSweepingCompleted");
return true;
}

View File

@ -161,7 +161,7 @@ class PageParallelJob {
current = items_;
}
}
on_finish_->Signal();
on_finish_->Signal("PageParallelJob::Task::RunInternal");
}
Heap* heap_;

View File

@ -356,7 +356,8 @@ class MemoryAllocator::Unmapper::UnmapFreeMemoryTask : public v8::Task {
// v8::Task overrides.
void Run() override {
unmapper_->PerformFreeMemoryOnQueuedChunks();
unmapper_->pending_unmapping_tasks_semaphore_.Signal();
unmapper_->pending_unmapping_tasks_semaphore_.Signal(
"Unmapper::UnmapFreeMemoryTask::Run");
}
Unmapper* unmapper_;

View File

@ -561,7 +561,7 @@ class Profiler: public base::Thread {
} else {
buffer_[head_] = *sample;
head_ = Succ(head_);
buffer_semaphore_.Signal(); // Tell we have an element.
buffer_semaphore_.Signal("Profiler::Insert"); // Tell we have an element.
}
}