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

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: 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') | Source/platform/heap/Visitor.cpp » ('J')
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..989c35c31f6fdbfc2a7e0371193ee1ed857d9d11 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 bool allocateGCInfoSlot(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::allocateGCInfoSlot(gcInfoIndex)) \
+ s_gcInfoTable[gcInfoIndex] = &gcInfo; \
haraken 2015/01/10 08:37:24 Can we do this assignment in allocateGCInfoSlot? P
sof 2015/01/10 08:42:46 I suppose, but I don't see the overall benefit.
haraken 2015/01/10 08:48:45 up to you :)
sof 2015/01/10 08:54:23 Done.
+ 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') | Source/platform/heap/Visitor.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698