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 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1193 | 1193 |
1194 PRINTF_FORMAT(2, 3) void PrintWithTimestamp(const char* format, ...); | 1194 PRINTF_FORMAT(2, 3) void PrintWithTimestamp(const char* format, ...); |
1195 | 1195 |
1196 #ifdef USE_SIMULATOR | 1196 #ifdef USE_SIMULATOR |
1197 base::Mutex* simulator_i_cache_mutex() { return &simulator_i_cache_mutex_; } | 1197 base::Mutex* simulator_i_cache_mutex() { return &simulator_i_cache_mutex_; } |
1198 #endif | 1198 #endif |
1199 | 1199 |
1200 void set_allow_atomics_wait(bool set) { allow_atomics_wait_ = set; } | 1200 void set_allow_atomics_wait(bool set) { allow_atomics_wait_ = set; } |
1201 bool allow_atomics_wait() { return allow_atomics_wait_; } | 1201 bool allow_atomics_wait() { return allow_atomics_wait_; } |
1202 | 1202 |
1203 // List of native heap values allocated by the runtime as part of its | |
1204 // implementation | |
1205 // that must be freed at isolate deinit. | |
1206 class ManagedLifeline final { | |
titzer
2017/02/08 23:32:47
Please just make this a struct, forward declare it
titzer
2017/02/08 23:32:48
ManagedObjectList?
Mircea Trofin
2017/02/08 23:52:35
Maybe - although the fact it's a list is an implem
Mircea Trofin
2017/02/08 23:52:36
The user of this needs to call the value() API (se
| |
1207 public: | |
1208 typedef void (*Deleter)(void*); | |
1209 ~ManagedLifeline(); | |
1210 void* value() const { return value_; } | |
1211 | |
1212 private: | |
1213 friend class Isolate; | |
1214 | |
1215 ManagedLifeline() | |
1216 : prev_(nullptr), next_(nullptr), deleter_(nullptr), value_(nullptr) {} | |
titzer
2017/02/08 23:32:47
I think you can use the inline initializer for the
Mircea Trofin
2017/02/08 23:52:36
Acknowledged.
| |
1217 void Clear(); | |
1218 void CallDeleter(); | |
1219 | |
1220 ManagedLifeline* prev_; | |
1221 ManagedLifeline* next_; | |
1222 Deleter deleter_; | |
1223 void* value_; | |
1224 }; | |
1225 | |
1226 ManagedLifeline* AddManagedObject(void* value, | |
1227 ManagedLifeline::Deleter deleter); | |
1228 | |
1203 protected: | 1229 protected: |
1204 explicit Isolate(bool enable_serializer); | 1230 explicit Isolate(bool enable_serializer); |
1205 bool IsArrayOrObjectPrototype(Object* object); | 1231 bool IsArrayOrObjectPrototype(Object* object); |
1206 | 1232 |
1207 private: | 1233 private: |
1208 friend struct GlobalState; | 1234 friend struct GlobalState; |
1209 friend struct InitializeGlobalState; | 1235 friend struct InitializeGlobalState; |
1210 | 1236 |
1211 // These fields are accessed through the API, offsets must be kept in sync | 1237 // These fields are accessed through the API, offsets must be kept in sync |
1212 // with v8::internal::Internals (in include/v8.h) constants. This is also | 1238 // with v8::internal::Internals (in include/v8.h) constants. This is also |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1474 | 1500 |
1475 v8::Isolate::AbortOnUncaughtExceptionCallback | 1501 v8::Isolate::AbortOnUncaughtExceptionCallback |
1476 abort_on_uncaught_exception_callback_; | 1502 abort_on_uncaught_exception_callback_; |
1477 | 1503 |
1478 #ifdef USE_SIMULATOR | 1504 #ifdef USE_SIMULATOR |
1479 base::Mutex simulator_i_cache_mutex_; | 1505 base::Mutex simulator_i_cache_mutex_; |
1480 #endif | 1506 #endif |
1481 | 1507 |
1482 bool allow_atomics_wait_; | 1508 bool allow_atomics_wait_; |
1483 | 1509 |
1510 ManagedLifeline managed_lifelines_root_; | |
1511 | |
1484 friend class ExecutionAccess; | 1512 friend class ExecutionAccess; |
1485 friend class HandleScopeImplementer; | 1513 friend class HandleScopeImplementer; |
1486 friend class HeapTester; | 1514 friend class HeapTester; |
1487 friend class OptimizingCompileDispatcher; | 1515 friend class OptimizingCompileDispatcher; |
1488 friend class SweeperThread; | 1516 friend class SweeperThread; |
1489 friend class ThreadManager; | 1517 friend class ThreadManager; |
1490 friend class Simulator; | 1518 friend class Simulator; |
1491 friend class StackGuard; | 1519 friend class StackGuard; |
1492 friend class ThreadId; | 1520 friend class ThreadId; |
1493 friend class v8::Isolate; | 1521 friend class v8::Isolate; |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1710 | 1738 |
1711 EmbeddedVector<char, 128> filename_; | 1739 EmbeddedVector<char, 128> filename_; |
1712 FILE* file_; | 1740 FILE* file_; |
1713 int scope_depth_; | 1741 int scope_depth_; |
1714 }; | 1742 }; |
1715 | 1743 |
1716 } // namespace internal | 1744 } // namespace internal |
1717 } // namespace v8 | 1745 } // namespace v8 |
1718 | 1746 |
1719 #endif // V8_ISOLATE_H_ | 1747 #endif // V8_ISOLATE_H_ |
OLD | NEW |