mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-09 05:14:24 +00:00
Backed out changeset 00313f95d106 (bug 651864).
This commit is contained in:
parent
6996d452cb
commit
6eb04a6eac
@ -3805,7 +3805,7 @@ DefineStandardSlot(JSContext *cx, JSObject *obj, JSProtoKey key, JSAtom *atom,
|
|||||||
|
|
||||||
const Shape *shape = obj->nativeLookup(id);
|
const Shape *shape = obj->nativeLookup(id);
|
||||||
if (!shape) {
|
if (!shape) {
|
||||||
uint32 slot = JS_GLOBAL_PROPERTY_SLOT(key);
|
uint32 slot = 2 * JSProto_LIMIT + key;
|
||||||
if (!js_SetReservedSlot(cx, obj, slot, v))
|
if (!js_SetReservedSlot(cx, obj, slot, v))
|
||||||
return false;
|
return false;
|
||||||
if (!obj->addProperty(cx, id, PropertyStub, StrictPropertyStub, slot, attrs, 0, 0))
|
if (!obj->addProperty(cx, id, PropertyStub, StrictPropertyStub, slot, attrs, 0, 0))
|
||||||
@ -3991,7 +3991,7 @@ IsStandardClassResolved(JSObject *obj, js::Class *clasp)
|
|||||||
JSProtoKey key = JSCLASS_CACHED_PROTO_KEY(clasp);
|
JSProtoKey key = JSCLASS_CACHED_PROTO_KEY(clasp);
|
||||||
|
|
||||||
/* If the constructor is undefined, then it hasn't been initialized. */
|
/* If the constructor is undefined, then it hasn't been initialized. */
|
||||||
return (!obj->getReservedSlot(JS_GLOBAL_CTOR_SLOT(key)).isUndefined());
|
return (obj->getReservedSlot(key) != UndefinedValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -4003,7 +4003,7 @@ MarkStandardClassInitializedNoProto(JSObject* obj, js::Class *clasp)
|
|||||||
* We use True so that it's obvious what we're doing (instead of, say,
|
* We use True so that it's obvious what we're doing (instead of, say,
|
||||||
* Null, which might be miscontrued as an error in setting Undefined).
|
* Null, which might be miscontrued as an error in setting Undefined).
|
||||||
*/
|
*/
|
||||||
if (obj->getReservedSlot(JS_GLOBAL_CTOR_SLOT(key)).isUndefined())
|
if (obj->getReservedSlot(key) == UndefinedValue())
|
||||||
obj->setSlot(key, BooleanValue(true));
|
obj->setSlot(key, BooleanValue(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4217,7 +4217,7 @@ js_GetClassObject(JSContext *cx, JSObject *obj, JSProtoKey key,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Value v = obj->getReservedSlot(JS_GLOBAL_CTOR_SLOT(key));
|
Value v = obj->getReservedSlot(key);
|
||||||
if (v.isObject()) {
|
if (v.isObject()) {
|
||||||
*objp = &v.toObject();
|
*objp = &v.toObject();
|
||||||
return true;
|
return true;
|
||||||
@ -4234,7 +4234,7 @@ js_GetClassObject(JSContext *cx, JSObject *obj, JSProtoKey key,
|
|||||||
if (JSObjectOp init = lazy_prototype_init[key]) {
|
if (JSObjectOp init = lazy_prototype_init[key]) {
|
||||||
if (!init(cx, obj))
|
if (!init(cx, obj))
|
||||||
return false;
|
return false;
|
||||||
v = obj->getReservedSlot(JS_GLOBAL_CTOR_SLOT(key));
|
v = obj->getReservedSlot(key);
|
||||||
if (v.isObject())
|
if (v.isObject())
|
||||||
cobj = &v.toObject();
|
cobj = &v.toObject();
|
||||||
}
|
}
|
||||||
@ -4250,8 +4250,8 @@ js_SetClassObject(JSContext *cx, JSObject *obj, JSProtoKey key, JSObject *cobj,
|
|||||||
if (!obj->isGlobal())
|
if (!obj->isGlobal())
|
||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
|
|
||||||
return js_SetReservedSlot(cx, obj, JS_GLOBAL_CTOR_SLOT(key), ObjectOrNullValue(cobj)) &&
|
return js_SetReservedSlot(cx, obj, key, ObjectOrNullValue(cobj)) &&
|
||||||
js_SetReservedSlot(cx, obj, JS_GLOBAL_PROTO_SLOT(key), ObjectOrNullValue(proto));
|
js_SetReservedSlot(cx, obj, JSProto_LIMIT + key, ObjectOrNullValue(proto));
|
||||||
}
|
}
|
||||||
|
|
||||||
JSBool
|
JSBool
|
||||||
@ -4292,6 +4292,8 @@ js_FindClassObject(JSContext *cx, JSObject *start, JSProtoKey protoKey,
|
|||||||
return JS_FALSE;
|
return JS_FALSE;
|
||||||
|
|
||||||
if (protoKey != JSProto_Null) {
|
if (protoKey != JSProto_Null) {
|
||||||
|
JS_ASSERT(JSProto_Null < protoKey);
|
||||||
|
JS_ASSERT(protoKey < JSProto_LIMIT);
|
||||||
if (!js_GetClassObject(cx, obj, protoKey, &cobj))
|
if (!js_GetClassObject(cx, obj, protoKey, &cobj))
|
||||||
return JS_FALSE;
|
return JS_FALSE;
|
||||||
if (cobj) {
|
if (cobj) {
|
||||||
@ -6198,7 +6200,7 @@ js_GetClassPrototype(JSContext *cx, JSObject *scopeobj, JSProtoKey protoKey,
|
|||||||
}
|
}
|
||||||
scopeobj = scopeobj->getGlobal();
|
scopeobj = scopeobj->getGlobal();
|
||||||
if (scopeobj->isGlobal()) {
|
if (scopeobj->isGlobal()) {
|
||||||
const Value &v = scopeobj->getReservedSlot(JS_GLOBAL_PROTO_SLOT(protoKey));
|
const Value &v = scopeobj->getReservedSlot(JSProto_LIMIT + protoKey);
|
||||||
if (v.isObject()) {
|
if (v.isObject()) {
|
||||||
*protop = &v.toObject();
|
*protop = &v.toObject();
|
||||||
return true;
|
return true;
|
||||||
|
@ -1226,7 +1226,7 @@ NewBuiltinClassInstance(JSContext *cx, Class *clasp, gc::FinalizeKind kind)
|
|||||||
}
|
}
|
||||||
JS_ASSERT(global->isGlobal());
|
JS_ASSERT(global->isGlobal());
|
||||||
|
|
||||||
const Value &v = global->getReservedSlot(JS_GLOBAL_PROTO_SLOT(protoKey));
|
const Value &v = global->getReservedSlot(JSProto_LIMIT + protoKey);
|
||||||
JSObject *proto;
|
JSObject *proto;
|
||||||
if (v.isObject()) {
|
if (v.isObject()) {
|
||||||
proto = &v.toObject();
|
proto = &v.toObject();
|
||||||
@ -1477,12 +1477,12 @@ DefineConstructorAndPrototype(JSContext *cx, JSObject *global,
|
|||||||
jsid id = ATOM_TO_JSID(cx->runtime->atomState.classAtoms[key]);
|
jsid id = ATOM_TO_JSID(cx->runtime->atomState.classAtoms[key]);
|
||||||
JS_ASSERT(!global->nativeLookup(id));
|
JS_ASSERT(!global->nativeLookup(id));
|
||||||
|
|
||||||
if (!global->addDataProperty(cx, id, JS_GLOBAL_PROPERTY_SLOT(key), 0))
|
if (!global->addDataProperty(cx, id, key + JSProto_LIMIT * 2, 0))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
global->setSlot(JS_GLOBAL_CTOR_SLOT(key), ObjectValue(*ctor));
|
global->setSlot(key, ObjectValue(*ctor));
|
||||||
global->setSlot(JS_GLOBAL_PROTO_SLOT(key), ObjectValue(*proto));
|
global->setSlot(key + JSProto_LIMIT, ObjectValue(*proto));
|
||||||
global->setSlot(JS_GLOBAL_PROPERTY_SLOT(key), ObjectValue(*ctor));
|
global->setSlot(key + JSProto_LIMIT * 2, ObjectValue(*ctor));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,24 +107,6 @@ typedef enum JSProtoKey {
|
|||||||
JSProto_LIMIT
|
JSProto_LIMIT
|
||||||
} JSProtoKey;
|
} JSProtoKey;
|
||||||
|
|
||||||
static void JS_CHECK_PROTOKEY_RANGE(JSProtoKey key) {
|
|
||||||
JS_ASSERT(key >= JSProto_Null);
|
|
||||||
JS_ASSERT(key < JSProto_LIMIT);
|
|
||||||
}
|
|
||||||
|
|
||||||
uintN inline JS_GLOBAL_CTOR_SLOT(JSProtoKey key) {
|
|
||||||
JS_CHECK_PROTOKEY_RANGE(key);
|
|
||||||
return key;
|
|
||||||
}
|
|
||||||
uintN inline JS_GLOBAL_PROTO_SLOT(JSProtoKey key) {
|
|
||||||
JS_CHECK_PROTOKEY_RANGE(key);
|
|
||||||
return key + JSProto_LIMIT;
|
|
||||||
}
|
|
||||||
uintN inline JS_GLOBAL_PROPERTY_SLOT(JSProtoKey key) {
|
|
||||||
JS_CHECK_PROTOKEY_RANGE(key);
|
|
||||||
return key + JSProto_LIMIT * 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* js_CheckAccess mode enumeration. */
|
/* js_CheckAccess mode enumeration. */
|
||||||
typedef enum JSAccessMode {
|
typedef enum JSAccessMode {
|
||||||
JSACC_PROTO = 0, /* XXXbe redundant w.r.t. id */
|
JSACC_PROTO = 0, /* XXXbe redundant w.r.t. id */
|
||||||
|
@ -7385,7 +7385,7 @@ JSBool
|
|||||||
js_GetAnyName(JSContext *cx, jsid *idp)
|
js_GetAnyName(JSContext *cx, jsid *idp)
|
||||||
{
|
{
|
||||||
JSObject *global = cx->running() ? cx->fp()->scopeChain().getGlobal() : cx->globalObject;
|
JSObject *global = cx->running() ? cx->fp()->scopeChain().getGlobal() : cx->globalObject;
|
||||||
Value v = global->getReservedSlot(JS_GLOBAL_CTOR_SLOT(JSProto_AnyName));
|
Value v = global->getReservedSlot(JSProto_AnyName);
|
||||||
if (v.isUndefined()) {
|
if (v.isUndefined()) {
|
||||||
JSObject *obj = NewNonFunction<WithProto::Given>(cx, &js_AnyNameClass, NULL, global);
|
JSObject *obj = NewNonFunction<WithProto::Given>(cx, &js_AnyNameClass, NULL, global);
|
||||||
if (!obj)
|
if (!obj)
|
||||||
@ -7398,7 +7398,7 @@ js_GetAnyName(JSContext *cx, jsid *idp)
|
|||||||
METER(xml_stats.qname);
|
METER(xml_stats.qname);
|
||||||
|
|
||||||
v.setObject(*obj);
|
v.setObject(*obj);
|
||||||
if (!js_SetReservedSlot(cx, global, JS_GLOBAL_CTOR_SLOT(JSProto_AnyName), v))
|
if (!js_SetReservedSlot(cx, global, JSProto_AnyName, v))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
*idp = OBJECT_TO_JSID(&v.toObject());
|
*idp = OBJECT_TO_JSID(&v.toObject());
|
||||||
|
Loading…
Reference in New Issue
Block a user