Bug 728411 - Move more elements bits over to ObjectImpl. r=bhackett

--HG--
extra : rebase_source : bcc5f0d8fc44643675e4a9efad84c7419545bb95
This commit is contained in:
Jeff Walden 2012-02-16 19:11:06 -08:00
Родитель 29b604027d
Коммит 50113c3307
2 изменённых файлов: 20 добавлений и 18 удалений

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

@ -818,24 +818,6 @@ struct JSObject : public js::ObjectImpl
bool growElements(JSContext *cx, uintN cap);
void shrinkElements(JSContext *cx, uintN cap);
inline js::HeapValue* fixedElements() const {
JS_STATIC_ASSERT(2 * sizeof(js::Value) == sizeof(js::ObjectElements));
return &fixedSlots()[2];
}
void setFixedElements() { this->elements = fixedElements(); }
inline bool hasDynamicElements() const {
/*
* Note: for objects with zero fixed slots this could potentially give
* a spurious 'true' result, if the end of this object is exactly
* aligned with the end of its arena and dynamic slots are allocated
* immediately afterwards. Such cases cannot occur for dense arrays
* (which have at least two fixed slots) and can only result in a leak.
*/
return elements != js::emptyObjectElements && elements != fixedElements();
}
inline js::ElementIteratorObject *asElementIterator();
/*

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

@ -259,6 +259,26 @@ class ObjectImpl : public gc::Cell
return ObjectElements::fromElements(elements);
}
inline HeapValue * fixedElements() const {
MOZ_STATIC_ASSERT(2 * sizeof(Value) == sizeof(ObjectElements),
"when elements are stored inline, the first two "
"slots will hold the ObjectElements header");
return &fixedSlots()[2];
}
void setFixedElements() { this->elements = fixedElements(); }
inline bool hasDynamicElements() const {
/*
* Note: for objects with zero fixed slots this could potentially give
* a spurious 'true' result, if the end of this object is exactly
* aligned with the end of its arena and dynamic slots are allocated
* immediately afterwards. Such cases cannot occur for dense arrays
* (which have at least two fixed slots) and can only result in a leak.
*/
return elements != emptyObjectElements && elements != fixedElements();
}
/* Write barrier support. */
static inline void readBarrier(ObjectImpl *obj);
static inline void writeBarrierPre(ObjectImpl *obj);