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

Side by Side Diff: src/isolate.h

Issue 2887193002: Create a thread safe version of StatsCounters and use. (Closed)
Patch Set: fix nits of mtrofin Created 3 years, 7 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_ISOLATE_H_ 5 #ifndef V8_ISOLATE_H_
6 #define V8_ISOLATE_H_ 6 #define V8_ISOLATE_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <queue> 9 #include <queue>
10 10
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 DCHECK(isolate != NULL); 529 DCHECK(isolate != NULL);
530 return isolate; 530 return isolate;
531 } 531 }
532 532
533 // Usually called by Init(), but can be called early e.g. to allow 533 // Usually called by Init(), but can be called early e.g. to allow
534 // testing components that require logging but not the whole 534 // testing components that require logging but not the whole
535 // isolate. 535 // isolate.
536 // 536 //
537 // Safe to call more than once. 537 // Safe to call more than once.
538 void InitializeLoggingAndCounters(); 538 void InitializeLoggingAndCounters();
539 bool InitializeCounters(); // Returns false if already initialized.
539 540
540 bool Init(Deserializer* des); 541 bool Init(Deserializer* des);
541 542
542 // True if at least one thread Enter'ed this isolate. 543 // True if at least one thread Enter'ed this isolate.
543 bool IsInUse() { return entry_stack_ != NULL; } 544 bool IsInUse() { return entry_stack_ != NULL; }
544 545
545 // Destroys the non-default isolates. 546 // Destroys the non-default isolates.
546 // Sets default isolate into "has_been_disposed" state rather then destroying, 547 // Sets default isolate into "has_been_disposed" state rather then destroying,
547 // for legacy API reasons. 548 // for legacy API reasons.
548 void TearDown(); 549 void TearDown();
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 NATIVE_CONTEXT_FIELDS(NATIVE_CONTEXT_FIELD_ACCESSOR) 866 NATIVE_CONTEXT_FIELDS(NATIVE_CONTEXT_FIELD_ACCESSOR)
866 #undef NATIVE_CONTEXT_FIELD_ACCESSOR 867 #undef NATIVE_CONTEXT_FIELD_ACCESSOR
867 868
868 Bootstrapper* bootstrapper() { return bootstrapper_; } 869 Bootstrapper* bootstrapper() { return bootstrapper_; }
869 Counters* counters() { 870 Counters* counters() {
870 // Call InitializeLoggingAndCounters() if logging is needed before 871 // Call InitializeLoggingAndCounters() if logging is needed before
871 // the isolate is fully initialized. 872 // the isolate is fully initialized.
872 DCHECK(counters_ != NULL); 873 DCHECK(counters_ != NULL);
873 return counters_; 874 return counters_;
874 } 875 }
876 std::shared_ptr<Counters> counters_shared() { return counters_shared_; }
875 RuntimeProfiler* runtime_profiler() { return runtime_profiler_; } 877 RuntimeProfiler* runtime_profiler() { return runtime_profiler_; }
876 CompilationCache* compilation_cache() { return compilation_cache_; } 878 CompilationCache* compilation_cache() { return compilation_cache_; }
877 Logger* logger() { 879 Logger* logger() {
878 // Call InitializeLoggingAndCounters() if logging is needed before 880 // Call InitializeLoggingAndCounters() if logging is needed before
879 // the isolate is fully initialized. 881 // the isolate is fully initialized.
880 DCHECK(logger_ != NULL); 882 DCHECK(logger_ != NULL);
881 return logger_; 883 return logger_;
882 } 884 }
883 StackGuard* stack_guard() { return &stack_guard_; } 885 StackGuard* stack_guard() { return &stack_guard_; }
884 Heap* heap() { return &heap_; } 886 Heap* heap() { return &heap_; }
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
1420 CpuProfiler* cpu_profiler() const { return cpu_profiler_; } 1422 CpuProfiler* cpu_profiler() const { return cpu_profiler_; }
1421 1423
1422 base::Atomic32 id_; 1424 base::Atomic32 id_;
1423 EntryStackItem* entry_stack_; 1425 EntryStackItem* entry_stack_;
1424 int stack_trace_nesting_level_; 1426 int stack_trace_nesting_level_;
1425 StringStream* incomplete_message_; 1427 StringStream* incomplete_message_;
1426 Address isolate_addresses_[kIsolateAddressCount + 1]; // NOLINT 1428 Address isolate_addresses_[kIsolateAddressCount + 1]; // NOLINT
1427 Bootstrapper* bootstrapper_; 1429 Bootstrapper* bootstrapper_;
1428 RuntimeProfiler* runtime_profiler_; 1430 RuntimeProfiler* runtime_profiler_;
1429 CompilationCache* compilation_cache_; 1431 CompilationCache* compilation_cache_;
1432 std::shared_ptr<Counters> counters_shared_;
1430 Counters* counters_; 1433 Counters* counters_;
1431 base::RecursiveMutex break_access_; 1434 base::RecursiveMutex break_access_;
1432 Logger* logger_; 1435 Logger* logger_;
1433 StackGuard stack_guard_; 1436 StackGuard stack_guard_;
1434 StatsTable* stats_table_; 1437 StatsTable* stats_table_;
1435 StubCache* load_stub_cache_; 1438 StubCache* load_stub_cache_;
1436 StubCache* store_stub_cache_; 1439 StubCache* store_stub_cache_;
1437 CodeAgingHelper* code_aging_helper_; 1440 CodeAgingHelper* code_aging_helper_;
1438 DeoptimizerData* deoptimizer_data_; 1441 DeoptimizerData* deoptimizer_data_;
1439 bool deoptimizer_lazy_throw_; 1442 bool deoptimizer_lazy_throw_;
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
1814 1817
1815 EmbeddedVector<char, 128> filename_; 1818 EmbeddedVector<char, 128> filename_;
1816 FILE* file_; 1819 FILE* file_;
1817 int scope_depth_; 1820 int scope_depth_;
1818 }; 1821 };
1819 1822
1820 } // namespace internal 1823 } // namespace internal
1821 } // namespace v8 1824 } // namespace v8
1822 1825
1823 #endif // V8_ISOLATE_H_ 1826 #endif // V8_ISOLATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698