Bug 1290220 - Switch the simulators over to js::Thread instead of PRThread; r=terrence

This commit is contained in:
Nick Fitzgerald 2016-08-01 18:39:44 -07:00
parent 7c44548415
commit 395b1382d7
6 changed files with 27 additions and 33 deletions

View File

@ -368,16 +368,16 @@ class AutoLockSimulatorCache : public LockGuard<Mutex>
: Base(sim->cacheLock_)
, sim_(sim)
{
MOZ_ASSERT(!sim_->cacheLockHolder_);
MOZ_ASSERT(sim_->cacheLockHolder_.isNothing());
#ifdef DEBUG
sim_->cacheLockHolder_ = PR_GetCurrentThread();
sim_->cacheLockHolder_ = mozilla::Some(ThisThread::GetId());
#endif
}
~AutoLockSimulatorCache() {
MOZ_ASSERT(sim_->cacheLockHolder_);
MOZ_ASSERT(sim_->cacheLockHolder_.isSome());
#ifdef DEBUG
sim_->cacheLockHolder_ = nullptr;
sim_->cacheLockHolder_.reset();
#endif
}
@ -1128,9 +1128,6 @@ Simulator::Simulator()
lastDebuggerInput_ = nullptr;
#ifdef DEBUG
cacheLockHolder_ = nullptr;
#endif
redirection_ = nullptr;
exclusiveMonitorHeld_ = false;
exclusiveMonitor_ = 0;

View File

@ -37,6 +37,7 @@
#include "jit/arm/disasm/Disasm-arm.h"
#include "jit/IonTypes.h"
#include "threading/Mutex.h"
#include "threading/Thread.h"
namespace js {
namespace jit {
@ -435,7 +436,7 @@ class Simulator
// and by the off-thread compiler (see Redirection::Get in the cpp file).
Mutex cacheLock_;
#ifdef DEBUG
PRThread* cacheLockHolder_;
mozilla::Maybe<Thread::Id> cacheLockHolder_;
#endif
Redirection* redirection_;
@ -446,17 +447,17 @@ class Simulator
// Technically we need the lock to access the innards of the
// icache, not to take its address, but the latter condition
// serves as a useful complement to the former.
MOZ_ASSERT(cacheLockHolder_);
MOZ_ASSERT(cacheLockHolder_.isSome());
return icache_;
}
Redirection* redirection() const {
MOZ_ASSERT(cacheLockHolder_);
MOZ_ASSERT(cacheLockHolder_.isSome());
return redirection_;
}
void setRedirection(js::jit::Redirection* redirection) {
MOZ_ASSERT(cacheLockHolder_);
MOZ_ASSERT(cacheLockHolder_.isSome());
redirection_ = redirection;
}

View File

@ -496,16 +496,16 @@ class AutoLockSimulatorCache : public LockGuard<Mutex>
: Base(sim->cacheLock_)
, sim_(sim)
{
MOZ_ASSERT(!sim_->cacheLockHolder_);
MOZ_ASSERT(sim_->cacheLockHolder_.isNothing());
#ifdef DEBUG
sim_->cacheLockHolder_ = PR_GetCurrentThread();
sim_->cacheLockHolder_ = mozilla::Some(ThisThread::GetId());
#endif
}
~AutoLockSimulatorCache() {
MOZ_ASSERT(sim_->cacheLockHolder_);
MOZ_ASSERT(sim_->cacheLockHolder_.isSome());
#ifdef DEBUG
sim_->cacheLockHolder_ = nullptr;
sim_->cacheLockHolder_.reset();
#endif
}
@ -1277,9 +1277,6 @@ Simulator::Simulator()
lastDebuggerInput_ = nullptr;
#ifdef DEBUG
cacheLockHolder_ = nullptr;
#endif
redirection_ = nullptr;
}

View File

@ -35,6 +35,7 @@
#include "jit/IonTypes.h"
#include "threading/Mutex.h"
#include "threading/Thread.h"
namespace js {
namespace jit {
@ -383,7 +384,7 @@ class Simulator {
// and by the off-thread compiler (see Redirection::Get in the cpp file).
Mutex cacheLock_;
#ifdef DEBUG
PRThread* cacheLockHolder_;
mozilla::Maybe<Thread::Id> cacheLockHolder_;
#endif
Redirection* redirection_;
@ -394,17 +395,17 @@ class Simulator {
// Technically we need the lock to access the innards of the
// icache, not to take its address, but the latter condition
// serves as a useful complement to the former.
MOZ_ASSERT(cacheLockHolder_);
MOZ_ASSERT(cacheLockHolder_.isSome());
return icache_;
}
Redirection* redirection() const {
MOZ_ASSERT(cacheLockHolder_);
MOZ_ASSERT(cacheLockHolder_.isSome());
return redirection_;
}
void setRedirection(js::jit::Redirection* redirection) {
MOZ_ASSERT(cacheLockHolder_);
MOZ_ASSERT(cacheLockHolder_.isSome());
redirection_ = redirection;
}
};

View File

@ -534,16 +534,16 @@ class AutoLockSimulatorCache : public LockGuard<Mutex>
: Base(sim->cacheLock_)
, sim_(sim)
{
MOZ_ASSERT(!sim_->cacheLockHolder_);
MOZ_ASSERT(sim_->cacheLockHolder_.isNothing());
#ifdef DEBUG
sim_->cacheLockHolder_ = PR_GetCurrentThread();
sim_->cacheLockHolder_ = mozilla::Some(ThisThread::GetId());
#endif
}
~AutoLockSimulatorCache() {
MOZ_ASSERT(sim_->cacheLockHolder_);
MOZ_ASSERT(sim_->cacheLockHolder_.isSome());
#ifdef DEBUG
sim_->cacheLockHolder_ = nullptr;
sim_->cacheLockHolder_.reset();
#endif
}
@ -1291,9 +1291,6 @@ Simulator::Simulator()
lastDebuggerInput_ = nullptr;
#ifdef DEBUG
cacheLockHolder_ = nullptr;
#endif
redirection_ = nullptr;
}

View File

@ -36,6 +36,7 @@
#include "jit/IonTypes.h"
#include "threading/Mutex.h"
#include "threading/Thread.h"
namespace js {
namespace jit {
@ -399,7 +400,7 @@ class Simulator {
// and by the off-thread compiler (see Redirection::Get in the cpp file).
Mutex cacheLock_;
#ifdef DEBUG
PRThread* cacheLockHolder_;
mozilla::Maybe<Thread::Id> cacheLockHolder_;
#endif
Redirection* redirection_;
@ -410,17 +411,17 @@ class Simulator {
// Technically we need the lock to access the innards of the
// icache, not to take its address, but the latter condition
// serves as a useful complement to the former.
MOZ_ASSERT(cacheLockHolder_);
MOZ_ASSERT(cacheLockHolder_.isSome());
return icache_;
}
Redirection* redirection() const {
MOZ_ASSERT(cacheLockHolder_);
MOZ_ASSERT(cacheLockHolder_.isSome());
return redirection_;
}
void setRedirection(js::jit::Redirection* redirection) {
MOZ_ASSERT(cacheLockHolder_);
MOZ_ASSERT(cacheLockHolder_.isSome());
redirection_ = redirection;
}
};