Bug 888618 - Part 1: Add Cell::tenuredIsInsideZone for threadsafe asserts. (r=billm)

This commit is contained in:
Shu-yu Guo 2013-07-10 18:21:23 -07:00
parent c10fec5a62
commit 8627080ecc
2 changed files with 9 additions and 1 deletions

View File

@ -99,6 +99,7 @@ struct Cell
inline JSRuntime *runtime() const; inline JSRuntime *runtime() const;
inline Zone *tenuredZone() const; inline Zone *tenuredZone() const;
inline bool tenuredIsInsideZone(Zone *zone) const;
#ifdef DEBUG #ifdef DEBUG
inline bool isAligned() const; inline bool isAligned() const;
@ -994,6 +995,13 @@ Cell::tenuredZone() const
return arenaHeader()->zone; return arenaHeader()->zone;
} }
bool
Cell::tenuredIsInsideZone(Zone *zone) const
{
JS_ASSERT(isTenured());
return zone == arenaHeader()->zone;
}
#ifdef DEBUG #ifdef DEBUG
bool bool
Cell::isAligned() const Cell::isAligned() const

View File

@ -410,7 +410,7 @@ class JSString : public js::gc::Cell
} }
JS::Zone *zone() const { return tenuredZone(); } JS::Zone *zone() const { return tenuredZone(); }
bool isInsideZone(JS::Zone *zone_) { return zone_ == zone(); } bool isInsideZone(JS::Zone *zone_) { return tenuredIsInsideZone(zone_); }
js::gc::AllocKind getAllocKind() const { return tenuredGetAllocKind(); } js::gc::AllocKind getAllocKind() const { return tenuredGetAllocKind(); }
static inline void writeBarrierPre(JSString *str); static inline void writeBarrierPre(JSString *str);