Reviewers: Sven Panne,
Description:
don't use default isolate in mksnapshot
[email protected]
BUG=
Please review this at https://codereview.chromium.org/24258006/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+15, -10 lines):
M src/assert-scope.h
M src/isolate.h
M src/isolate.cc
M src/mksnapshot.cc
M src/serialize.cc
Index: src/assert-scope.h
diff --git a/src/assert-scope.h b/src/assert-scope.h
index
269b280d027bd3ff42f3bfc84d255ae4653f3f0e..4f76d72fc4244bf2140d112fc9f7dbeb14f5d864
100644
--- a/src/assert-scope.h
+++ b/src/assert-scope.h
@@ -105,6 +105,7 @@ class PerThreadAssertScopeBase {
static Thread::LocalStorageKey thread_local_key;
PerThreadAssertData* data_;
friend class Isolate;
+ friend struct StaticInitializer;
private:
static void SetThreadLocalData(PerThreadAssertData* data) {
Index: src/isolate.cc
diff --git a/src/isolate.cc b/src/isolate.cc
index
6eb29606d4a3cb4447db98125d239d8f8c8a3b50..7374e96d037cd2c91facc407fc198cb086d1ff7b
100644
--- a/src/isolate.cc
+++ b/src/isolate.cc
@@ -401,13 +401,6 @@ void Isolate::EnsureDefaultIsolate() {
LockGuard<Mutex> lock_guard(&process_wide_mutex_);
CHECK(default_isolate_status_ != kDefaultIsolateCrashIfInitialized);
if (default_isolate_ == NULL) {
- isolate_key_ = Thread::CreateThreadLocalKey();
- thread_id_key_ = Thread::CreateThreadLocalKey();
- per_isolate_thread_data_key_ = Thread::CreateThreadLocalKey();
-#ifdef DEBUG
- PerThreadAssertScopeBase::thread_local_key =
Thread::CreateThreadLocalKey();
-#endif // DEBUG
- thread_data_table_ = new Isolate::ThreadDataTable();
default_isolate_ = new Isolate();
}
// Can't use SetIsolateThreadLocals(default_isolate_, NULL) here
@@ -419,7 +412,14 @@ void Isolate::EnsureDefaultIsolate() {
struct StaticInitializer {
StaticInitializer() {
- Isolate::EnsureDefaultIsolate();
+ LockGuard<Mutex> lock_guard(&Isolate::process_wide_mutex_);
+ Isolate::isolate_key_ = Thread::CreateThreadLocalKey();
+ Isolate::thread_id_key_ = Thread::CreateThreadLocalKey();
+ Isolate::per_isolate_thread_data_key_ = Thread::CreateThreadLocalKey();
+#ifdef DEBUG
+ PerThreadAssertScopeBase::thread_local_key =
Thread::CreateThreadLocalKey();
+#endif // DEBUG
+ Isolate::thread_data_table_ = new Isolate::ThreadDataTable();
}
} static_initializer;
Index: src/isolate.h
diff --git a/src/isolate.h b/src/isolate.h
index
b7ea209b295e6526d97675fef48da983fb7d8341..116c74736da929c5301b60233f6c0dcbc5e75234
100644
--- a/src/isolate.h
+++ b/src/isolate.h
@@ -1142,6 +1142,7 @@ class Isolate {
private:
Isolate();
+ friend struct StaticInitializer;
friend struct GlobalState;
friend struct InitializeGlobalState;
Index: src/mksnapshot.cc
diff --git a/src/mksnapshot.cc b/src/mksnapshot.cc
index
9cf9e2e8a422c28f0488d011ecfceb9a9d98931d..75babb57d0e587d0d9f5c952208d4f9c79dd60d4
100644
--- a/src/mksnapshot.cc
+++ b/src/mksnapshot.cc
@@ -310,6 +310,7 @@ void DumpException(Handle<Message> message) {
int main(int argc, char** argv) {
V8::InitializeICU();
+ i::Isolate::SetCrashIfDefaultIsolateInitialized();
// By default, log code create information in the snapshot.
i::FLAG_log_code = true;
@@ -330,7 +331,10 @@ int main(int argc, char** argv) {
exit(1);
}
#endif
- Isolate* isolate = Isolate::GetCurrent();
+ i::FLAG_logfile_per_isolate = false;
+
+ Isolate* isolate = v8::Isolate::New();
+ isolate->Enter();
i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
i::Serializer::Enable(internal_isolate);
Persistent<Context> context;
Index: src/serialize.cc
diff --git a/src/serialize.cc b/src/serialize.cc
index
d05dd2612270c8e16f3f0c7d0354d94eaddbe49a..b3a78780a9413da5d90e5403533bea82326da410
100644
--- a/src/serialize.cc
+++ b/src/serialize.cc
@@ -1284,7 +1284,6 @@ Serializer::Serializer(Isolate* isolate,
SnapshotByteSink* sink)
root_index_wave_front_(0) {
// The serializer is meant to be used only to generate initial heap
images
// from a context in which there is only one isolate.
- ASSERT(isolate_->IsDefaultIsolate());
for (int i = 0; i <= LAST_SPACE; i++) {
fullness_[i] = 0;
}
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.