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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 class SafePointAwareMutexLocker; | 62 class SafePointAwareMutexLocker; |
63 class SafePointBarrier; | 63 class SafePointBarrier; |
64 class ThreadState; | 64 class ThreadState; |
65 class Visitor; | 65 class Visitor; |
66 | 66 |
67 using Address = uint8_t*; | 67 using Address = uint8_t*; |
68 | 68 |
69 using FinalizationCallback = void (*)(void*); | 69 using FinalizationCallback = void (*)(void*); |
70 using VisitorCallback = void (*)(Visitor*, void* self); | 70 using VisitorCallback = void (*)(Visitor*, void* self); |
71 using TraceCallback = VisitorCallback; | 71 using TraceCallback = VisitorCallback; |
72 using WeakPointerCallback = VisitorCallback; | 72 using WeakCallback = VisitorCallback; |
73 using EphemeronCallback = VisitorCallback; | 73 using EphemeronCallback = VisitorCallback; |
74 | 74 |
75 // Declare that a class has a pre-finalizer function. The function is called in | 75 // Declare that a class has a pre-finalizer function. The function is called in |
76 // the object's owner thread, and can access Member<>s to other | 76 // the object's owner thread, and can access Member<>s to other |
77 // garbage-collected objects allocated in the thread. However we must not | 77 // garbage-collected objects allocated in the thread. However we must not |
78 // allocate new garbage-collected objects, nor update Member<> and Persistent<> | 78 // allocate new garbage-collected objects, nor update Member<> and Persistent<> |
79 // pointers. | 79 // pointers. |
80 // | 80 // |
81 // This feature is similar to the HeapHashMap<WeakMember<Foo>, OwnPtr<Disposer>> | 81 // This feature is similar to the HeapHashMap<WeakMember<Foo>, OwnPtr<Disposer>> |
82 // idiom. The difference between this and the idiom is that pre-finalizer | 82 // idiom. The difference between this and the idiom is that pre-finalizer |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 | 491 |
492 void snapshot(); | 492 void snapshot(); |
493 void incrementMarkedObjectsAge(); | 493 void incrementMarkedObjectsAge(); |
494 | 494 |
495 void snapshotFreeListIfNecessary(); | 495 void snapshotFreeListIfNecessary(); |
496 | 496 |
497 void collectAndReportMarkSweepStats() const; | 497 void collectAndReportMarkSweepStats() const; |
498 void reportMarkSweepStats(const char* statsName, const ClassAgeCountsMap&) c
onst; | 498 void reportMarkSweepStats(const char* statsName, const ClassAgeCountsMap&) c
onst; |
499 #endif | 499 #endif |
500 | 500 |
501 void pushWeakPointerCallback(void*, WeakPointerCallback); | 501 void pushThreadLocalWeakCallback(void*, WeakCallback); |
502 bool popAndInvokeWeakPointerCallback(Visitor*); | 502 bool popAndInvokeThreadLocalWeakCallback(Visitor*); |
503 | 503 |
504 size_t objectPayloadSizeForTesting(); | 504 size_t objectPayloadSizeForTesting(); |
505 void prepareHeapForTermination(); | 505 void prepareHeapForTermination(); |
506 | 506 |
507 // Request to call a pref-finalizer of the target object before the object | 507 // Request to call a pref-finalizer of the target object before the object |
508 // is destructed. The class T must have USING_PRE_FINALIZER(). The | 508 // is destructed. The class T must have USING_PRE_FINALIZER(). The |
509 // argument should be |*this|. Registering a lot of objects affects GC | 509 // argument should be |*this|. Registering a lot of objects affects GC |
510 // performance. We should register an object only if the object really | 510 // performance. We should register an object only if the object really |
511 // requires pre-finalizer, and we should unregister the object if | 511 // requires pre-finalizer, and we should unregister the object if |
512 // pre-finalizer is unnecessary. | 512 // pre-finalizer is unnecessary. |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
690 int m_vectorBackingHeapIndex; | 690 int m_vectorBackingHeapIndex; |
691 size_t m_heapAges[NumberOfHeaps]; | 691 size_t m_heapAges[NumberOfHeaps]; |
692 size_t m_currentHeapAges; | 692 size_t m_currentHeapAges; |
693 | 693 |
694 bool m_isTerminating; | 694 bool m_isTerminating; |
695 GarbageCollectedMixinConstructorMarker* m_gcMixinMarker; | 695 GarbageCollectedMixinConstructorMarker* m_gcMixinMarker; |
696 | 696 |
697 bool m_shouldFlushHeapDoesNotContainCache; | 697 bool m_shouldFlushHeapDoesNotContainCache; |
698 GCState m_gcState; | 698 GCState m_gcState; |
699 | 699 |
700 CallbackStack* m_weakCallbackStack; | 700 CallbackStack* m_threadLocalWeakCallbackStack; |
701 HashMap<void*, bool (*)(void*, Visitor&)> m_preFinalizers; | 701 HashMap<void*, bool (*)(void*, Visitor&)> m_preFinalizers; |
702 | 702 |
703 v8::Isolate* m_isolate; | 703 v8::Isolate* m_isolate; |
704 void (*m_traceDOMWrappers)(v8::Isolate*, Visitor*); | 704 void (*m_traceDOMWrappers)(v8::Isolate*, Visitor*); |
705 | 705 |
706 #if defined(ADDRESS_SANITIZER) | 706 #if defined(ADDRESS_SANITIZER) |
707 void* m_asanFakeStack; | 707 void* m_asanFakeStack; |
708 #endif | 708 #endif |
709 | 709 |
710 Vector<PageMemoryRegion*> m_allocatedRegionsSinceLastGC; | 710 Vector<PageMemoryRegion*> m_allocatedRegionsSinceLastGC; |
(...skipping 23 matching lines...) Expand all Loading... |
734 }; | 734 }; |
735 | 735 |
736 template<> class ThreadStateFor<AnyThread> { | 736 template<> class ThreadStateFor<AnyThread> { |
737 public: | 737 public: |
738 static ThreadState* state() { return ThreadState::current(); } | 738 static ThreadState* state() { return ThreadState::current(); } |
739 }; | 739 }; |
740 | 740 |
741 } // namespace blink | 741 } // namespace blink |
742 | 742 |
743 #endif // ThreadState_h | 743 #endif // ThreadState_h |
OLD | NEW |