зеркало из https://github.com/mozilla/gecko-dev.git
Bug 601457 diagnostic: check for setting zero ids into shapes, r=lw, a=beta8+
This commit is contained in:
Родитель
30a8e04324
Коммит
bea0ae20ca
|
@ -326,6 +326,12 @@ JSID_TO_STRING(jsid id)
|
||||||
return (JSString *)(JSID_BITS(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_PUBLIC_API(JSBool)
|
||||||
JS_StringHasBeenInterned(JSString *str);
|
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)),
|
table(NULL), id(id), rawGetter(getter), rawSetter(setter), slot(slot), attrs(uint8(attrs)),
|
||||||
flags(uint8(flags)), shortid(int16(shortid)), parent(NULL)
|
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(slotSpan != SHAPE_INVALID_SLOT, slotSpan < JSObject::NSLOTS_LIMIT);
|
||||||
JS_ASSERT_IF(getter && (attrs & JSPROP_GETTER), getterObj->isCallable());
|
JS_ASSERT_IF(getter && (attrs & JSPROP_GETTER), getterObj->isCallable());
|
||||||
JS_ASSERT_IF(setter && (attrs & JSPROP_SETTER), setterObj->isCallable());
|
JS_ASSERT_IF(setter && (attrs & JSPROP_SETTER), setterObj->isCallable());
|
||||||
|
|
Загрузка…
Ссылка в новой задаче