Bug 601457 diagnostic: check for setting zero ids into shapes, r=lw, a=beta8+

This commit is contained in:
David Mandelin 2010-11-08 16:20:22 -08:00
Родитель 30a8e04324
Коммит bea0ae20ca
2 изменённых файлов: 10 добавлений и 0 удалений

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

@ -326,6 +326,12 @@ JSID_TO_STRING(jsid id)
return (JSString *)(JSID_BITS(id));
}
static JS_ALWAYS_INLINE JSBool
JSID_IS_ZERO(jsid id)
{
return JSID_BITS(id) == NULL;
}
JS_PUBLIC_API(JSBool)
JS_StringHasBeenInterned(JSString *str);

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

@ -173,6 +173,10 @@ Shape::Shape(jsid id, js::PropertyOp getter, js::PropertyOp setter, uint32 slot,
table(NULL), id(id), rawGetter(getter), rawSetter(setter), slot(slot), attrs(uint8(attrs)),
flags(uint8(flags)), shortid(int16(shortid)), parent(NULL)
{
#define JS_CRASH(addr) *(int *) addr = 0
if (JSID_IS_ZERO(id))
JS_CRASH(0xa8);
#undef JS_CRASH
JS_ASSERT_IF(slotSpan != SHAPE_INVALID_SLOT, slotSpan < JSObject::NSLOTS_LIMIT);
JS_ASSERT_IF(getter && (attrs & JSPROP_GETTER), getterObj->isCallable());
JS_ASSERT_IF(setter && (attrs & JSPROP_SETTER), setterObj->isCallable());