зеркало из https://github.com/mozilla/gecko-dev.git
Bug 975419 - Add a JS::TenuredHeap<JSObject*> overload to TraceCallbacks. r=mccr8,terrence
This commit is contained in:
Родитель
dbe96fbc4d
Коммит
611c847a27
|
@ -324,7 +324,7 @@ class TenuredHeap : public js::HeapBase<T>
|
|||
"TenuredHeap<T> must be binary compatible with T.");
|
||||
}
|
||||
explicit TenuredHeap(T p) : bits(0) { setPtr(p); }
|
||||
explicit TenuredHeap(const TenuredHeap<T> &p) : bits(0) { setPtr(p.ptr); }
|
||||
explicit TenuredHeap(const TenuredHeap<T> &p) : bits(0) { setPtr(p.getPtr()); }
|
||||
|
||||
bool operator==(const TenuredHeap<T> &other) { return bits == other.bits; }
|
||||
bool operator!=(const TenuredHeap<T> &other) { return bits != other.bits; }
|
||||
|
|
|
@ -747,6 +747,9 @@ struct JsGcTracer : public TraceCallbacks
|
|||
virtual void Trace(JS::Heap<JSObject *> *p, const char *name, void *closure) const MOZ_OVERRIDE {
|
||||
JS_CallHeapObjectTracer(static_cast<JSTracer*>(closure), p, name);
|
||||
}
|
||||
virtual void Trace(JS::TenuredHeap<JSObject *> *p, const char *name, void *closure) const MOZ_OVERRIDE {
|
||||
JS_CallTenuredObjectTracer(static_cast<JSTracer*>(closure), p, name);
|
||||
}
|
||||
virtual void Trace(JS::Heap<JSString *> *p, const char *name, void *closure) const MOZ_OVERRIDE {
|
||||
JS_CallHeapStringTracer(static_cast<JSTracer*>(closure), p, name);
|
||||
}
|
||||
|
@ -799,6 +802,11 @@ struct ClearJSHolder : TraceCallbacks
|
|||
*aPtr = nullptr;
|
||||
}
|
||||
|
||||
virtual void Trace(JS::TenuredHeap<JSObject*>* aPtr, const char*, void*) const MOZ_OVERRIDE
|
||||
{
|
||||
*aPtr = nullptr;
|
||||
}
|
||||
|
||||
virtual void Trace(JS::Heap<JSString*>* aPtr, const char*, void*) const MOZ_OVERRIDE
|
||||
{
|
||||
*aPtr = nullptr;
|
||||
|
|
|
@ -2255,6 +2255,7 @@ public:
|
|||
{
|
||||
MOZ_ASSERT(mValues.IsEmpty());
|
||||
MOZ_ASSERT(mObjects.IsEmpty());
|
||||
MOZ_ASSERT(mTenuredObjects.IsEmpty());
|
||||
}
|
||||
|
||||
void Destroy()
|
||||
|
@ -2262,6 +2263,7 @@ public:
|
|||
mReferenceToThis = nullptr;
|
||||
mValues.Clear();
|
||||
mObjects.Clear();
|
||||
mTenuredObjects.Clear();
|
||||
mozilla::DropJSObjects(this);
|
||||
NS_RELEASE_THIS();
|
||||
}
|
||||
|
@ -2272,6 +2274,7 @@ public:
|
|||
JSPurpleBuffer*& mReferenceToThis;
|
||||
SegmentedArray<JS::Heap<JS::Value>> mValues;
|
||||
SegmentedArray<JS::Heap<JSObject*>> mObjects;
|
||||
SegmentedArray<JS::TenuredHeap<JSObject*>> mTenuredObjects;
|
||||
};
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(JSPurpleBuffer)
|
||||
|
@ -2299,6 +2302,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
|||
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(JSPurpleBuffer)
|
||||
NS_TRACE_SEGMENTED_ARRAY(mValues)
|
||||
NS_TRACE_SEGMENTED_ARRAY(mObjects)
|
||||
NS_TRACE_SEGMENTED_ARRAY(mTenuredObjects)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(JSPurpleBuffer, AddRef)
|
||||
|
@ -2384,6 +2388,14 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
virtual void Trace(JS::TenuredHeap<JSObject*>* aObject, const char* aName,
|
||||
void* aClosure) const
|
||||
{
|
||||
if (*aObject && xpc_GCThingIsGrayCCThing(*aObject)) {
|
||||
mCollector->GetJSPurpleBuffer()->mTenuredObjects.AppendElement(*aObject);
|
||||
}
|
||||
}
|
||||
|
||||
virtual void Trace(JS::Heap<JSString*>* aString, const char* aName,
|
||||
void* aClosure) const
|
||||
{
|
||||
|
|
|
@ -87,6 +87,12 @@ TraceCallbackFunc::Trace(JS::Heap<JSObject*>* p, const char* name, void* closure
|
|||
mCallback(*p, name, closure);
|
||||
}
|
||||
|
||||
void
|
||||
TraceCallbackFunc::Trace(JS::TenuredHeap<JSObject*>* p, const char* name, void* closure) const
|
||||
{
|
||||
mCallback(*p, name, closure);
|
||||
}
|
||||
|
||||
void
|
||||
TraceCallbackFunc::Trace(JS::Heap<JSFunction*>* p, const char* name, void* closure) const
|
||||
{
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#define nsCycleCollectionParticipant_h__
|
||||
|
||||
#include "nsCycleCollectionNoteChild.h"
|
||||
#include "jspubtd.h"
|
||||
#include "js/RootingAPI.h"
|
||||
|
||||
#define NS_CYCLECOLLECTIONPARTICIPANT_IID \
|
||||
{ \
|
||||
|
@ -58,6 +58,7 @@ struct TraceCallbacks
|
|||
virtual void Trace(JS::Heap<JS::Value>* p, const char* name, void* closure) const = 0;
|
||||
virtual void Trace(JS::Heap<jsid>* p, const char* name, void* closure) const = 0;
|
||||
virtual void Trace(JS::Heap<JSObject*>* p, const char* name, void* closure) const = 0;
|
||||
virtual void Trace(JS::TenuredHeap<JSObject*>* p, const char* name, void* closure) const = 0;
|
||||
virtual void Trace(JS::Heap<JSString*>* p, const char* name, void* closure) const = 0;
|
||||
virtual void Trace(JS::Heap<JSScript*>* p, const char* name, void* closure) const = 0;
|
||||
virtual void Trace(JS::Heap<JSFunction*>* p, const char* name, void* closure) const = 0;
|
||||
|
@ -76,6 +77,7 @@ struct TraceCallbackFunc : public TraceCallbacks
|
|||
virtual void Trace(JS::Heap<JS::Value>* p, const char* name, void* closure) const MOZ_OVERRIDE;
|
||||
virtual void Trace(JS::Heap<jsid>* p, const char* name, void* closure) const MOZ_OVERRIDE;
|
||||
virtual void Trace(JS::Heap<JSObject*>* p, const char* name, void* closure) const MOZ_OVERRIDE;
|
||||
virtual void Trace(JS::TenuredHeap<JSObject*>* p, const char* name, void* closure) const MOZ_OVERRIDE;
|
||||
virtual void Trace(JS::Heap<JSString*>* p, const char* name, void* closure) const MOZ_OVERRIDE;
|
||||
virtual void Trace(JS::Heap<JSScript*>* p, const char* name, void* closure) const MOZ_OVERRIDE;
|
||||
virtual void Trace(JS::Heap<JSFunction*>* p, const char* name, void* closure) const MOZ_OVERRIDE;
|
||||
|
|
Загрузка…
Ссылка в новой задаче