*/
static void StopPreemption();
-#ifdef DEBUG
- static void AssertIsLocked();
-#else
- static inline void AssertIsLocked() { }
-#endif
+ /**
+ * Returns whether or not the locker is locked by the current thread.
+ */
+ static bool IsLocked();
+
private:
bool has_lock_;
bool top_level_;
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#ifndef V8_DEBUG_H_
-#define V8_DEBUG_H_
+#ifndef V8_V8_DEBUG_H_
+#define V8_V8_DEBUG_H_
#include "../include/v8-debug.h"
#include "assembler.h"
} } // namespace v8::internal
-#endif // V8_DEBUG_H_
+#endif // V8_V8_DEBUG_H_
}
-#ifdef DEBUG
-void Locker::AssertIsLocked() {
- ASSERT(internal::ThreadManager::IsLockedByCurrentThread());
+bool Locker::IsLocked() {
+ return internal::ThreadManager::IsLockedByCurrentThread();
}
-#endif
Locker::~Locker() {
void ContextSwitcher::StartPreemption(int every_n_ms) {
- Locker::AssertIsLocked();
+ ASSERT(Locker::IsLocked());
if (switcher == NULL) {
switcher = new ContextSwitcher(every_n_ms);
switcher->Start();
void ContextSwitcher::StopPreemption() {
- Locker::AssertIsLocked();
+ ASSERT(Locker::IsLocked());
if (switcher != NULL) {
switcher->Stop();
delete(switcher);
void ContextSwitcher::Stop() {
- Locker::AssertIsLocked();
+ ASSERT(Locker::IsLocked());
keep_going_ = false;
preemption_semaphore_->Signal();
Join();
void ContextSwitcher::PreemptionReceived() {
- Locker::AssertIsLocked();
+ ASSERT(Locker::IsLocked());
switcher->preemption_semaphore_->Signal();
}
static v8::Handle<Value> ThrowInJS(const v8::Arguments& args) {
- v8::Locker::AssertIsLocked();
+ CHECK(v8::Locker::IsLocked());
ApiTestFuzzer::Fuzz();
v8::Unlocker unlocker;
const char* code = "throw 7;";
static v8::Handle<Value> ThrowInJSNoCatch(const v8::Arguments& args) {
- v8::Locker::AssertIsLocked();
+ CHECK(v8::Locker::IsLocked());
ApiTestFuzzer::Fuzz();
v8::Unlocker unlocker;
const char* code = "throw 7;";
// as part of the locking aggregation tests.
TEST(NestedLockers) {
v8::Locker locker;
- v8::Locker::AssertIsLocked();
+ CHECK(v8::Locker::IsLocked());
v8::HandleScope scope;
LocalContext env;
Local<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New(ThrowInJS);
v8::Locker locker;
{
v8::Locker locker2;
- v8::Locker::AssertIsLocked();
+ CHECK(v8::Locker::IsLocked());
}
}