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

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

Issue 820693006: Incremental GCInfo descriptor table expansion. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add missing PLATFORM_EXPORT Created 5 years, 11 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/Visitor.h
diff --git a/Source/platform/heap/Visitor.h b/Source/platform/heap/Visitor.h
index 314888d4a254ffef62a0f5ca1e829ec180cb72c6..b1de94998b1a039f4e9ce7b05625df5804539fbf 100644
--- a/Source/platform/heap/Visitor.h
+++ b/Source/platform/heap/Visitor.h
@@ -842,17 +842,33 @@ struct TypenameStringTrait {
};
#endif
-// s_gcInfoTable is a map used to encode a GCInfo* into a 15 bit integer.
-const size_t gcInfoIndexMax = 1 << 15;
-extern PLATFORM_EXPORT int s_gcInfoIndex;
+// s_gcInfoTable holds the per-class GCInfo descriptors; each heap
+// object header keeps its index into this table.
extern PLATFORM_EXPORT GCInfo const** s_gcInfoTable;
+class GCInfoTable {
+public:
+ PLATFORM_EXPORT static size_t allocateGCInfoSlot();
+
+ static void init();
+ static void shutdown();
+
+ // The (max + 1) GCInfo index supported.
+ static const size_t maxIndex = 1 << 15;
+
+private:
+ static void resize(size_t);
+
+ static int s_gcInfoIndex;
+ static size_t s_gcInfoTableSize;
+};
+
// This macro should be used when returning a unique 15 bit integer
// for a given gcInfo.
#define RETURN_GCINFO_INDEX() \
- static const size_t gcInfoIndex = atomicIncrement(&s_gcInfoIndex); \
+ static const size_t gcInfoIndex = GCInfoTable::allocateGCInfoSlot(); \
ASSERT(gcInfoIndex >= 1); \
- ASSERT(gcInfoIndex < gcInfoIndexMax); \
+ ASSERT(gcInfoIndex < GCInfoTable::maxIndex); \
ASSERT(s_gcInfoTable); \
s_gcInfoTable[gcInfoIndex] = &gcInfo; \
return gcInfoIndex;

Powered by Google App Engine
This is Rietveld 408576698