Bug 877762 - GC: Post-barrier cycle collector participants - 4 Convert JSScript* to use Heap<T> r=smaug

This commit is contained in:
Jon Coppeard 2013-06-18 11:00:37 +01:00
parent d6fdbd88b7
commit ab74ea727b
4 changed files with 13 additions and 9 deletions

View File

@ -243,13 +243,13 @@ public:
// &mScriptObject pointer can't go stale.
JS::Handle<JSScript*> GetScriptObject()
{
return JS::Handle<JSScript*>::fromMarkedLocation(&mScriptObject);
return JS::Handle<JSScript*>(mScriptObject);
}
void TraceScriptObject(JSTracer* aTrc)
{
if (mScriptObject) {
JS_CallScriptTracer(aTrc, &mScriptObject, "active window XUL prototype script");
JS_CallHeapScriptTracer(aTrc, &mScriptObject, "active window XUL prototype script");
}
}
@ -267,7 +267,7 @@ public:
mozilla::dom::XULDocument* mSrcLoadWaiters; // [OWNER] but not COMPtr
uint32_t mLangVersion;
private:
JSScript* mScriptObject;
JS::Heap<JSScript*> mScriptObject;
};
class nsXULPrototypeText : public nsXULPrototypeNode

View File

@ -515,8 +515,8 @@ struct JsGcTracer : public TraceCallbacks
virtual void Trace(JSString **p, const char *name, void *closure) const MOZ_OVERRIDE {
JS_CallStringTracer(static_cast<JSTracer*>(closure), p, name);
}
virtual void Trace(JSScript **p, const char *name, void *closure) const MOZ_OVERRIDE {
JS_CallScriptTracer(static_cast<JSTracer*>(closure), p, name);
virtual void Trace(JS::Heap<JSScript *> *p, const char *name, void *closure) const MOZ_OVERRIDE {
JS_CallHeapScriptTracer(static_cast<JSTracer*>(closure), p, name);
}
};

View File

@ -96,7 +96,7 @@ TraceCallbackFunc::Trace(JSString** p, const char* name, void* closure) const
}
void
TraceCallbackFunc::Trace(JSScript** p, const char* name, void* closure) const
TraceCallbackFunc::Trace(JS::Heap<JSScript*>* p, const char* name, void* closure) const
{
mCallback(*p, name, closure);
mCallback(p->get(), name, closure);
}

View File

@ -51,6 +51,10 @@ class nsCycleCollectionParticipant;
class nsScriptObjectTracer;
class nsXPCOMCycleCollectionParticipant;
namespace JS {
template <class T> class Heap;
} /* namespace JS */
/*
* A struct defining pure virtual methods which are called when tracing cycle
* collection paticipants. The appropriate method is called depending on the
@ -62,7 +66,7 @@ struct TraceCallbacks
virtual void Trace(jsid* p, const char* name, void* closure) const = 0;
virtual void Trace(JSObject** p, const char* name, void* closure) const = 0;
virtual void Trace(JSString** p, const char* name, void* closure) const = 0;
virtual void Trace(JSScript** p, const char* name, void* closure) const = 0;
virtual void Trace(JS::Heap<JSScript*>* p, const char* name, void* closure) const = 0;
void Trace(JSFlatString** p, const char* name, void* closure) const {
Trace(reinterpret_cast<JSString**>(p), name, closure);
@ -83,7 +87,7 @@ struct TraceCallbackFunc : public TraceCallbacks
virtual void Trace(jsid* p, const char* name, void* closure) const MOZ_OVERRIDE;
virtual void Trace(JSObject** p, const char* name, void* closure) const MOZ_OVERRIDE;
virtual void Trace(JSString** p, const char* name, void* closure) const MOZ_OVERRIDE;
virtual void Trace(JSScript** p, const char* name, void* closure) const MOZ_OVERRIDE;
virtual void Trace(JS::Heap<JSScript*>* p, const char* name, void* closure) const MOZ_OVERRIDE;
private:
Func mCallback;