diff --git a/js/src/jsgc.cpp b/js/src/jsgc.cpp index aedbcfec24a8..73bb5d6494eb 100644 --- a/js/src/jsgc.cpp +++ b/js/src/jsgc.cpp @@ -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(thing)->compartment(); + JSCompartment *thingCompartment = reinterpret_cast(thing)->compartment(); JSRuntime *rt = cx->runtime; JS_ASSERT(rt == thingCompartment->rt); if (rt->gcCurrentCompartment != NULL && rt->gcCurrentCompartment != thingCompartment) return false; - return !reinterpret_cast(thing)->isMarked(); + return !reinterpret_cast(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(thing); + const Cell *cell = reinterpret_cast(thing); Arena *a = cell->arena(); JS_ASSERT(cell->isMarked()); METER(cell->compartment()->rt->gcStats.unmarked++); diff --git a/js/src/jsgc.h b/js/src/jsgc.h index 7c5fb79bc13c..6247be0c9fb2 100644 --- a/js/src/jsgc.h +++ b/js/src/jsgc.h @@ -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::bitmap() const template inline T * -Arena::getAlignedThing(void *thing) +Arena::getAlignedThing(const void *thing) { jsuword start = reinterpret_cast(&t.things[0]); jsuword offset = reinterpret_cast(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(); }; diff --git a/js/src/jsgcinlines.h b/js/src/jsgcinlines.h index f8ec5fae473d..ef8d7e4d14c2 100644 --- a/js/src/jsgcinlines.h +++ b/js/src/jsgcinlines.h @@ -57,7 +57,7 @@ #endif inline bool -JSAtom::isUnitString(void *ptr) +JSAtom::isUnitString(const void *ptr) { jsuword delta = reinterpret_cast(ptr) - reinterpret_cast(unitStaticTable); @@ -70,7 +70,7 @@ JSAtom::isUnitString(void *ptr) } inline bool -JSAtom::isLength2String(void *ptr) +JSAtom::isLength2String(const void *ptr) { jsuword delta = reinterpret_cast(ptr) - reinterpret_cast(length2StaticTable); @@ -83,7 +83,7 @@ JSAtom::isLength2String(void *ptr) } inline bool -JSAtom::isHundredString(void *ptr) +JSAtom::isHundredString(const void *ptr) { jsuword delta = reinterpret_cast(ptr) - reinterpret_cast(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(thing); + const Cell *cell = reinterpret_cast(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; } diff --git a/js/src/jsstr.h b/js/src/jsstr.h index 346da6413030..a86ea52fca61 100644 --- a/js/src/jsstr.h +++ b/js/src/jsstr.h @@ -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);