Bug 877762 - GC: Post-barrier cycle collector participants - 6 Convert jsid and JS::String to use Heap<T> r=smaug

This commit is contained in:
Jon Coppeard 2013-06-18 11:00:38 +01:00
parent 59d5490ab4
commit a2eed15990
4 changed files with 14 additions and 17 deletions

View File

@ -70,7 +70,8 @@ private:
nsTArray<JS::Heap<JS::Value> > mArgs;
// The JS expression to evaluate or function to call, if !mExpr
JSFlatString *mExpr;
// Note this is always a flat string.
JS::Heap<JSString*> mExpr;
nsRefPtr<Function> mFunction;
};
@ -281,7 +282,7 @@ nsJSScriptTimeoutHandler::Init(nsGlobalWindow *aWindow, bool *aIsInterval,
NS_HOLD_JS_OBJECTS(this, nsJSScriptTimeoutHandler);
mExpr = expr;
mExpr = JS_FORGET_STRING_FLATNESS(expr);
// Get the calling location.
const char *filename;
@ -320,7 +321,7 @@ const PRUnichar *
nsJSScriptTimeoutHandler::GetHandlerText()
{
NS_ASSERTION(mExpr, "No expression, so no handler text!");
return ::JS_GetFlatStringChars(mExpr);
return ::JS_GetFlatStringChars(JS_ASSERT_STRING_IS_FLAT(mExpr));
}
nsresult NS_CreateJSTimeoutHandler(nsGlobalWindow *aWindow,

View File

@ -506,14 +506,14 @@ struct JsGcTracer : public TraceCallbacks
virtual void Trace(JS::Heap<JS::Value> *p, const char *name, void *closure) const MOZ_OVERRIDE {
JS_CallHeapValueTracer(static_cast<JSTracer*>(closure), p, name);
}
virtual void Trace(jsid *p, const char *name, void *closure) const MOZ_OVERRIDE {
JS_CallIdTracer(static_cast<JSTracer*>(closure), p, name);
virtual void Trace(JS::Heap<jsid> *p, const char *name, void *closure) const MOZ_OVERRIDE {
JS_CallHeapIdTracer(static_cast<JSTracer*>(closure), p, name);
}
virtual void Trace(JSObject **p, const char *name, void *closure) const MOZ_OVERRIDE {
JS_CallObjectTracer(static_cast<JSTracer*>(closure), p, name);
}
virtual void Trace(JSString **p, const char *name, void *closure) const MOZ_OVERRIDE {
JS_CallStringTracer(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);
}
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

@ -75,7 +75,7 @@ TraceCallbackFunc::Trace(JS::Heap<JS::Value>* p, const char* name, void* closure
}
void
TraceCallbackFunc::Trace(jsid* p, const char* name, void* closure) const
TraceCallbackFunc::Trace(JS::Heap<jsid>* p, const char* name, void* closure) const
{
void *thing = JSID_TO_GCTHING(*p);
if (thing) {
@ -90,7 +90,7 @@ TraceCallbackFunc::Trace(JSObject** p, const char* name, void* closure) const
}
void
TraceCallbackFunc::Trace(JSString** p, const char* name, void* closure) const
TraceCallbackFunc::Trace(JS::Heap<JSString*>* p, const char* name, void* closure) const
{
mCallback(*p, name, closure);
}

View File

@ -63,14 +63,10 @@ template <class T> class Heap;
struct TraceCallbacks
{
virtual void Trace(JS::Heap<JS::Value>* p, const char* name, void* closure) const = 0;
virtual void Trace(jsid* 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(JSObject** p, const char* name, void* closure) const = 0;
virtual void Trace(JSString** 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;
void Trace(JSFlatString** p, const char* name, void* closure) const {
Trace(reinterpret_cast<JSString**>(p), name, closure);
}
};
/*
@ -84,9 +80,9 @@ struct TraceCallbackFunc : public TraceCallbacks
explicit TraceCallbackFunc(Func cb) : mCallback(cb) {}
virtual void Trace(JS::Heap<JS::Value>* p, const char* name, void* closure) const MOZ_OVERRIDE;
virtual void Trace(jsid* 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(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(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;
private: