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

Side by Side Diff: src/isolate.h

Issue 21087012: Simplify implementation of Mutex. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix unit test. Created 7 years, 4 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 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 537
538 static Thread::LocalStorageKey per_isolate_thread_data_key(); 538 static Thread::LocalStorageKey per_isolate_thread_data_key();
539 539
540 // If a client attempts to create a Locker without specifying an isolate, 540 // If a client attempts to create a Locker without specifying an isolate,
541 // we assume that the client is using legacy behavior. Set up the current 541 // we assume that the client is using legacy behavior. Set up the current
542 // thread to be inside the implicit isolate (or fail a check if we have 542 // thread to be inside the implicit isolate (or fail a check if we have
543 // switched to non-legacy behavior). 543 // switched to non-legacy behavior).
544 static void EnterDefaultIsolate(); 544 static void EnterDefaultIsolate();
545 545
546 // Mutex for serializing access to break control structures. 546 // Mutex for serializing access to break control structures.
547 Mutex* break_access() { return break_access_; } 547 Mutex* break_access() { return &break_access_; }
548 548
549 // Mutex for serializing access to debugger. 549 // Mutex for serializing access to debugger.
550 Mutex* debugger_access() { return debugger_access_; } 550 Mutex* debugger_access() { return &debugger_access_; }
551 551
552 Address get_address_from_id(AddressId id); 552 Address get_address_from_id(AddressId id);
553 553
554 // Access to top context (where the current function object was created). 554 // Access to top context (where the current function object was created).
555 Context* context() { return thread_local_top_.context_; } 555 Context* context() { return thread_local_top_.context_; }
556 void set_context(Context* context) { 556 void set_context(Context* context) {
557 ASSERT(context == NULL || context->IsContext()); 557 ASSERT(context == NULL || context->IsContext());
558 thread_local_top_.context_ = context; 558 thread_local_top_.context_ = context;
559 } 559 }
560 Context** context_address() { return &thread_local_top_.context_; } 560 Context** context_address() { return &thread_local_top_.context_; }
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
1193 PerIsolateThreadData* previous_thread_data; 1193 PerIsolateThreadData* previous_thread_data;
1194 Isolate* previous_isolate; 1194 Isolate* previous_isolate;
1195 EntryStackItem* previous_item; 1195 EntryStackItem* previous_item;
1196 1196
1197 private: 1197 private:
1198 DISALLOW_COPY_AND_ASSIGN(EntryStackItem); 1198 DISALLOW_COPY_AND_ASSIGN(EntryStackItem);
1199 }; 1199 };
1200 1200
1201 // This mutex protects highest_thread_id_, thread_data_table_ and 1201 // This mutex protects highest_thread_id_, thread_data_table_ and
1202 // default_isolate_. 1202 // default_isolate_.
1203 static Mutex* process_wide_mutex_; 1203 static Mutex process_wide_mutex_;
1204 1204
1205 static Thread::LocalStorageKey per_isolate_thread_data_key_; 1205 static Thread::LocalStorageKey per_isolate_thread_data_key_;
1206 static Thread::LocalStorageKey isolate_key_; 1206 static Thread::LocalStorageKey isolate_key_;
1207 static Thread::LocalStorageKey thread_id_key_; 1207 static Thread::LocalStorageKey thread_id_key_;
1208 static Isolate* default_isolate_; 1208 static Isolate* default_isolate_;
1209 static ThreadDataTable* thread_data_table_; 1209 static ThreadDataTable* thread_data_table_;
1210 1210
1211 // A global counter for all generated Isolates, might overflow. 1211 // A global counter for all generated Isolates, might overflow.
1212 static Atomic32 isolate_counter_; 1212 static Atomic32 isolate_counter_;
1213 1213
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1261 StringStream* incomplete_message_; 1261 StringStream* incomplete_message_;
1262 // The preallocated memory thread singleton. 1262 // The preallocated memory thread singleton.
1263 PreallocatedMemoryThread* preallocated_memory_thread_; 1263 PreallocatedMemoryThread* preallocated_memory_thread_;
1264 Address isolate_addresses_[kIsolateAddressCount + 1]; // NOLINT 1264 Address isolate_addresses_[kIsolateAddressCount + 1]; // NOLINT
1265 NoAllocationStringAllocator* preallocated_message_space_; 1265 NoAllocationStringAllocator* preallocated_message_space_;
1266 Bootstrapper* bootstrapper_; 1266 Bootstrapper* bootstrapper_;
1267 RuntimeProfiler* runtime_profiler_; 1267 RuntimeProfiler* runtime_profiler_;
1268 CompilationCache* compilation_cache_; 1268 CompilationCache* compilation_cache_;
1269 Counters* counters_; 1269 Counters* counters_;
1270 CodeRange* code_range_; 1270 CodeRange* code_range_;
1271 Mutex* break_access_; 1271 Mutex break_access_;
1272 Atomic32 debugger_initialized_; 1272 Atomic32 debugger_initialized_;
1273 Mutex* debugger_access_; 1273 Mutex debugger_access_;
1274 Logger* logger_; 1274 Logger* logger_;
1275 StackGuard stack_guard_; 1275 StackGuard stack_guard_;
1276 StatsTable* stats_table_; 1276 StatsTable* stats_table_;
1277 StubCache* stub_cache_; 1277 StubCache* stub_cache_;
1278 DeoptimizerData* deoptimizer_data_; 1278 DeoptimizerData* deoptimizer_data_;
1279 ThreadLocalTop thread_local_top_; 1279 ThreadLocalTop thread_local_top_;
1280 bool capture_stack_trace_for_uncaught_exceptions_; 1280 bool capture_stack_trace_for_uncaught_exceptions_;
1281 int stack_trace_for_uncaught_exceptions_frame_limit_; 1281 int stack_trace_for_uncaught_exceptions_frame_limit_;
1282 StackTrace::StackTraceOptions stack_trace_for_uncaught_exceptions_options_; 1282 StackTrace::StackTraceOptions stack_trace_for_uncaught_exceptions_options_;
1283 TranscendentalCache* transcendental_cache_; 1283 TranscendentalCache* transcendental_cache_;
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
1455 }; 1455 };
1456 1456
1457 1457
1458 class ExecutionAccess BASE_EMBEDDED { 1458 class ExecutionAccess BASE_EMBEDDED {
1459 public: 1459 public:
1460 explicit ExecutionAccess(Isolate* isolate) : isolate_(isolate) { 1460 explicit ExecutionAccess(Isolate* isolate) : isolate_(isolate) {
1461 Lock(isolate); 1461 Lock(isolate);
1462 } 1462 }
1463 ~ExecutionAccess() { Unlock(isolate_); } 1463 ~ExecutionAccess() { Unlock(isolate_); }
1464 1464
1465 static void Lock(Isolate* isolate) { isolate->break_access_->Lock(); } 1465 static void Lock(Isolate* isolate) { isolate->break_access()->Lock(); }
1466 static void Unlock(Isolate* isolate) { isolate->break_access_->Unlock(); } 1466 static void Unlock(Isolate* isolate) { isolate->break_access()->Unlock(); }
1467 1467
1468 static bool TryLock(Isolate* isolate) { 1468 static bool TryLock(Isolate* isolate) {
1469 return isolate->break_access_->TryLock(); 1469 return isolate->break_access()->TryLock();
1470 } 1470 }
1471 1471
1472 private: 1472 private:
1473 Isolate* isolate_; 1473 Isolate* isolate_;
1474 }; 1474 };
1475 1475
1476 1476
1477 // Support for checking for stack-overflows in C++ code. 1477 // Support for checking for stack-overflows in C++ code.
1478 class StackLimitCheck BASE_EMBEDDED { 1478 class StackLimitCheck BASE_EMBEDDED {
1479 public: 1479 public:
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1524 1524
1525 // Mark the native context with out of memory. 1525 // Mark the native context with out of memory.
1526 inline void Context::mark_out_of_memory() { 1526 inline void Context::mark_out_of_memory() {
1527 native_context()->set_out_of_memory(HEAP->true_value()); 1527 native_context()->set_out_of_memory(HEAP->true_value());
1528 } 1528 }
1529 1529
1530 1530
1531 } } // namespace v8::internal 1531 } } // namespace v8::internal
1532 1532
1533 #endif // V8_ISOLATE_H_ 1533 #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