OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 } | 226 } |
227 | 227 |
228 static ThreadState* mainThreadState() | 228 static ThreadState* mainThreadState() |
229 { | 229 { |
230 return reinterpret_cast<ThreadState*>(s_mainThreadStateStorage); | 230 return reinterpret_cast<ThreadState*>(s_mainThreadStateStorage); |
231 } | 231 } |
232 | 232 |
233 bool isMainThread() const { return this == mainThreadState(); } | 233 bool isMainThread() const { return this == mainThreadState(); } |
234 #if ENABLE(ASSERT) | 234 #if ENABLE(ASSERT) |
235 bool checkThread() const { return m_thread == currentThread(); } | 235 bool checkThread() const { return m_thread == currentThread(); } |
| 236 void incrementNumberOfSelfRefs() { ++m_numberOfSelfRefs; } |
| 237 void decrementNumberOfSelfRefs() { --m_numberOfSelfRefs; } |
236 #endif | 238 #endif |
237 | 239 |
238 void performIdleGC(double deadlineSeconds); | 240 void performIdleGC(double deadlineSeconds); |
239 void performIdleLazySweep(double deadlineSeconds); | 241 void performIdleLazySweep(double deadlineSeconds); |
240 | 242 |
241 void scheduleIdleGC(); | 243 void scheduleIdleGC(); |
242 void scheduleIdleLazySweep(); | 244 void scheduleIdleLazySweep(); |
243 void schedulePreciseGC(); | 245 void schedulePreciseGC(); |
244 void scheduleV8FollowupGCIfNeeded(BlinkGC::V8GCType); | 246 void scheduleV8FollowupGCIfNeeded(BlinkGC::V8GCType); |
245 void schedulePageNavigationGCIfNeeded(float estimatedRemovalRatio); | 247 void schedulePageNavigationGCIfNeeded(float estimatedRemovalRatio); |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 CallbackStack* m_threadLocalWeakCallbackStack; | 642 CallbackStack* m_threadLocalWeakCallbackStack; |
641 | 643 |
642 // Pre-finalizers are called in the reverse order in which they are | 644 // Pre-finalizers are called in the reverse order in which they are |
643 // registered by the constructors (including constructors of Mixin objects) | 645 // registered by the constructors (including constructors of Mixin objects) |
644 // for an object, by processing the m_orderedPreFinalizers back-to-front. | 646 // for an object, by processing the m_orderedPreFinalizers back-to-front. |
645 ListHashSet<PreFinalizer> m_orderedPreFinalizers; | 647 ListHashSet<PreFinalizer> m_orderedPreFinalizers; |
646 | 648 |
647 v8::Isolate* m_isolate; | 649 v8::Isolate* m_isolate; |
648 void (*m_traceDOMWrappers)(v8::Isolate*, Visitor*); | 650 void (*m_traceDOMWrappers)(v8::Isolate*, Visitor*); |
649 | 651 |
| 652 #if ENABLE(ASSERT) |
| 653 int m_numberOfSelfRefs; |
| 654 #endif |
| 655 |
650 #if defined(ADDRESS_SANITIZER) | 656 #if defined(ADDRESS_SANITIZER) |
651 void* m_asanFakeStack; | 657 void* m_asanFakeStack; |
652 #endif | 658 #endif |
653 | 659 |
654 // Ideally we want to allocate an array of size |gcInfoTableMax| but it will | 660 // Ideally we want to allocate an array of size |gcInfoTableMax| but it will |
655 // waste memory. Thus we limit the array size to 2^8 and share one entry | 661 // waste memory. Thus we limit the array size to 2^8 and share one entry |
656 // with multiple types of vectors. This won't be an issue in practice, | 662 // with multiple types of vectors. This won't be an issue in practice, |
657 // since there will be less than 2^8 types of objects in common cases. | 663 // since there will be less than 2^8 types of objects in common cases. |
658 static const int likelyToBePromptlyFreedArraySize = (1 << 8); | 664 static const int likelyToBePromptlyFreedArraySize = (1 << 8); |
659 static const int likelyToBePromptlyFreedArrayMask = likelyToBePromptlyFreedA
rraySize - 1; | 665 static const int likelyToBePromptlyFreedArrayMask = likelyToBePromptlyFreedA
rraySize - 1; |
(...skipping 13 matching lines...) Expand all Loading... |
673 }; | 679 }; |
674 | 680 |
675 template<> class ThreadStateFor<AnyThread> { | 681 template<> class ThreadStateFor<AnyThread> { |
676 public: | 682 public: |
677 static ThreadState* state() { return ThreadState::current(); } | 683 static ThreadState* state() { return ThreadState::current(); } |
678 }; | 684 }; |
679 | 685 |
680 } // namespace blink | 686 } // namespace blink |
681 | 687 |
682 #endif // ThreadState_h | 688 #endif // ThreadState_h |
OLD | NEW |