Bug 880816 - Allow the store buffer to store and mark whole IonCodes; r=billm

--HG--
extra : rebase_source : 91f13fe33baecd74051126136060977e209bda22
This commit is contained in:
Terrence Cole 2013-06-13 10:34:40 -07:00
parent 33b41fc292
commit 3158dd4927
3 changed files with 31 additions and 26 deletions

View File

@ -58,14 +58,19 @@ StoreBuffer::SlotEdge::isNullEdge() const
}
void
StoreBuffer::WholeObjectEdges::mark(JSTracer *trc)
StoreBuffer::WholeCellEdges::mark(JSTracer *trc)
{
tenured->markChildren(trc);
JSGCTraceKind kind = GetGCThingTraceKind(tenured);
if (kind <= JSTRACE_OBJECT) {
MarkChildren(trc, static_cast<JSObject *>(tenured));
return;
}
JS_ASSERT(kind == JSTRACE_IONCODE);
static_cast<ion::IonCode *>(tenured)->trace(trc);
}
/*** MonoTypeBuffer ***/
/* How full we allow a store buffer to become before we request a MinorGC. */
const static double HighwaterRatio = 7.0 / 8.0;
@ -193,13 +198,13 @@ class AccumulateEdgesTracer : public JSTracer
template <>
bool
StoreBuffer::MonoTypeBuffer<StoreBuffer::WholeObjectEdges>::accumulateEdges(EdgeSet &edges)
StoreBuffer::MonoTypeBuffer<StoreBuffer::WholeCellEdges>::accumulateEdges(EdgeSet &edges)
{
compact();
AccumulateEdgesTracer trc(owner->runtime, &edges);
StoreBuffer::WholeObjectEdges *cursor = base;
StoreBuffer::WholeCellEdges *cursor = base;
while (cursor != pos) {
cursor->tenured->markChildren(&trc);
cursor->mark(&trc);
cursor++;
}
return true;
@ -348,9 +353,9 @@ StoreBuffer::enable()
return false;
offset += SlotBufferSize;
if (!bufferWholeObject.enable(&asBytes[offset], WholeObjectBufferSize))
if (!bufferWholeCell.enable(&asBytes[offset], WholeCellBufferSize))
return false;
offset += WholeObjectBufferSize;
offset += WholeCellBufferSize;
if (!bufferRelocVal.enable(&asBytes[offset], RelocValueBufferSize))
return false;
@ -381,7 +386,7 @@ StoreBuffer::disable()
bufferVal.disable();
bufferCell.disable();
bufferSlot.disable();
bufferWholeObject.disable();
bufferWholeCell.disable();
bufferRelocVal.disable();
bufferRelocCell.disable();
bufferGeneric.disable();
@ -402,7 +407,7 @@ StoreBuffer::clear()
bufferVal.clear();
bufferCell.clear();
bufferSlot.clear();
bufferWholeObject.clear();
bufferWholeCell.clear();
bufferRelocVal.clear();
bufferRelocCell.clear();
bufferGeneric.clear();
@ -419,7 +424,7 @@ StoreBuffer::mark(JSTracer *trc)
bufferVal.mark(trc);
bufferCell.mark(trc);
bufferSlot.mark(trc);
bufferWholeObject.mark(trc);
bufferWholeCell.mark(trc);
bufferRelocVal.mark(trc);
bufferRelocCell.mark(trc);
bufferGeneric.mark(trc);
@ -453,7 +458,7 @@ StoreBuffer::coalesceForVerification()
return false;
if (!bufferSlot.accumulateEdges(edgeSet))
return false;
if (!bufferWholeObject.accumulateEdges(edgeSet))
if (!bufferWholeCell.accumulateEdges(edgeSet))
return false;
if (!bufferRelocVal.accumulateEdges(edgeSet))
return false;
@ -517,7 +522,7 @@ JS::HeapValueRelocate(JS::Value *valuep)
template class StoreBuffer::MonoTypeBuffer<StoreBuffer::ValueEdge>;
template class StoreBuffer::MonoTypeBuffer<StoreBuffer::CellPtrEdge>;
template class StoreBuffer::MonoTypeBuffer<StoreBuffer::SlotEdge>;
template class StoreBuffer::MonoTypeBuffer<StoreBuffer::WholeObjectEdges>;
template class StoreBuffer::MonoTypeBuffer<StoreBuffer::WholeCellEdges>;
template class StoreBuffer::RelocatableMonoTypeBuffer<StoreBuffer::ValueEdge>;
template class StoreBuffer::RelocatableMonoTypeBuffer<StoreBuffer::CellPtrEdge>;

View File

@ -381,19 +381,19 @@ class StoreBuffer
void mark(JSTracer *trc);
};
class WholeObjectEdges
class WholeCellEdges
{
friend class StoreBuffer;
friend class StoreBuffer::MonoTypeBuffer<WholeObjectEdges>;
friend class StoreBuffer::MonoTypeBuffer<WholeCellEdges>;
JSObject *tenured;
Cell *tenured;
WholeObjectEdges(JSObject *obj) : tenured(obj) {
WholeCellEdges(Cell *cell) : tenured(cell) {
JS_ASSERT(tenured->isTenured());
}
bool operator==(const WholeObjectEdges &other) const { return tenured == other.tenured; }
bool operator!=(const WholeObjectEdges &other) const { return tenured != other.tenured; }
bool operator==(const WholeCellEdges &other) const { return tenured == other.tenured; }
bool operator!=(const WholeCellEdges &other) const { return tenured != other.tenured; }
template <typename NurseryType>
bool inRememberedSet(NurseryType *nursery) const { return true; }
@ -409,7 +409,7 @@ class StoreBuffer
MonoTypeBuffer<ValueEdge> bufferVal;
MonoTypeBuffer<CellPtrEdge> bufferCell;
MonoTypeBuffer<SlotEdge> bufferSlot;
MonoTypeBuffer<WholeObjectEdges> bufferWholeObject;
MonoTypeBuffer<WholeCellEdges> bufferWholeCell;
RelocatableMonoTypeBuffer<ValueEdge> bufferRelocVal;
RelocatableMonoTypeBuffer<CellPtrEdge> bufferRelocCell;
GenericBuffer bufferGeneric;
@ -429,18 +429,18 @@ class StoreBuffer
static const size_t ValueBufferSize = 1 * 1024 * sizeof(ValueEdge);
static const size_t CellBufferSize = 2 * 1024 * sizeof(CellPtrEdge);
static const size_t SlotBufferSize = 2 * 1024 * sizeof(SlotEdge);
static const size_t WholeObjectBufferSize = 2 * 1024 * sizeof(WholeObjectEdges);
static const size_t WholeCellBufferSize = 2 * 1024 * sizeof(WholeCellEdges);
static const size_t RelocValueBufferSize = 1 * 1024 * sizeof(ValueEdge);
static const size_t RelocCellBufferSize = 1 * 1024 * sizeof(CellPtrEdge);
static const size_t GenericBufferSize = 1 * 1024 * sizeof(int);
static const size_t TotalSize = ValueBufferSize + CellBufferSize +
SlotBufferSize + WholeObjectBufferSize +
SlotBufferSize + WholeCellBufferSize +
RelocValueBufferSize + RelocCellBufferSize +
GenericBufferSize;
public:
explicit StoreBuffer(JSRuntime *rt)
: bufferVal(this), bufferCell(this), bufferSlot(this), bufferWholeObject(this),
: bufferVal(this), bufferCell(this), bufferSlot(this), bufferWholeCell(this),
bufferRelocVal(this), bufferRelocCell(this), bufferGeneric(this),
runtime(rt), buffer(NULL), aboutToOverflow(false), overflowed(false),
enabled(false)
@ -466,8 +466,8 @@ class StoreBuffer
void putSlot(JSObject *obj, HeapSlot::Kind kind, uint32_t slot) {
bufferSlot.put(SlotEdge(obj, kind, slot));
}
void putWholeObject(JSObject *obj) {
bufferWholeObject.put(WholeObjectEdges(obj));
void putWholeCell(Cell *cell) {
bufferWholeCell.put(WholeCellEdges(cell));
}
/* Insert or update a single edge in the Relocatable buffer. */

View File

@ -576,7 +576,7 @@ PostWriteBarrier(JSRuntime *rt, JSObject *obj)
return;
#endif
JS_ASSERT(!IsInsideNursery(rt, obj));
rt->gcStoreBuffer.putWholeObject(obj);
rt->gcStoreBuffer.putWholeCell(obj);
}
#endif