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

Unified Diff: src/isolate.cc

Issue 6788023: Per-isolate v8::Locker and v8::Unlocker (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Code review feedback Created 9 years, 8 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
Index: src/isolate.cc
diff --git a/src/isolate.cc b/src/isolate.cc
index e42d78ecdcba94ca9355b69b201fdbbf0fcbe092..5651c51a66d3d8c43af05652dc4b466836bbef0e 100644
--- a/src/isolate.cc
+++ b/src/isolate.cc
@@ -311,6 +311,17 @@ Isolate::PerIsolateThreadData*
}
+Isolate::PerIsolateThreadData* Isolate::FindPerThreadDataForThisThread() {
+ ThreadId thread_id = ThreadId::Current();
+ PerIsolateThreadData* per_thread = NULL;
+ {
+ ScopedLock lock(process_wide_mutex_);
+ per_thread = thread_data_table_->Lookup(this, thread_id);
+ }
+ return per_thread;
+}
+
+
void Isolate::EnsureDefaultIsolate() {
ScopedLock lock(process_wide_mutex_);
if (default_isolate_ == NULL) {
@@ -322,7 +333,9 @@ void Isolate::EnsureDefaultIsolate() {
}
// Can't use SetIsolateThreadLocals(default_isolate_, NULL) here
// becase a non-null thread data may be already set.
- Thread::SetThreadLocal(isolate_key_, default_isolate_);
+ if (Thread::GetThreadLocal(isolate_key_) == NULL) {
+ Thread::SetThreadLocal(isolate_key_, default_isolate_);
+ }
CHECK(default_isolate_->PreInit());
}
@@ -456,6 +469,9 @@ Isolate::Isolate()
zone_.isolate_ = this;
stack_guard_.isolate_ = this;
+ thread_manager_ = new ThreadManager();
Vitaly Repeshko 2011/04/21 21:15:27 Add a note that thread manager is initialized earl
+ thread_manager_->isolate_ = this;
+
#if defined(V8_TARGET_ARCH_ARM) && !defined(__arm__) || \
defined(V8_TARGET_ARCH_MIPS) && !defined(__mips__)
simulator_initialized_ = false;
@@ -641,7 +657,6 @@ bool Isolate::PreInit() {
TRACE_ISOLATE(preinit);
ASSERT(Isolate::Current() == this);
-
#ifdef ENABLE_DEBUGGER_SUPPORT
debug_ = new Debug(this);
debugger_ = new Debugger();
@@ -658,7 +673,7 @@ bool Isolate::PreInit() {
heap_.SetStackLimits();
#ifdef DEBUG
- DisallowAllocationFailure disallow_allocation_failure;
+ DisallowAllocationFailure disallow_allocation_failure();
Vitaly Repeshko 2011/04/21 21:15:27 nit: Drop ().
#endif
#define C(name) isolate_addresses_[Isolate::k_##name] = \
@@ -669,8 +684,6 @@ bool Isolate::PreInit() {
string_tracker_ = new StringTracker();
string_tracker_->isolate_ = this;
- thread_manager_ = new ThreadManager();
- thread_manager_->isolate_ = this;
compilation_cache_ = new CompilationCache(this);
transcendental_cache_ = new TranscendentalCache();
keyed_lookup_cache_ = new KeyedLookupCache();
@@ -681,7 +694,7 @@ bool Isolate::PreInit() {
write_input_buffer_ = new StringInputBuffer();
global_handles_ = new GlobalHandles(this);
bootstrapper_ = new Bootstrapper();
- handle_scope_implementer_ = new HandleScopeImplementer();
+ handle_scope_implementer_ = new HandleScopeImplementer(this);
stub_cache_ = new StubCache(this);
ast_sentinels_ = new AstSentinels();
regexp_stack_ = new RegExpStack();
@@ -698,6 +711,7 @@ bool Isolate::PreInit() {
void Isolate::InitializeThreadLocal() {
+ thread_local_top_.isolate_ = this;
thread_local_top_.Initialize();
clear_pending_exception();
clear_pending_message();
@@ -741,11 +755,12 @@ bool Isolate::Init(Deserializer* des) {
#ifdef DEBUG
// The initialization process does not handle memory exhaustion.
- DisallowAllocationFailure disallow_allocation_failure;
+ DisallowAllocationFailure disallow_allocation_failure();
Vitaly Repeshko 2011/04/21 21:15:27 nit: Drop ().
#endif
if (state_ == UNINITIALIZED && !PreInit()) return false;
+
Vitaly Repeshko 2011/04/21 21:15:27 nit: Remove extra blank line.
// Enable logging before setting up the heap
logger_->Setup();

Powered by Google App Engine
This is Rietveld 408576698