Remove dead ThreadManager::TerminateExecution(tid)

R=mstarzinger@chromium.org

Change-Id: Ibb30a4413d1e40adab8802a84b7a962d3ea3f933
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1593084
Commit-Queue: Ben Titzer <titzer@chromium.org>
Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61161}
This commit is contained in:
Ben L. Titzer 2019-05-02 13:59:49 +02:00 committed by Commit Bot
parent 0635e272f4
commit f1c2d313ae
2 changed files with 0 additions and 48 deletions

View File

@ -23,7 +23,6 @@ base::Atomic32 g_locker_was_ever_used_ = 0;
} // namespace
// Once the Locker is initialized, the current thread will be guaranteed to have
// the lock for a given isolate.
void Locker::Initialize(v8::Isolate* isolate) {
@ -51,19 +50,16 @@ void Locker::Initialize(v8::Isolate* isolate) {
DCHECK(isolate_->thread_manager()->IsLockedByCurrentThread());
}
bool Locker::IsLocked(v8::Isolate* isolate) {
DCHECK_NOT_NULL(isolate);
i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
return internal_isolate->thread_manager()->IsLockedByCurrentThread();
}
bool Locker::IsActive() {
return !!base::Relaxed_Load(&g_locker_was_ever_used_);
}
Locker::~Locker() {
DCHECK(isolate_->thread_manager()->IsLockedByCurrentThread());
if (has_lock_) {
@ -76,7 +72,6 @@ Locker::~Locker() {
}
}
void Unlocker::Initialize(v8::Isolate* isolate) {
DCHECK_NOT_NULL(isolate);
isolate_ = reinterpret_cast<i::Isolate*>(isolate);
@ -92,7 +87,6 @@ Unlocker::~Unlocker() {
isolate_->thread_manager()->RestoreThread();
}
namespace internal {
void ThreadManager::InitThread(const ExecutionAccess& lock) {
@ -144,30 +138,23 @@ bool ThreadManager::RestoreThread() {
from = isolate_->regexp_stack()->RestoreStack(from);
from = isolate_->bootstrapper()->RestoreState(from);
per_thread->set_thread_state(nullptr);
if (state->terminate_on_restore()) {
isolate_->stack_guard()->RequestTerminateExecution();
state->set_terminate_on_restore(false);
}
state->set_id(ThreadId::Invalid());
state->Unlink();
state->LinkInto(ThreadState::FREE_LIST);
return true;
}
void ThreadManager::Lock() {
mutex_.Lock();
mutex_owner_.store(ThreadId::Current(), std::memory_order_relaxed);
DCHECK(IsLockedByCurrentThread());
}
void ThreadManager::Unlock() {
mutex_owner_.store(ThreadId::Invalid(), std::memory_order_relaxed);
mutex_.Unlock();
}
static int ArchiveSpacePerThread() {
return HandleScopeImplementer::ArchiveSpacePerThread() +
Isolate::ArchiveSpacePerThread() +
@ -180,7 +167,6 @@ static int ArchiveSpacePerThread() {
ThreadState::ThreadState(ThreadManager* thread_manager)
: id_(ThreadId::Invalid()),
terminate_on_restore_(false),
data_(nullptr),
next_(this),
previous_(this),
@ -190,18 +176,15 @@ ThreadState::~ThreadState() {
DeleteArray<char>(data_);
}
void ThreadState::AllocateSpace() {
data_ = NewArray<char>(ArchiveSpacePerThread());
}
void ThreadState::Unlink() {
next_->previous_ = previous_;
previous_->next_ = next_;
}
void ThreadState::LinkInto(List list) {
ThreadState* flying_anchor =
list == FREE_LIST ? thread_manager_->free_anchor_
@ -212,7 +195,6 @@ void ThreadState::LinkInto(List list) {
next_->previous_ = this;
}
ThreadState* ThreadManager::GetFreeThreadState() {
ThreadState* gotten = free_anchor_->next_;
if (gotten == free_anchor_) {
@ -223,13 +205,11 @@ ThreadState* ThreadManager::GetFreeThreadState() {
return gotten;
}
// Gets the first in the list of archived threads.
ThreadState* ThreadManager::FirstThreadStateInUse() {
return in_use_anchor_->Next();
}
ThreadState* ThreadState::Next() {
if (next_ == thread_manager_->in_use_anchor_) return nullptr;
return next_;
@ -249,13 +229,11 @@ ThreadManager::ThreadManager(Isolate* isolate)
in_use_anchor_ = new ThreadState(this);
}
ThreadManager::~ThreadManager() {
DeleteThreadStateList(free_anchor_);
DeleteThreadStateList(in_use_anchor_);
}
void ThreadManager::DeleteThreadStateList(ThreadState* anchor) {
// The list starts and ends with the anchor.
for (ThreadState* current = anchor->next_; current != anchor;) {
@ -266,7 +244,6 @@ void ThreadManager::DeleteThreadStateList(ThreadState* anchor) {
delete anchor;
}
void ThreadManager::ArchiveThread() {
DCHECK_EQ(lazily_archived_thread_, ThreadId::Invalid());
DCHECK(!IsArchived());
@ -283,7 +260,6 @@ void ThreadManager::ArchiveThread() {
DCHECK_NE(state->id(), ThreadId::Invalid());
}
void ThreadManager::EagerlyArchiveThread() {
DCHECK(IsLockedByCurrentThread());
ThreadState* state = lazily_archived_thread_state_;
@ -302,7 +278,6 @@ void ThreadManager::EagerlyArchiveThread() {
lazily_archived_thread_state_ = nullptr;
}
void ThreadManager::FreeThreadResources() {
DCHECK(!isolate_->has_pending_exception());
DCHECK(!isolate_->external_caught_exception());
@ -315,7 +290,6 @@ void ThreadManager::FreeThreadResources() {
isolate_->bootstrapper()->FreeThreadResources();
}
bool ThreadManager::IsArchived() {
Isolate::PerIsolateThreadData* data =
isolate_->FindPerThreadDataForThisThread();
@ -333,7 +307,6 @@ void ThreadManager::Iterate(RootVisitor* v) {
}
}
void ThreadManager::IterateArchivedThreads(ThreadVisitor* v) {
for (ThreadState* state = FirstThreadStateInUse(); state != nullptr;
state = state->Next()) {
@ -343,21 +316,9 @@ void ThreadManager::IterateArchivedThreads(ThreadVisitor* v) {
}
}
ThreadId ThreadManager::CurrentId() {
return ThreadId::Current();
}
void ThreadManager::TerminateExecution(ThreadId thread_id) {
for (ThreadState* state = FirstThreadStateInUse(); state != nullptr;
state = state->Next()) {
if (thread_id == state->id()) {
state->set_terminate_on_restore(true);
}
}
}
} // namespace internal
} // namespace v8

View File

@ -29,12 +29,6 @@ class ThreadState {
void set_id(ThreadId id) { id_ = id; }
ThreadId id() { return id_; }
// Should the thread be terminated when it is restored?
bool terminate_on_restore() { return terminate_on_restore_; }
void set_terminate_on_restore(bool terminate_on_restore) {
terminate_on_restore_ = terminate_on_restore;
}
// Get data area for archiving a thread.
char* data() { return data_; }
@ -45,7 +39,6 @@ class ThreadState {
void AllocateSpace();
ThreadId id_;
bool terminate_on_restore_;
char* data_;
ThreadState* next_;
ThreadState* previous_;
@ -83,8 +76,6 @@ class ThreadManager {
ThreadId CurrentId();
void TerminateExecution(ThreadId thread_id);
// Iterate over in-use states.
ThreadState* FirstThreadStateInUse();
ThreadState* GetFreeThreadState();