Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(697)

Unified Diff: src/v8threads.cc

Issue 18842: Experimental: periodic merge of the bleeding_edge branch to the... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/toiger/
Patch Set: Created 11 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/v8threads.h ('k') | src/zone.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/v8threads.cc
===================================================================
--- src/v8threads.cc (revision 1168)
+++ src/v8threads.cc (working copy)
@@ -28,6 +28,7 @@
#include "v8.h"
#include "api.h"
+#include "bootstrapper.h"
#include "debug.h"
#include "execution.h"
#include "v8threads.h"
@@ -38,9 +39,17 @@
static internal::Thread::LocalStorageKey thread_state_key =
internal::Thread::CreateThreadLocalKey();
+
+// Track whether this V8 instance has ever called v8::Locker. This allows the
+// API code to verify that the lock is always held when V8 is being entered.
+bool Locker::active_ = false;
+
+
// Constructor for the Locker object. Once the Locker is constructed the
// current thread will be guaranteed to have the big V8 lock.
Locker::Locker() : has_lock_(false), top_level_(true) {
+ // Record that the Locker has been used at least once.
+ active_ = true;
// Get the big lock if necessary.
if (!internal::ThreadManager::IsLockedByCurrentThread()) {
internal::ThreadManager::Lock();
@@ -111,6 +120,11 @@
Thread::SetThreadLocal(thread_state_key, NULL);
return true;
}
+
+ // Make sure that the preemption thread cannot modify the thread state while
+ // it is being archived or restored.
+ ExecutionAccess access;
+
// If there is another thread that was lazily archived then we have to really
// archive it now.
if (lazily_archived_thread_.IsValid()) {
@@ -127,6 +141,7 @@
from = Debug::RestoreDebug(from);
from = StackGuard::RestoreStackGuard(from);
from = RegExpStack::RestoreStack(from);
+ from = Bootstrapper::RestoreState(from);
Thread::SetThreadLocal(thread_state_key, NULL);
state->Unlink();
state->LinkInto(ThreadState::FREE_LIST);
@@ -152,7 +167,8 @@
Top::ArchiveSpacePerThread() +
Debug::ArchiveSpacePerThread() +
StackGuard::ArchiveSpacePerThread() +
- RegExpStack::ArchiveSpacePerThread();
+ RegExpStack::ArchiveSpacePerThread() +
+ Bootstrapper::ArchiveSpacePerThread();
}
@@ -234,6 +250,7 @@
to = Debug::ArchiveDebug(to);
to = StackGuard::ArchiveStackGuard(to);
to = RegExpStack::ArchiveStack(to);
+ to = Bootstrapper::ArchiveState(to);
lazily_archived_thread_.Initialize(ThreadHandle::INVALID);
lazily_archived_thread_state_ = NULL;
}
« no previous file with comments | « src/v8threads.h ('k') | src/zone.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698