Bug 1163643 - Fix unified build errors following recent marking changes r=terrence

This commit is contained in:
Jon Coppeard 2015-05-12 10:04:14 +01:00
parent 300b4a43e5
commit 7f518a71e6
5 changed files with 47 additions and 29 deletions

View File

@ -7,6 +7,9 @@
#ifndef gc_GCInternals_h
#define gc_GCInternals_h
#include "mozilla/ArrayUtils.h"
#include "mozilla/PodOperations.h"
#include "jscntxt.h"
#include "gc/Zone.h"
@ -192,6 +195,28 @@ struct AutoSetThreadIsSweeping
#endif
};
// Structure for counting how many times objects in a particular group have
// been tenured during a minor collection.
struct TenureCount
{
ObjectGroup* group;
int count;
};
// Keep rough track of how many times we tenure objects in particular groups
// during minor collections, using a fixed size hash for efficiency at the cost
// of potential collisions.
struct TenureCountCache
{
TenureCount entries[16];
TenureCountCache() { mozilla::PodZero(this); }
TenureCount& findEntry(ObjectGroup* group) {
return entries[PointerHasher<ObjectGroup*, 3>::hash(group) % mozilla::ArrayLength(entries)];
}
};
} /* namespace gc */
} /* namespace js */

View File

@ -1769,6 +1769,19 @@ js::gc::StoreBuffer::MonoTypeBuffer<T>::trace(StoreBuffer* owner, TenuringTracer
r.front().trace(mover);
}
namespace js {
namespace gc {
template void
StoreBuffer::MonoTypeBuffer<StoreBuffer::WholeCellEdges>::trace(StoreBuffer*, TenuringTracer&);
template void
StoreBuffer::MonoTypeBuffer<StoreBuffer::ValueEdge>::trace(StoreBuffer*, TenuringTracer&);
template void
StoreBuffer::MonoTypeBuffer<StoreBuffer::SlotsEdge>::trace(StoreBuffer*, TenuringTracer&);
template void
StoreBuffer::MonoTypeBuffer<StoreBuffer::CellPtrEdge>::trace(StoreBuffer*, TenuringTracer&);
} // namespace js
} // namespace gc
void
js::gc::StoreBuffer::SlotsEdge::trace(TenuringTracer& mover) const
{
@ -1875,28 +1888,6 @@ js::TenuringTracer::moveToTenured(JSObject* src)
return dst;
}
// Structure for counting how many times objects in a particular group have
// been tenured during a minor collection.
struct TenureCount
{
ObjectGroup* group;
int count;
};
// Keep rough track of how many times we tenure objects in particular groups
// during minor collections, using a fixed size hash for efficiency at the cost
// of potential collisions.
struct Nursery::TenureCountCache
{
TenureCount entries[16];
TenureCountCache() { PodZero(this); }
TenureCount& findEntry(ObjectGroup* group) {
return entries[PointerHasher<ObjectGroup*, 3>::hash(group) % ArrayLength(entries)];
}
};
void
js::Nursery::collectToFixedPoint(TenuringTracer& mover, TenureCountCache& tenureCounts)
{

View File

@ -10,7 +10,10 @@
#include "gc/Nursery.h"
#include "jscntxt.h"
#include "gc/Heap.h"
#include "gc/Zone.h"
#include "js/TracingAPI.h"
#include "vm/Runtime.h"

View File

@ -432,7 +432,7 @@ js::Nursery::collect(JSRuntime* rt, JS::gcreason::Reason reason, ObjectGroupList
AutoTraceSession session(rt, MinorCollecting);
AutoStopVerifyingBarriers av(rt, false);
AutoDisableProxyCheck disableStrictProxyChecking(rt);
DebugOnly<AutoEnterOOMUnsafeRegion> oomUnsafeRegion;
mozilla::DebugOnly<AutoEnterOOMUnsafeRegion> oomUnsafeRegion;
// Move objects pointed to by roots from the nursery to the major heap.
TenuringTracer mover(rt, this);

View File

@ -39,6 +39,7 @@ namespace gc {
struct Cell;
class MinorCollectionTracer;
class RelocationOverlay;
struct TenureCountCache;
} /* namespace gc */
namespace jit {
@ -82,8 +83,8 @@ class TenuringTracer : public JSTracer
size_t moveSlotsToTenured(NativeObject* dst, NativeObject* src, gc::AllocKind dstKind);
void traceObject(JSObject* src);
void markSlots(Value* vp, uint32_t nslots) { markSlots(vp, vp + nslots); }
void markSlots(Value* vp, Value* end);
void markSlots(JS::Value* vp, uint32_t nslots) { markSlots(vp, vp + nslots); }
void markSlots(JS::Value* vp, JS::Value* end);
void markTraceList(const int32_t* traceList, uint8_t* memory);
};
@ -138,7 +139,7 @@ class Nursery
JSObject* allocateObject(JSContext* cx, size_t size, size_t numDynamic, const js::Class* clasp);
/* Allocate a buffer for a given zone, using the nursery if possible. */
void* allocateBuffer(Zone* zone, uint32_t nbytes);
void* allocateBuffer(JS::Zone* zone, uint32_t nbytes);
/*
* Allocate a buffer for a given object, using the nursery if possible and
@ -327,8 +328,6 @@ class Nursery
/* Allocates a new GC thing from the tenured generation during minor GC. */
gc::TenuredCell* allocateFromTenured(JS::Zone* zone, gc::AllocKind thingKind);
struct TenureCountCache;
/* Common internal allocator function. */
void* allocate(size_t size);
@ -336,7 +335,7 @@ class Nursery
* Move the object at |src| in the Nursery to an already-allocated cell
* |dst| in Tenured.
*/
void collectToFixedPoint(TenuringTracer& trc, TenureCountCache& tenureCounts);
void collectToFixedPoint(TenuringTracer& trc, gc::TenureCountCache& tenureCounts);
/* Handle relocation of slots/elements pointers stored in Ion frames. */
void setForwardingPointer(void* oldData, void* newData, bool direct);