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

Side by Side Diff: src/isolate.h

Issue 23625003: Cleanup Mutex and related classes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE 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
« no previous file with comments | « src/heap.cc ('k') | src/isolate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 534
535 static Thread::LocalStorageKey per_isolate_thread_data_key(); 535 static Thread::LocalStorageKey per_isolate_thread_data_key();
536 536
537 // If a client attempts to create a Locker without specifying an isolate, 537 // If a client attempts to create a Locker without specifying an isolate,
538 // we assume that the client is using legacy behavior. Set up the current 538 // we assume that the client is using legacy behavior. Set up the current
539 // thread to be inside the implicit isolate (or fail a check if we have 539 // thread to be inside the implicit isolate (or fail a check if we have
540 // switched to non-legacy behavior). 540 // switched to non-legacy behavior).
541 static void EnterDefaultIsolate(); 541 static void EnterDefaultIsolate();
542 542
543 // Mutex for serializing access to break control structures. 543 // Mutex for serializing access to break control structures.
544 Mutex* break_access() { return break_access_; } 544 RecursiveMutex* break_access() { return &break_access_; }
545 545
546 // Mutex for serializing access to debugger. 546 // Mutex for serializing access to debugger.
547 Mutex* debugger_access() { return debugger_access_; } 547 RecursiveMutex* debugger_access() { return &debugger_access_; }
548 548
549 Address get_address_from_id(AddressId id); 549 Address get_address_from_id(AddressId id);
550 550
551 // Access to top context (where the current function object was created). 551 // Access to top context (where the current function object was created).
552 Context* context() { return thread_local_top_.context_; } 552 Context* context() { return thread_local_top_.context_; }
553 void set_context(Context* context) { 553 void set_context(Context* context) {
554 ASSERT(context == NULL || context->IsContext()); 554 ASSERT(context == NULL || context->IsContext());
555 thread_local_top_.context_ = context; 555 thread_local_top_.context_ = context;
556 } 556 }
557 Context** context_address() { return &thread_local_top_.context_; } 557 Context** context_address() { return &thread_local_top_.context_; }
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after
1178 PerIsolateThreadData* previous_thread_data; 1178 PerIsolateThreadData* previous_thread_data;
1179 Isolate* previous_isolate; 1179 Isolate* previous_isolate;
1180 EntryStackItem* previous_item; 1180 EntryStackItem* previous_item;
1181 1181
1182 private: 1182 private:
1183 DISALLOW_COPY_AND_ASSIGN(EntryStackItem); 1183 DISALLOW_COPY_AND_ASSIGN(EntryStackItem);
1184 }; 1184 };
1185 1185
1186 // This mutex protects highest_thread_id_, thread_data_table_ and 1186 // This mutex protects highest_thread_id_, thread_data_table_ and
1187 // default_isolate_. 1187 // default_isolate_.
1188 static Mutex* process_wide_mutex_; 1188 static RecursiveMutex process_wide_mutex_;
1189 1189
1190 static Thread::LocalStorageKey per_isolate_thread_data_key_; 1190 static Thread::LocalStorageKey per_isolate_thread_data_key_;
1191 static Thread::LocalStorageKey isolate_key_; 1191 static Thread::LocalStorageKey isolate_key_;
1192 static Thread::LocalStorageKey thread_id_key_; 1192 static Thread::LocalStorageKey thread_id_key_;
1193 static Isolate* default_isolate_; 1193 static Isolate* default_isolate_;
1194 static ThreadDataTable* thread_data_table_; 1194 static ThreadDataTable* thread_data_table_;
1195 1195
1196 // A global counter for all generated Isolates, might overflow. 1196 // A global counter for all generated Isolates, might overflow.
1197 static Atomic32 isolate_counter_; 1197 static Atomic32 isolate_counter_;
1198 1198
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1246 StringStream* incomplete_message_; 1246 StringStream* incomplete_message_;
1247 // The preallocated memory thread singleton. 1247 // The preallocated memory thread singleton.
1248 PreallocatedMemoryThread* preallocated_memory_thread_; 1248 PreallocatedMemoryThread* preallocated_memory_thread_;
1249 Address isolate_addresses_[kIsolateAddressCount + 1]; // NOLINT 1249 Address isolate_addresses_[kIsolateAddressCount + 1]; // NOLINT
1250 NoAllocationStringAllocator* preallocated_message_space_; 1250 NoAllocationStringAllocator* preallocated_message_space_;
1251 Bootstrapper* bootstrapper_; 1251 Bootstrapper* bootstrapper_;
1252 RuntimeProfiler* runtime_profiler_; 1252 RuntimeProfiler* runtime_profiler_;
1253 CompilationCache* compilation_cache_; 1253 CompilationCache* compilation_cache_;
1254 Counters* counters_; 1254 Counters* counters_;
1255 CodeRange* code_range_; 1255 CodeRange* code_range_;
1256 Mutex* break_access_; 1256 RecursiveMutex break_access_;
1257 Atomic32 debugger_initialized_; 1257 Atomic32 debugger_initialized_;
1258 Mutex* debugger_access_; 1258 RecursiveMutex debugger_access_;
1259 Logger* logger_; 1259 Logger* logger_;
1260 StackGuard stack_guard_; 1260 StackGuard stack_guard_;
1261 StatsTable* stats_table_; 1261 StatsTable* stats_table_;
1262 StubCache* stub_cache_; 1262 StubCache* stub_cache_;
1263 DeoptimizerData* deoptimizer_data_; 1263 DeoptimizerData* deoptimizer_data_;
1264 ThreadLocalTop thread_local_top_; 1264 ThreadLocalTop thread_local_top_;
1265 bool capture_stack_trace_for_uncaught_exceptions_; 1265 bool capture_stack_trace_for_uncaught_exceptions_;
1266 int stack_trace_for_uncaught_exceptions_frame_limit_; 1266 int stack_trace_for_uncaught_exceptions_frame_limit_;
1267 StackTrace::StackTraceOptions stack_trace_for_uncaught_exceptions_options_; 1267 StackTrace::StackTraceOptions stack_trace_for_uncaught_exceptions_options_;
1268 TranscendentalCache* transcendental_cache_; 1268 TranscendentalCache* transcendental_cache_;
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
1433 }; 1433 };
1434 1434
1435 1435
1436 class ExecutionAccess BASE_EMBEDDED { 1436 class ExecutionAccess BASE_EMBEDDED {
1437 public: 1437 public:
1438 explicit ExecutionAccess(Isolate* isolate) : isolate_(isolate) { 1438 explicit ExecutionAccess(Isolate* isolate) : isolate_(isolate) {
1439 Lock(isolate); 1439 Lock(isolate);
1440 } 1440 }
1441 ~ExecutionAccess() { Unlock(isolate_); } 1441 ~ExecutionAccess() { Unlock(isolate_); }
1442 1442
1443 static void Lock(Isolate* isolate) { isolate->break_access_->Lock(); } 1443 static void Lock(Isolate* isolate) { isolate->break_access()->Lock(); }
1444 static void Unlock(Isolate* isolate) { isolate->break_access_->Unlock(); } 1444 static void Unlock(Isolate* isolate) { isolate->break_access()->Unlock(); }
1445 1445
1446 static bool TryLock(Isolate* isolate) { 1446 static bool TryLock(Isolate* isolate) {
1447 return isolate->break_access_->TryLock(); 1447 return isolate->break_access()->TryLock();
1448 } 1448 }
1449 1449
1450 private: 1450 private:
1451 Isolate* isolate_; 1451 Isolate* isolate_;
1452 }; 1452 };
1453 1453
1454 1454
1455 // Support for checking for stack-overflows in C++ code. 1455 // Support for checking for stack-overflows in C++ code.
1456 class StackLimitCheck BASE_EMBEDDED { 1456 class StackLimitCheck BASE_EMBEDDED {
1457 public: 1457 public:
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1502 1502
1503 // Mark the native context with out of memory. 1503 // Mark the native context with out of memory.
1504 inline void Context::mark_out_of_memory() { 1504 inline void Context::mark_out_of_memory() {
1505 native_context()->set_out_of_memory(HEAP->true_value()); 1505 native_context()->set_out_of_memory(HEAP->true_value());
1506 } 1506 }
1507 1507
1508 1508
1509 } } // namespace v8::internal 1509 } } // namespace v8::internal
1510 1510
1511 #endif // V8_ISOLATE_H_ 1511 #endif // V8_ISOLATE_H_
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | src/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698