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 <queue> | 8 #include <queue> |
9 #include "include/v8-debug.h" | 9 #include "include/v8-debug.h" |
10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 V(int, pending_microtask_count, 0) \ | 374 V(int, pending_microtask_count, 0) \ |
375 V(bool, autorun_microtasks, true) \ | 375 V(bool, autorun_microtasks, true) \ |
376 V(HStatistics*, hstatistics, NULL) \ | 376 V(HStatistics*, hstatistics, NULL) \ |
377 V(CompilationStatistics*, turbo_statistics, NULL) \ | 377 V(CompilationStatistics*, turbo_statistics, NULL) \ |
378 V(HTracer*, htracer, NULL) \ | 378 V(HTracer*, htracer, NULL) \ |
379 V(CodeTracer*, code_tracer, NULL) \ | 379 V(CodeTracer*, code_tracer, NULL) \ |
380 V(bool, fp_stubs_generated, false) \ | 380 V(bool, fp_stubs_generated, false) \ |
381 V(int, max_available_threads, 0) \ | 381 V(int, max_available_threads, 0) \ |
382 V(uint32_t, per_isolate_assert_data, 0xFFFFFFFFu) \ | 382 V(uint32_t, per_isolate_assert_data, 0xFFFFFFFFu) \ |
383 V(PromiseRejectCallback, promise_reject_callback, NULL) \ | 383 V(PromiseRejectCallback, promise_reject_callback, NULL) \ |
| 384 V(const v8::StartupData*, snapshot_blob, NULL) \ |
384 ISOLATE_INIT_SIMULATOR_LIST(V) | 385 ISOLATE_INIT_SIMULATOR_LIST(V) |
385 | 386 |
386 #define THREAD_LOCAL_TOP_ACCESSOR(type, name) \ | 387 #define THREAD_LOCAL_TOP_ACCESSOR(type, name) \ |
387 inline void set_##name(type v) { thread_local_top_.name##_ = v; } \ | 388 inline void set_##name(type v) { thread_local_top_.name##_ = v; } \ |
388 inline type name() const { return thread_local_top_.name##_; } | 389 inline type name() const { return thread_local_top_.name##_; } |
389 | 390 |
390 | 391 |
391 class Isolate { | 392 class Isolate { |
392 // These forward declarations are required to make the friend declarations in | 393 // These forward declarations are required to make the friend declarations in |
393 // PerIsolateThreadData work on some older versions of gcc. | 394 // PerIsolateThreadData work on some older versions of gcc. |
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
986 void SetData(uint32_t slot, void* data) { | 987 void SetData(uint32_t slot, void* data) { |
987 DCHECK(slot < Internals::kNumIsolateDataSlots); | 988 DCHECK(slot < Internals::kNumIsolateDataSlots); |
988 embedder_data_[slot] = data; | 989 embedder_data_[slot] = data; |
989 } | 990 } |
990 void* GetData(uint32_t slot) { | 991 void* GetData(uint32_t slot) { |
991 DCHECK(slot < Internals::kNumIsolateDataSlots); | 992 DCHECK(slot < Internals::kNumIsolateDataSlots); |
992 return embedder_data_[slot]; | 993 return embedder_data_[slot]; |
993 } | 994 } |
994 | 995 |
995 bool serializer_enabled() const { return serializer_enabled_; } | 996 bool serializer_enabled() const { return serializer_enabled_; } |
| 997 bool snapshot_available() const { return snapshot_blob_ != NULL; } |
996 | 998 |
997 bool IsDead() { return has_fatal_error_; } | 999 bool IsDead() { return has_fatal_error_; } |
998 void SignalFatalError() { has_fatal_error_ = true; } | 1000 void SignalFatalError() { has_fatal_error_ = true; } |
999 | 1001 |
1000 bool use_crankshaft() const; | 1002 bool use_crankshaft() const; |
1001 | 1003 |
1002 bool initialized_from_snapshot() { return initialized_from_snapshot_; } | 1004 bool initialized_from_snapshot() { return initialized_from_snapshot_; } |
1003 | 1005 |
1004 double time_millis_since_init() { | 1006 double time_millis_since_init() { |
1005 return base::OS::TimeCurrentMillis() - time_millis_at_init_; | 1007 return base::OS::TimeCurrentMillis() - time_millis_at_init_; |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1121 | 1123 |
1122 uintptr_t* store_buffer_hash_set_2_address() { | 1124 uintptr_t* store_buffer_hash_set_2_address() { |
1123 return store_buffer_hash_set_2_address_; | 1125 return store_buffer_hash_set_2_address_; |
1124 } | 1126 } |
1125 | 1127 |
1126 void AddDetachedContext(Handle<Context> context); | 1128 void AddDetachedContext(Handle<Context> context); |
1127 void CheckDetachedContextsAfterGC(); | 1129 void CheckDetachedContextsAfterGC(); |
1128 | 1130 |
1129 List<Object*>* partial_snapshot_cache() { return &partial_snapshot_cache_; } | 1131 List<Object*>* partial_snapshot_cache() { return &partial_snapshot_cache_; } |
1130 | 1132 |
1131 private: | 1133 protected: |
1132 explicit Isolate(bool enable_serializer); | 1134 explicit Isolate(bool enable_serializer); |
1133 | 1135 |
| 1136 private: |
1134 friend struct GlobalState; | 1137 friend struct GlobalState; |
1135 friend struct InitializeGlobalState; | 1138 friend struct InitializeGlobalState; |
1136 | 1139 |
1137 // These fields are accessed through the API, offsets must be kept in sync | 1140 // These fields are accessed through the API, offsets must be kept in sync |
1138 // with v8::internal::Internals (in include/v8.h) constants. This is also | 1141 // with v8::internal::Internals (in include/v8.h) constants. This is also |
1139 // verified in Isolate::Init() using runtime checks. | 1142 // verified in Isolate::Init() using runtime checks. |
1140 void* embedder_data_[Internals::kNumIsolateDataSlots]; | 1143 void* embedder_data_[Internals::kNumIsolateDataSlots]; |
1141 Heap heap_; | 1144 Heap heap_; |
1142 | 1145 |
1143 // The per-process lock should be acquired before the ThreadDataTable is | 1146 // The per-process lock should be acquired before the ThreadDataTable is |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1357 friend class SweeperThread; | 1360 friend class SweeperThread; |
1358 friend class ThreadManager; | 1361 friend class ThreadManager; |
1359 friend class Simulator; | 1362 friend class Simulator; |
1360 friend class StackGuard; | 1363 friend class StackGuard; |
1361 friend class ThreadId; | 1364 friend class ThreadId; |
1362 friend class TestMemoryAllocatorScope; | 1365 friend class TestMemoryAllocatorScope; |
1363 friend class TestCodeRangeScope; | 1366 friend class TestCodeRangeScope; |
1364 friend class v8::Isolate; | 1367 friend class v8::Isolate; |
1365 friend class v8::Locker; | 1368 friend class v8::Locker; |
1366 friend class v8::Unlocker; | 1369 friend class v8::Unlocker; |
| 1370 friend v8::StartupData v8::V8::CreateSnapshotDataBlob(const char*); |
1367 | 1371 |
1368 DISALLOW_COPY_AND_ASSIGN(Isolate); | 1372 DISALLOW_COPY_AND_ASSIGN(Isolate); |
1369 }; | 1373 }; |
1370 | 1374 |
1371 | 1375 |
1372 #undef FIELD_ACCESSOR | 1376 #undef FIELD_ACCESSOR |
1373 #undef THREAD_LOCAL_TOP_ACCESSOR | 1377 #undef THREAD_LOCAL_TOP_ACCESSOR |
1374 | 1378 |
1375 | 1379 |
1376 class PromiseOnStack { | 1380 class PromiseOnStack { |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1571 } | 1575 } |
1572 | 1576 |
1573 EmbeddedVector<char, 128> filename_; | 1577 EmbeddedVector<char, 128> filename_; |
1574 FILE* file_; | 1578 FILE* file_; |
1575 int scope_depth_; | 1579 int scope_depth_; |
1576 }; | 1580 }; |
1577 | 1581 |
1578 } } // namespace v8::internal | 1582 } } // namespace v8::internal |
1579 | 1583 |
1580 #endif // V8_ISOLATE_H_ | 1584 #endif // V8_ISOLATE_H_ |
OLD | NEW |