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

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

Issue 834673008: Extend locking of GCInfo table to include slot allocation. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Adjust position of slot initialization 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
« no previous file with comments | « no previous file | Source/platform/heap/Visitor.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/heap/Visitor.h
diff --git a/Source/platform/heap/Visitor.h b/Source/platform/heap/Visitor.h
index 587f0d6b3c3bf1aebe573743aee7b76be46ad482..f3432eaf3d49f68e82736cfff7ca9fa88b1cb815 100644
--- a/Source/platform/heap/Visitor.h
+++ b/Source/platform/heap/Visitor.h
@@ -863,7 +863,7 @@ extern PLATFORM_EXPORT GCInfo const** s_gcInfoTable;
class GCInfoTable {
public:
- PLATFORM_EXPORT static size_t allocateGCInfoSlot();
+ PLATFORM_EXPORT static void ensureGCInfoIndex(const GCInfo*, size_t*);
static void init();
static void shutdown();
@@ -872,7 +872,7 @@ public:
static const size_t maxIndex = 1 << 15;
private:
- static void resize(size_t);
+ static void resize();
static int s_gcInfoIndex;
static size_t s_gcInfoTableSize;
@@ -880,12 +880,13 @@ private:
// 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 = GCInfoTable::allocateGCInfoSlot(); \
- ASSERT(gcInfoIndex >= 1); \
- ASSERT(gcInfoIndex < GCInfoTable::maxIndex); \
- ASSERT(s_gcInfoTable); \
- s_gcInfoTable[gcInfoIndex] = &gcInfo; \
+#define RETURN_GCINFO_INDEX() \
+ static size_t gcInfoIndex = 0; \
+ ASSERT(s_gcInfoTable); \
+ if (!gcInfoIndex) \
+ GCInfoTable::ensureGCInfoIndex(&gcInfo, &gcInfoIndex); \
+ ASSERT(gcInfoIndex >= 1); \
+ ASSERT(gcInfoIndex < GCInfoTable::maxIndex); \
return gcInfoIndex;
template<typename T>
« no previous file with comments | « no previous file | Source/platform/heap/Visitor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698