Bug 961110 - Make internal StoreBuffer classes more public (but still not exposed) r=terrence

This commit is contained in:
Jon Coppeard 2014-01-22 11:28:06 +00:00
parent 931a0fd6de
commit a4b59f36d6

View File

@ -87,17 +87,13 @@ class StoreBuffer
* type of edge: e.g. Value or Cell*.
*/
template<typename T>
class MonoTypeBuffer
struct MonoTypeBuffer
{
friend class StoreBuffer;
LifoAlloc *storage_;
explicit MonoTypeBuffer() : storage_(nullptr) {}
~MonoTypeBuffer() { js_delete(storage_); }
MonoTypeBuffer &operator=(const MonoTypeBuffer& other) MOZ_DELETE;
bool init() {
if (!storage_)
storage_ = js_new<LifoAlloc>(LifoAllocBlockSize);
@ -142,6 +138,9 @@ class StoreBuffer
/* Mark the source of all edges in the store buffer. */
void mark(StoreBuffer *owner, JSTracer *trc);
private:
MonoTypeBuffer &operator=(const MonoTypeBuffer& other) MOZ_DELETE;
};
/*
@ -149,10 +148,8 @@ class StoreBuffer
* memory outside of the GC's control.
*/
template <typename T>
class RelocatableMonoTypeBuffer : public MonoTypeBuffer<T>
struct RelocatableMonoTypeBuffer : public MonoTypeBuffer<T>
{
friend class StoreBuffer;
/* Override compaction to filter out removed items. */
void compactMoved(StoreBuffer *owner);
virtual void compact(StoreBuffer *owner) MOZ_OVERRIDE;
@ -163,17 +160,13 @@ class StoreBuffer
}
};
class GenericBuffer
struct GenericBuffer
{
friend class StoreBuffer;
LifoAlloc *storage_;
explicit GenericBuffer() : storage_(nullptr) {}
~GenericBuffer() { js_delete(storage_); }
GenericBuffer &operator=(const GenericBuffer& other) MOZ_DELETE;
bool init() {
if (!storage_)
storage_ = js_new<LifoAlloc>(LifoAllocBlockSize);
@ -215,14 +208,13 @@ class StoreBuffer
if (isAboutToOverflow())
owner->setAboutToOverflow();
}
private:
GenericBuffer &operator=(const GenericBuffer& other) MOZ_DELETE;
};
class CellPtrEdge
struct CellPtrEdge
{
friend class StoreBuffer;
friend class StoreBuffer::MonoTypeBuffer<CellPtrEdge>;
friend class StoreBuffer::RelocatableMonoTypeBuffer<CellPtrEdge>;
Cell **edge;
explicit CellPtrEdge(Cell **v) : edge(v) {}
@ -246,12 +238,8 @@ class StoreBuffer
bool isTagged() const { return bool(uintptr_t(edge) & 1); }
};
class ValueEdge
struct ValueEdge
{
friend class StoreBuffer;
friend class StoreBuffer::MonoTypeBuffer<ValueEdge>;
friend class StoreBuffer::RelocatableMonoTypeBuffer<ValueEdge>;
JS::Value *edge;
explicit ValueEdge(JS::Value *v) : edge(v) {}
@ -278,9 +266,6 @@ class StoreBuffer
struct SlotEdge
{
friend class StoreBuffer;
friend class StoreBuffer::MonoTypeBuffer<SlotEdge>;
JSObject *object;
uint32_t offset;
int kind; // this is really just HeapSlot::Kind, but we can't see that type easily here
@ -307,11 +292,8 @@ class StoreBuffer
void mark(JSTracer *trc);
};
class WholeCellEdges
struct WholeCellEdges
{
friend class StoreBuffer;
friend class StoreBuffer::MonoTypeBuffer<WholeCellEdges>;
Cell *tenured;
WholeCellEdges(Cell *cell) : tenured(cell) {
@ -332,9 +314,8 @@ class StoreBuffer
};
template <typename Key>
class CallbackRef : public BufferableRef
struct CallbackRef : public BufferableRef
{
public:
typedef void (*MarkCallback)(JSTracer *trc, Key *key, void *data);
CallbackRef(MarkCallback cb, Key *k, void *d) : callback(cb), key(k), data(d) {}