Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(238)

Unified Diff: Source/platform/heap/Heap.h

Issue 1166793002: Oilpan: add assert to verify eager finalization. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebased Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/heap/Heap.h
diff --git a/Source/platform/heap/Heap.h b/Source/platform/heap/Heap.h
index 4f30351217f07f03e3529ec06eff5a37a16f5176..47013e7283a2b562197d1b23076cca2ab6849bf7 100644
--- a/Source/platform/heap/Heap.h
+++ b/Source/platform/heap/Heap.h
@@ -1179,9 +1179,40 @@ inline bool Heap::isNormalHeapIndex(int index)
}
#if ENABLE(LAZY_SWEEPING)
-#define EAGERLY_FINALIZE() typedef int IsEagerlyFinalizedMarker
+#define DECLARE_EAGER_FINALIZATION_OPERATOR_NEW() \
+public: \
+ GC_PLUGIN_IGNORE("491488") \
+ void* operator new(size_t size) \
+ { \
+ return allocateObject(size, true); \
+ }
#define EAGERLY_FINALIZE_WILL_BE_REMOVED()
+#if ENABLE(ASSERT)
+class VerifyEagerFinalization {
+public:
+ ~VerifyEagerFinalization()
+ {
+ // If this assert triggers, the class annotated as eagerly
+ // finalized ended up not being allocated on the heap
+ // set aside for eager finalization. The reason is most
+ // likely that the effective 'operator new' overload for
+ // this class' leftmost base is for a class that is not
+ // eagerly finalized. Declaring and defining an 'operator new'
+ // for this class is what's required -- consider using
+ // DECLARE_EAGER_FINALIZATION_OPERATOR_NEW().
+ ASSERT(pageFromObject(this)->heap()->heapIndex() == EagerSweepHeapIndex);
+ }
+};
+#define EAGERLY_FINALIZE() \
+private: \
+ VerifyEagerFinalization m_verifyEagerFinalization; \
+public: \
+ typedef int IsEagerlyFinalizedMarker
+#else
+#define EAGERLY_FINALIZE() typedef int IsEagerlyFinalizedMarker
+#endif
#else
+#define DECLARE_EAGER_FINALIZATION_OPERATOR_NEW()
#define EAGERLY_FINALIZE()
// TODO(Oilpan): define in terms of Oilpan's EAGERLY_FINALIZE() once lazy
// sweeping is enabled non-Oilpan.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698