Bug 569422 - Add const to some GC type signature (r=brendan)

This commit is contained in:
Bill McCloskey 2011-03-23 11:57:15 -07:00
Родитель 2c3d596178
Коммит 32a17d7a6d
4 изменённых файлов: 21 добавлений и 21 удалений

Просмотреть файл

@ -494,19 +494,19 @@ AllocateArena(JSContext *cx, unsigned thingKind)
}
JS_FRIEND_API(bool)
IsAboutToBeFinalized(JSContext *cx, void *thing)
IsAboutToBeFinalized(JSContext *cx, const void *thing)
{
if (JSAtom::isStatic(thing))
return false;
JS_ASSERT(cx);
JSCompartment *thingCompartment = reinterpret_cast<Cell *>(thing)->compartment();
JSCompartment *thingCompartment = reinterpret_cast<const Cell *>(thing)->compartment();
JSRuntime *rt = cx->runtime;
JS_ASSERT(rt == thingCompartment->rt);
if (rt->gcCurrentCompartment != NULL && rt->gcCurrentCompartment != thingCompartment)
return false;
return !reinterpret_cast<Cell *>(thing)->isMarked();
return !reinterpret_cast<const Cell *>(thing)->isMarked();
}
JS_FRIEND_API(bool)
@ -1317,9 +1317,9 @@ GCMarker::~GCMarker()
}
void
GCMarker::delayMarkingChildren(void *thing)
GCMarker::delayMarkingChildren(const void *thing)
{
Cell *cell = reinterpret_cast<Cell *>(thing);
const Cell *cell = reinterpret_cast<const Cell *>(thing);
Arena<Cell> *a = cell->arena();
JS_ASSERT(cell->isMarked());
METER(cell->compartment()->rt->gcStats.unmarked++);

Просмотреть файл

@ -163,7 +163,7 @@ struct Arena {
inline ConservativeGCTest mark(T *thing, JSTracer *trc);
void markDelayedChildren(JSTracer *trc);
inline bool inFreeList(void *thing) const;
inline T *getAlignedThing(void *thing);
inline T *getAlignedThing(const void *thing);
#ifdef DEBUG
inline bool assureThingIsAligned(void *thing);
#endif
@ -428,7 +428,7 @@ Arena<T>::bitmap() const
template <typename T>
inline T *
Arena<T>::getAlignedThing(void *thing)
Arena<T>::getAlignedThing(const void *thing)
{
jsuword start = reinterpret_cast<jsuword>(&t.things[0]);
jsuword offset = reinterpret_cast<jsuword>(thing) - start;
@ -533,7 +533,7 @@ GetFinalizableTraceKind(size_t thingKind)
}
inline uint32
GetGCThingTraceKind(void *thing);
GetGCThingTraceKind(const void *thing);
static inline JSRuntime *
GetGCThingRuntime(void *thing)
@ -773,7 +773,7 @@ extern void
js_UnlockGCThingRT(JSRuntime *rt, void *thing);
extern JS_FRIEND_API(bool)
IsAboutToBeFinalized(JSContext *cx, void *thing);
IsAboutToBeFinalized(JSContext *cx, const void *thing);
extern JS_FRIEND_API(bool)
js_GCThingIsMarked(void *thing, uintN color);
@ -1013,7 +1013,7 @@ struct GCMarker : public JSTracer {
color = newColor;
}
void delayMarkingChildren(void *thing);
void delayMarkingChildren(const void *thing);
JS_FRIEND_API(void) markDelayedChildren();
};

Просмотреть файл

@ -57,7 +57,7 @@
#endif
inline bool
JSAtom::isUnitString(void *ptr)
JSAtom::isUnitString(const void *ptr)
{
jsuword delta = reinterpret_cast<jsuword>(ptr) -
reinterpret_cast<jsuword>(unitStaticTable);
@ -70,7 +70,7 @@ JSAtom::isUnitString(void *ptr)
}
inline bool
JSAtom::isLength2String(void *ptr)
JSAtom::isLength2String(const void *ptr)
{
jsuword delta = reinterpret_cast<jsuword>(ptr) -
reinterpret_cast<jsuword>(length2StaticTable);
@ -83,7 +83,7 @@ JSAtom::isLength2String(void *ptr)
}
inline bool
JSAtom::isHundredString(void *ptr)
JSAtom::isHundredString(const void *ptr)
{
jsuword delta = reinterpret_cast<jsuword>(ptr) -
reinterpret_cast<jsuword>(hundredStaticTable);
@ -96,7 +96,7 @@ JSAtom::isHundredString(void *ptr)
}
inline bool
JSAtom::isStatic(void *ptr)
JSAtom::isStatic(const void *ptr)
{
return isUnitString(ptr) || isLength2String(ptr) || isHundredString(ptr);
}
@ -105,12 +105,12 @@ namespace js {
namespace gc {
inline uint32
GetGCThingTraceKind(void *thing)
GetGCThingTraceKind(const void *thing)
{
JS_ASSERT(thing);
if (JSAtom::isStatic(thing))
return JSTRACE_STRING;
Cell *cell = reinterpret_cast<Cell *>(thing);
const Cell *cell = reinterpret_cast<const Cell *>(thing);
return GetFinalizableTraceKind(cell->arena()->header()->thingKind);
}
@ -271,7 +271,7 @@ Mark(JSTracer *trc, T *thing)
if (!IS_GC_MARKING_TRACER(trc)) {
uint32 kind = js::gc::GetGCThingTraceKind(thing);
trc->callback(trc, thing, kind);
trc->callback(trc, (void *)thing, kind);
goto out;
}

Просмотреть файл

@ -590,9 +590,9 @@ class JSAtom : public JSFixedString
private:
/* Defined in jsgcinlines.h */
static inline bool isUnitString(void *ptr);
static inline bool isLength2String(void *ptr);
static inline bool isHundredString(void *ptr);
static inline bool isUnitString(const void *ptr);
static inline bool isLength2String(const void *ptr);
static inline bool isHundredString(const void *ptr);
typedef uint8 SmallChar;
static const SmallChar INVALID_SMALL_CHAR = -1;
@ -614,7 +614,7 @@ class JSAtom : public JSFixedString
* While this query can be used for any pointer to GC thing, given a
* JSString 'str', it is more efficient to use 'str->isStaticAtom()'.
*/
static inline bool isStatic(void *ptr);
static inline bool isStatic(const void *ptr);
static inline bool hasIntStatic(int32 i);
static inline JSStaticAtom &intStatic(jsint i);