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

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

Issue 371623002: [oilpan]: Make thread shutdown more robust. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: review feedback Created 6 years, 5 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
Index: Source/platform/heap/ThreadState.h
diff --git a/Source/platform/heap/ThreadState.h b/Source/platform/heap/ThreadState.h
index 5269820c6417a1cff55af4d7d8237da95eed2fb1..fa2d9fddf61f8cbedad8ba796d77fca8fb9dedc8 100644
--- a/Source/platform/heap/ThreadState.h
+++ b/Source/platform/heap/ThreadState.h
@@ -49,6 +49,7 @@ class FinalizedHeapObjectHeader;
struct GCInfo;
class HeapContainsCache;
class HeapObjectHeader;
+class PageMemory;
class PersistentNode;
class Visitor;
class SafePointBarrier;
@@ -507,6 +508,9 @@ public:
HeapStats& stats() { return m_stats; }
HeapStats& statsAfterLastGC() { return m_statsAfterLastGC; }
+ void setupHeapsForShutdown();
+ void visitLocalRoots(Visitor*);
+
private:
explicit ThreadState();
~ThreadState();
@@ -657,6 +661,63 @@ private:
bool m_locked;
};
+// Common header for heap pages. Needs to be defined before class Visitor.
Mads Ager (chromium) 2014/07/08 08:24:56 Our file setup is becoming really messy. :-\ This
wibling-chromium 2014/07/08 13:39:48 Agree. I was more thinking about going in the oppo
+class BaseHeapPage {
+public:
+ BaseHeapPage(PageMemory*, const GCInfo*, ThreadState*);
+ virtual ~BaseHeapPage() { }
+
+ // Check if the given address points to an object in this
+ // heap page. If so, find the start of that object and mark it
+ // using the given Visitor. Otherwise do nothing. The pointer must
+ // be within the same aligned blinkPageSize as the this-pointer.
+ //
+ // This is used during conservative stack scanning to
+ // conservatively mark all objects that could be referenced from
+ // the stack.
+ virtual void checkAndMarkPointer(Visitor*, Address) = 0;
+ virtual bool contains(Address) = 0;
+
+#if ENABLE(GC_TRACING)
+ virtual const GCInfo* findGCInfo(Address) = 0;
+#endif
+
+ Address address() { return reinterpret_cast<Address>(this); }
+ PageMemory* storage() const { return m_storage; }
+ ThreadState* threadState() const { return m_threadState; }
+ const GCInfo* gcInfo() { return m_gcInfo; }
+ virtual bool isLargeObject() { return false; }
+ virtual void markOrphaned()
+ {
+ m_threadState = 0;
+ m_shuttingDown = false;
+ m_traced = false;
+ }
+ bool orphaned() { return !m_threadState; }
+ bool shuttingDown() { return m_shuttingDown; }
+ void setShutdown() { m_shuttingDown = true; }
+ bool traced() { return m_traced; }
+ void setTraced() { m_traced = true; }
+ bool reuseMemory() { return m_reuseMemory; }
+ void clearReuseMemory() { m_reuseMemory = false; }
+ void setReuseMemory() { m_reuseMemory = true; }
haraken 2014/07/08 05:44:51 Instead of introducing clearReuseMemory and setReu
Mads Ager (chromium) 2014/07/08 08:24:56 We already have this information. We have the virt
wibling-chromium 2014/07/08 13:39:48 Done.
wibling-chromium 2014/07/08 13:39:48 I got rid of this and used isLargeObject as sugges
+
+private:
+ // Accessor to silence unused warnings for the m_padding field.
+ intptr_t padding() const { return m_padding; }
+
+ PageMemory* m_storage;
+ const GCInfo* m_gcInfo;
+ ThreadState* m_threadState;
+ bool m_shuttingDown;
+ bool m_traced;
+ bool m_reuseMemory;
Mads Ager (chromium) 2014/07/08 08:24:56 Are you sure we are maintaining correct alignment
wibling-chromium 2014/07/08 13:39:48 No, I will spend some time to make sure it is okay
+ // Pointer sized integer to ensure proper alignment of the
+ // HeapPage header. This can be used as a bit field if we need
+ // to associate more information with pages.
+ intptr_t m_padding;
+};
+
}
#endif // ThreadState_h

Powered by Google App Engine
This is Rietveld 408576698