OLD | NEW |
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 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 static PerIsolateThreadData* CurrentPerIsolateThreadData() { | 520 static PerIsolateThreadData* CurrentPerIsolateThreadData() { |
521 return reinterpret_cast<PerIsolateThreadData*>( | 521 return reinterpret_cast<PerIsolateThreadData*>( |
522 base::Thread::GetThreadLocal(per_isolate_thread_data_key_)); | 522 base::Thread::GetThreadLocal(per_isolate_thread_data_key_)); |
523 } | 523 } |
524 | 524 |
525 // Returns the isolate inside which the current thread is running. | 525 // Returns the isolate inside which the current thread is running. |
526 INLINE(static Isolate* Current()) { | 526 INLINE(static Isolate* Current()) { |
527 DCHECK(base::Relaxed_Load(&isolate_key_created_) == 1); | 527 DCHECK(base::Relaxed_Load(&isolate_key_created_) == 1); |
528 Isolate* isolate = reinterpret_cast<Isolate*>( | 528 Isolate* isolate = reinterpret_cast<Isolate*>( |
529 base::Thread::GetExistingThreadLocal(isolate_key_)); | 529 base::Thread::GetExistingThreadLocal(isolate_key_)); |
530 DCHECK(isolate != NULL); | 530 DCHECK_NOT_NULL(isolate); |
531 return isolate; | 531 return isolate; |
532 } | 532 } |
533 | 533 |
534 // Usually called by Init(), but can be called early e.g. to allow | 534 // Usually called by Init(), but can be called early e.g. to allow |
535 // testing components that require logging but not the whole | 535 // testing components that require logging but not the whole |
536 // isolate. | 536 // isolate. |
537 // | 537 // |
538 // Safe to call more than once. | 538 // Safe to call more than once. |
539 void InitializeLoggingAndCounters(); | 539 void InitializeLoggingAndCounters(); |
540 bool InitializeCounters(); // Returns false if already initialized. | 540 bool InitializeCounters(); // Returns false if already initialized. |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
864 #define NATIVE_CONTEXT_FIELD_ACCESSOR(index, type, name) \ | 864 #define NATIVE_CONTEXT_FIELD_ACCESSOR(index, type, name) \ |
865 inline Handle<type> name(); \ | 865 inline Handle<type> name(); \ |
866 inline bool is_##name(type* value); | 866 inline bool is_##name(type* value); |
867 NATIVE_CONTEXT_FIELDS(NATIVE_CONTEXT_FIELD_ACCESSOR) | 867 NATIVE_CONTEXT_FIELDS(NATIVE_CONTEXT_FIELD_ACCESSOR) |
868 #undef NATIVE_CONTEXT_FIELD_ACCESSOR | 868 #undef NATIVE_CONTEXT_FIELD_ACCESSOR |
869 | 869 |
870 Bootstrapper* bootstrapper() { return bootstrapper_; } | 870 Bootstrapper* bootstrapper() { return bootstrapper_; } |
871 Counters* counters() { | 871 Counters* counters() { |
872 // Call InitializeLoggingAndCounters() if logging is needed before | 872 // Call InitializeLoggingAndCounters() if logging is needed before |
873 // the isolate is fully initialized. | 873 // the isolate is fully initialized. |
874 DCHECK(counters_ != NULL); | 874 DCHECK_NOT_NULL(counters_shared_.get()); |
875 return counters_; | 875 return counters_shared_.get(); |
876 } | 876 } |
877 std::shared_ptr<Counters> counters_shared() { return counters_shared_; } | 877 std::shared_ptr<Counters> counters_shared() { return counters_shared_; } |
878 RuntimeProfiler* runtime_profiler() { return runtime_profiler_; } | 878 RuntimeProfiler* runtime_profiler() { return runtime_profiler_; } |
879 CompilationCache* compilation_cache() { return compilation_cache_; } | 879 CompilationCache* compilation_cache() { return compilation_cache_; } |
880 Logger* logger() { | 880 Logger* logger() { |
881 // Call InitializeLoggingAndCounters() if logging is needed before | 881 // Call InitializeLoggingAndCounters() if logging is needed before |
882 // the isolate is fully initialized. | 882 // the isolate is fully initialized. |
883 DCHECK(logger_ != NULL); | 883 DCHECK_NOT_NULL(logger_); |
884 return logger_; | 884 return logger_; |
885 } | 885 } |
886 StackGuard* stack_guard() { return &stack_guard_; } | 886 StackGuard* stack_guard() { return &stack_guard_; } |
887 Heap* heap() { return &heap_; } | 887 Heap* heap() { return &heap_; } |
888 StatsTable* stats_table(); | 888 StatsTable* stats_table(); |
889 StubCache* load_stub_cache() { return load_stub_cache_; } | 889 StubCache* load_stub_cache() { return load_stub_cache_; } |
890 StubCache* store_stub_cache() { return store_stub_cache_; } | 890 StubCache* store_stub_cache() { return store_stub_cache_; } |
891 CodeAgingHelper* code_aging_helper() { return code_aging_helper_; } | 891 CodeAgingHelper* code_aging_helper() { return code_aging_helper_; } |
892 DeoptimizerData* deoptimizer_data() { return deoptimizer_data_; } | 892 DeoptimizerData* deoptimizer_data() { return deoptimizer_data_; } |
893 bool deoptimizer_lazy_throw() const { return deoptimizer_lazy_throw_; } | 893 bool deoptimizer_lazy_throw() const { return deoptimizer_lazy_throw_; } |
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1424 | 1424 |
1425 base::Atomic32 id_; | 1425 base::Atomic32 id_; |
1426 EntryStackItem* entry_stack_; | 1426 EntryStackItem* entry_stack_; |
1427 int stack_trace_nesting_level_; | 1427 int stack_trace_nesting_level_; |
1428 StringStream* incomplete_message_; | 1428 StringStream* incomplete_message_; |
1429 Address isolate_addresses_[kIsolateAddressCount + 1]; // NOLINT | 1429 Address isolate_addresses_[kIsolateAddressCount + 1]; // NOLINT |
1430 Bootstrapper* bootstrapper_; | 1430 Bootstrapper* bootstrapper_; |
1431 RuntimeProfiler* runtime_profiler_; | 1431 RuntimeProfiler* runtime_profiler_; |
1432 CompilationCache* compilation_cache_; | 1432 CompilationCache* compilation_cache_; |
1433 std::shared_ptr<Counters> counters_shared_; | 1433 std::shared_ptr<Counters> counters_shared_; |
1434 Counters* counters_; | |
1435 base::RecursiveMutex break_access_; | 1434 base::RecursiveMutex break_access_; |
1436 Logger* logger_; | 1435 Logger* logger_; |
1437 StackGuard stack_guard_; | 1436 StackGuard stack_guard_; |
1438 StatsTable* stats_table_; | 1437 StatsTable* stats_table_; |
1439 StubCache* load_stub_cache_; | 1438 StubCache* load_stub_cache_; |
1440 StubCache* store_stub_cache_; | 1439 StubCache* store_stub_cache_; |
1441 CodeAgingHelper* code_aging_helper_; | 1440 CodeAgingHelper* code_aging_helper_; |
1442 DeoptimizerData* deoptimizer_data_; | 1441 DeoptimizerData* deoptimizer_data_; |
1443 bool deoptimizer_lazy_throw_; | 1442 bool deoptimizer_lazy_throw_; |
1444 MaterializedObjectStore* materialized_object_store_; | 1443 MaterializedObjectStore* materialized_object_store_; |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1818 | 1817 |
1819 EmbeddedVector<char, 128> filename_; | 1818 EmbeddedVector<char, 128> filename_; |
1820 FILE* file_; | 1819 FILE* file_; |
1821 int scope_depth_; | 1820 int scope_depth_; |
1822 }; | 1821 }; |
1823 | 1822 |
1824 } // namespace internal | 1823 } // namespace internal |
1825 } // namespace v8 | 1824 } // namespace v8 |
1826 | 1825 |
1827 #endif // V8_ISOLATE_H_ | 1826 #endif // V8_ISOLATE_H_ |
OLD | NEW |