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

Side by Side Diff: src/isolate.cc

Issue 24220003: Remove default isolate usage from almost all tests (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 } 338 }
339 339
340 Isolate* Isolate::default_isolate_ = NULL; 340 Isolate* Isolate::default_isolate_ = NULL;
341 Thread::LocalStorageKey Isolate::isolate_key_; 341 Thread::LocalStorageKey Isolate::isolate_key_;
342 Thread::LocalStorageKey Isolate::thread_id_key_; 342 Thread::LocalStorageKey Isolate::thread_id_key_;
343 Thread::LocalStorageKey Isolate::per_isolate_thread_data_key_; 343 Thread::LocalStorageKey Isolate::per_isolate_thread_data_key_;
344 #ifdef DEBUG 344 #ifdef DEBUG
345 Thread::LocalStorageKey PerThreadAssertScopeBase::thread_local_key; 345 Thread::LocalStorageKey PerThreadAssertScopeBase::thread_local_key;
346 #endif // DEBUG 346 #endif // DEBUG
347 Mutex Isolate::process_wide_mutex_; 347 Mutex Isolate::process_wide_mutex_;
348 // TODO(dcarney): Remove with default isolate.
349 enum DefaultIsolateStatus {
350 kDefaultIsolateUninitialized,
351 kDefaultIsolateInitialized,
352 kDefaultIsolateCrashIfInitialized
353 };
354 static DefaultIsolateStatus default_isolate_status_
355 = kDefaultIsolateUninitialized;
348 Isolate::ThreadDataTable* Isolate::thread_data_table_ = NULL; 356 Isolate::ThreadDataTable* Isolate::thread_data_table_ = NULL;
349 Atomic32 Isolate::isolate_counter_ = 0; 357 Atomic32 Isolate::isolate_counter_ = 0;
350 358
351 Isolate::PerIsolateThreadData* 359 Isolate::PerIsolateThreadData*
352 Isolate::FindOrAllocatePerThreadDataForThisThread() { 360 Isolate::FindOrAllocatePerThreadDataForThisThread() {
353 ThreadId thread_id = ThreadId::Current(); 361 ThreadId thread_id = ThreadId::Current();
354 PerIsolateThreadData* per_thread = NULL; 362 PerIsolateThreadData* per_thread = NULL;
355 { 363 {
356 LockGuard<Mutex> lock_guard(&process_wide_mutex_); 364 LockGuard<Mutex> lock_guard(&process_wide_mutex_);
357 per_thread = thread_data_table_->Lookup(this, thread_id); 365 per_thread = thread_data_table_->Lookup(this, thread_id);
(...skipping 17 matching lines...) Expand all
375 ThreadId thread_id) { 383 ThreadId thread_id) {
376 PerIsolateThreadData* per_thread = NULL; 384 PerIsolateThreadData* per_thread = NULL;
377 { 385 {
378 LockGuard<Mutex> lock_guard(&process_wide_mutex_); 386 LockGuard<Mutex> lock_guard(&process_wide_mutex_);
379 per_thread = thread_data_table_->Lookup(this, thread_id); 387 per_thread = thread_data_table_->Lookup(this, thread_id);
380 } 388 }
381 return per_thread; 389 return per_thread;
382 } 390 }
383 391
384 392
393 void Isolate::SetCrashIfDefaultIsolateInitialized() {
394 LockGuard<Mutex> lock_guard(&process_wide_mutex_);
395 CHECK(default_isolate_status_ != kDefaultIsolateInitialized);
396 default_isolate_status_ = kDefaultIsolateCrashIfInitialized;
397 }
398
399
385 void Isolate::EnsureDefaultIsolate() { 400 void Isolate::EnsureDefaultIsolate() {
386 LockGuard<Mutex> lock_guard(&process_wide_mutex_); 401 LockGuard<Mutex> lock_guard(&process_wide_mutex_);
402 CHECK(default_isolate_status_ != kDefaultIsolateCrashIfInitialized);
387 if (default_isolate_ == NULL) { 403 if (default_isolate_ == NULL) {
388 isolate_key_ = Thread::CreateThreadLocalKey(); 404 isolate_key_ = Thread::CreateThreadLocalKey();
389 thread_id_key_ = Thread::CreateThreadLocalKey(); 405 thread_id_key_ = Thread::CreateThreadLocalKey();
390 per_isolate_thread_data_key_ = Thread::CreateThreadLocalKey(); 406 per_isolate_thread_data_key_ = Thread::CreateThreadLocalKey();
391 #ifdef DEBUG 407 #ifdef DEBUG
392 PerThreadAssertScopeBase::thread_local_key = Thread::CreateThreadLocalKey(); 408 PerThreadAssertScopeBase::thread_local_key = Thread::CreateThreadLocalKey();
393 #endif // DEBUG 409 #endif // DEBUG
394 thread_data_table_ = new Isolate::ThreadDataTable(); 410 thread_data_table_ = new Isolate::ThreadDataTable();
395 default_isolate_ = new Isolate(); 411 default_isolate_ = new Isolate();
396 } 412 }
(...skipping 2129 matching lines...) Expand 10 before | Expand all | Expand 10 after
2526 2542
2527 #ifdef DEBUG 2543 #ifdef DEBUG
2528 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ 2544 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \
2529 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); 2545 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_);
2530 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) 2546 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET)
2531 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) 2547 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET)
2532 #undef ISOLATE_FIELD_OFFSET 2548 #undef ISOLATE_FIELD_OFFSET
2533 #endif 2549 #endif
2534 2550
2535 } } // namespace v8::internal 2551 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698