Bug 980016 - Remove SpecialId. r=njn.

This commit is contained in:
Jason Orendorff 2014-03-10 16:32:21 -05:00
parent 37cf50eee9
commit 6e646ba4e9
16 changed files with 2 additions and 489 deletions

View File

@ -31,120 +31,13 @@ namespace js {
class Class;
class FreeOp;
class PropertyId;
class PropertyName;
class Shape;
class SpecialId;
// This is equal to JSFunction::class_. Use it in places where you don't want
// to #include jsfun.h.
extern JS_FRIEND_DATA(const js::Class* const) FunctionClassPtr;
static MOZ_ALWAYS_INLINE jsid
SPECIALID_TO_JSID(const SpecialId &sid);
/*
* We partition the ways to refer to a property into three: by an index
* (uint32_t); by a string whose characters do not represent an index
* (PropertyName, see vm/String.h); and by various special values.
*
* Special values are encoded using SpecialId, which is layout-compatible but
* non-interconvertible with jsid. A SpecialId is used for JSID_VOID, which
* does not occur in JS scripts but may be used to indicate the absence of a
* valid identifier. In the future, a SpecialId may also be an object used by
* Harmony-proposed private names.
*/
class SpecialId
{
uintptr_t bits_;
/* Needs access to raw bits. */
friend MOZ_ALWAYS_INLINE jsid SPECIALID_TO_JSID(const SpecialId &sid);
friend class PropertyId;
static const uintptr_t TYPE_VOID = JSID_TYPE_VOID;
static const uintptr_t TYPE_OBJECT = JSID_TYPE_OBJECT;
static const uintptr_t TYPE_MASK = JSID_TYPE_MASK;
SpecialId(uintptr_t bits) : bits_(bits) { }
public:
SpecialId() : bits_(TYPE_VOID) { }
/* Object-valued */
SpecialId(JSObject &obj)
: bits_(uintptr_t(&obj) | TYPE_OBJECT)
{
MOZ_ASSERT(&obj != nullptr);
MOZ_ASSERT((uintptr_t(&obj) & TYPE_MASK) == 0);
}
bool isObject() const {
return (bits_ & TYPE_MASK) == TYPE_OBJECT && bits_ != TYPE_OBJECT;
}
JSObject *toObject() const {
MOZ_ASSERT(isObject());
return reinterpret_cast<JSObject *>(bits_ & ~TYPE_MASK);
}
/* Empty */
static SpecialId empty() {
SpecialId sid(TYPE_OBJECT);
MOZ_ASSERT(sid.isEmpty());
return sid;
}
bool isEmpty() const {
return bits_ == TYPE_OBJECT;
}
/* Void */
static SpecialId voidId() {
SpecialId sid(TYPE_VOID);
MOZ_ASSERT(sid.isVoid());
return sid;
}
bool isVoid() const {
return bits_ == TYPE_VOID;
}
};
static MOZ_ALWAYS_INLINE jsid
SPECIALID_TO_JSID(const SpecialId &sid)
{
jsid id;
JSID_BITS(id) = sid.bits_;
MOZ_ASSERT_IF(sid.isObject(), JSID_IS_OBJECT(id) && JSID_TO_OBJECT(id) == sid.toObject());
MOZ_ASSERT_IF(sid.isVoid(), JSID_IS_VOID(id));
MOZ_ASSERT_IF(sid.isEmpty(), JSID_IS_EMPTY(id));
return id;
}
static MOZ_ALWAYS_INLINE bool
JSID_IS_SPECIAL(jsid id)
{
return JSID_IS_OBJECT(id) || JSID_IS_EMPTY(id) || JSID_IS_VOID(id);
}
static MOZ_ALWAYS_INLINE SpecialId
JSID_TO_SPECIALID(jsid id)
{
MOZ_ASSERT(JSID_IS_SPECIAL(id));
if (JSID_IS_OBJECT(id))
return SpecialId(*JSID_TO_OBJECT(id));
if (JSID_IS_EMPTY(id))
return SpecialId::empty();
MOZ_ASSERT(JSID_IS_VOID(id));
return SpecialId::voidId();
}
typedef JS::Handle<SpecialId> HandleSpecialId;
} // namespace js
// JSClass operation signatures.
@ -314,9 +207,6 @@ typedef bool
(* LookupElementOp)(JSContext *cx, JS::HandleObject obj, uint32_t index,
JS::MutableHandleObject objp, JS::MutableHandle<Shape*> propp);
typedef bool
(* LookupSpecialOp)(JSContext *cx, JS::HandleObject obj, HandleSpecialId sid,
JS::MutableHandleObject objp, JS::MutableHandle<Shape*> propp);
typedef bool
(* DefineGenericOp)(JSContext *cx, JS::HandleObject obj, JS::HandleId id, JS::HandleValue value,
JSPropertyOp getter, JSStrictPropertyOp setter, unsigned attrs);
typedef bool
@ -327,10 +217,6 @@ typedef bool
(* DefineElementOp)(JSContext *cx, JS::HandleObject obj, uint32_t index, JS::HandleValue value,
JSPropertyOp getter, JSStrictPropertyOp setter, unsigned attrs);
typedef bool
(* DefineSpecialOp)(JSContext *cx, JS::HandleObject obj, HandleSpecialId sid,
JS::HandleValue value, JSPropertyOp getter, JSStrictPropertyOp setter,
unsigned attrs);
typedef bool
(* GenericIdOp)(JSContext *cx, JS::HandleObject obj, JS::HandleObject receiver, JS::HandleId id,
JS::MutableHandleValue vp);
typedef bool
@ -340,9 +226,6 @@ typedef bool
(* ElementIdOp)(JSContext *cx, JS::HandleObject obj, JS::HandleObject receiver, uint32_t index,
JS::MutableHandleValue vp);
typedef bool
(* SpecialIdOp)(JSContext *cx, JS::HandleObject obj, JS::HandleObject receiver,
HandleSpecialId sid, JS::MutableHandleValue vp);
typedef bool
(* StrictGenericIdOp)(JSContext *cx, JS::HandleObject obj, JS::HandleId id,
JS::MutableHandleValue vp, bool strict);
typedef bool
@ -352,9 +235,6 @@ typedef bool
(* StrictElementIdOp)(JSContext *cx, JS::HandleObject obj, uint32_t index,
JS::MutableHandleValue vp, bool strict);
typedef bool
(* StrictSpecialIdOp)(JSContext *cx, JS::HandleObject obj, HandleSpecialId sid,
JS::MutableHandleValue vp, bool strict);
typedef bool
(* GenericAttributesOp)(JSContext *cx, JS::HandleObject obj, JS::HandleId id, unsigned *attrsp);
typedef bool
(* PropertyAttributesOp)(JSContext *cx, JS::HandleObject obj, JS::Handle<PropertyName*> name,
@ -364,8 +244,6 @@ typedef bool
bool *succeeded);
typedef bool
(* DeleteElementOp)(JSContext *cx, JS::HandleObject obj, uint32_t index, bool *succeeded);
typedef bool
(* DeleteSpecialOp)(JSContext *cx, JS::HandleObject obj, HandleSpecialId sid, bool *succeeded);
typedef bool
(* WatchOp)(JSContext *cx, JS::HandleObject obj, JS::HandleId id, JS::HandleObject callable);
@ -453,24 +331,19 @@ struct ObjectOps
LookupGenericOp lookupGeneric;
LookupPropOp lookupProperty;
LookupElementOp lookupElement;
LookupSpecialOp lookupSpecial;
DefineGenericOp defineGeneric;
DefinePropOp defineProperty;
DefineElementOp defineElement;
DefineSpecialOp defineSpecial;
GenericIdOp getGeneric;
PropertyIdOp getProperty;
ElementIdOp getElement;
SpecialIdOp getSpecial;
StrictGenericIdOp setGeneric;
StrictPropertyIdOp setProperty;
StrictElementIdOp setElement;
StrictSpecialIdOp setSpecial;
GenericAttributesOp getGenericAttributes;
GenericAttributesOp setGenericAttributes;
DeletePropertyOp deleteProperty;
DeleteElementOp deleteElement;
DeleteSpecialOp deleteSpecial;
WatchOp watch;
UnwatchOp unwatch;
SliceOp slice; // Optimized slice, can be null.
@ -482,7 +355,7 @@ struct ObjectOps
#define JS_NULL_OBJECT_OPS \
{nullptr,nullptr,nullptr,nullptr,nullptr,nullptr,nullptr,nullptr,nullptr, \
nullptr,nullptr,nullptr,nullptr,nullptr,nullptr,nullptr,nullptr,nullptr, \
nullptr,nullptr,nullptr,nullptr,nullptr,nullptr,nullptr}
nullptr,nullptr}
} // namespace js
@ -493,7 +366,7 @@ typedef void (*JSClassInternal)();
struct JSClass {
JS_CLASS_MEMBERS(JSFinalizeOp);
void *reserved[36];
void *reserved[31];
};
#define JSCLASS_HAS_PRIVATE (1<<0) // objects have private slot
@ -659,21 +532,6 @@ ObjectClassIs(JSObject &obj, ESClassValue classValue, JSContext *cx);
inline bool
IsObjectWithClass(const JS::Value &v, ESClassValue classValue, JSContext *cx);
inline bool
IsPoisonedSpecialId(js::SpecialId iden)
{
if (iden.isObject())
return JS::IsPoisonedPtr(iden.toObject());
return false;
}
template <> struct GCMethods<SpecialId>
{
static SpecialId initial() { return SpecialId(); }
static ThingRootKind kind() { return THING_ROOT_ID; }
static bool poisoned(SpecialId id) { return IsPoisonedSpecialId(id); }
};
} /* namespace js */
#endif /* js_Class_h */

View File

@ -1693,15 +1693,6 @@ ReportPropertyError(JSContext *cx,
return false;
}
bool
TypedObject::obj_lookupSpecial(JSContext *cx, HandleObject obj,
HandleSpecialId sid, MutableHandleObject objp,
MutableHandleShape propp)
{
RootedId id(cx, SPECIALID_TO_JSID(sid));
return obj_lookupGeneric(cx, obj, id, objp, propp);
}
bool
TypedObject::obj_defineGeneric(JSContext *cx, HandleObject obj, HandleId id, HandleValue v,
PropertyOp getter, StrictPropertyOp setter, unsigned attrs)
@ -1730,14 +1721,6 @@ TypedObject::obj_defineElement(JSContext *cx, HandleObject obj, uint32_t index,
return baseops::DefineElement(cx, delegate, index, v, getter, setter, attrs);
}
bool
TypedObject::obj_defineSpecial(JSContext *cx, HandleObject obj, HandleSpecialId sid, HandleValue v,
PropertyOp getter, StrictPropertyOp setter, unsigned attrs)
{
Rooted<jsid> id(cx, SPECIALID_TO_JSID(sid));
return obj_defineGeneric(cx, obj, id, v, getter, setter, attrs);
}
bool
TypedObject::obj_getGeneric(JSContext *cx, HandleObject obj, HandleObject receiver,
HandleId id, MutableHandleValue vp)
@ -1859,15 +1842,6 @@ TypedObject::obj_getArrayElement(JSContext *cx,
return Reify(cx, elementType, typedObj, offset, vp);
}
bool
TypedObject::obj_getSpecial(JSContext *cx, HandleObject obj,
HandleObject receiver, HandleSpecialId sid,
MutableHandleValue vp)
{
RootedId id(cx, SPECIALID_TO_JSID(sid));
return obj_getGeneric(cx, obj, receiver, id, vp);
}
bool
TypedObject::obj_setGeneric(JSContext *cx, HandleObject obj, HandleId id,
MutableHandleValue vp, bool strict)
@ -1969,15 +1943,6 @@ TypedObject::obj_setArrayElement(JSContext *cx,
return ConvertAndCopyTo(cx, elementType, typedObj, offset, vp);
}
bool
TypedObject::obj_setSpecial(JSContext *cx, HandleObject obj,
HandleSpecialId sid, MutableHandleValue vp,
bool strict)
{
RootedId id(cx, SPECIALID_TO_JSID(sid));
return obj_setGeneric(cx, obj, id, vp, strict);
}
bool
TypedObject::obj_getGenericAttributes(JSContext *cx, HandleObject obj,
HandleId id, unsigned *attrsp)
@ -2100,19 +2065,6 @@ TypedObject::obj_deleteElement(JSContext *cx, HandleObject obj, uint32_t index,
return JSObject::deleteElement(cx, proto, index, succeeded);
}
bool
TypedObject::obj_deleteSpecial(JSContext *cx, HandleObject obj,
HandleSpecialId sid, bool *succeeded)
{
RootedObject proto(cx, obj->getProto());
if (!proto) {
*succeeded = false;
return true;
}
return JSObject::deleteSpecial(cx, proto, sid, succeeded);
}
bool
TypedObject::obj_enumerate(JSContext *cx, HandleObject obj, JSIterateOp enum_op,
MutableHandleValue statep, MutableHandleId idp)
@ -2242,24 +2194,19 @@ const Class TransparentTypedObject::class_ = {
TypedObject::obj_lookupGeneric,
TypedObject::obj_lookupProperty,
TypedObject::obj_lookupElement,
TypedObject::obj_lookupSpecial,
TypedObject::obj_defineGeneric,
TypedObject::obj_defineProperty,
TypedObject::obj_defineElement,
TypedObject::obj_defineSpecial,
TypedObject::obj_getGeneric,
TypedObject::obj_getProperty,
TypedObject::obj_getElement,
TypedObject::obj_getSpecial,
TypedObject::obj_setGeneric,
TypedObject::obj_setProperty,
TypedObject::obj_setElement,
TypedObject::obj_setSpecial,
TypedObject::obj_getGenericAttributes,
TypedObject::obj_setGenericAttributes,
TypedObject::obj_deleteProperty,
TypedObject::obj_deleteElement,
TypedObject::obj_deleteSpecial,
nullptr, nullptr, // watch/unwatch
nullptr, /* slice */
TypedObject::obj_enumerate,
@ -2575,24 +2522,19 @@ const Class OpaqueTypedObject::class_ = {
TypedObject::obj_lookupGeneric,
TypedObject::obj_lookupProperty,
TypedObject::obj_lookupElement,
TypedObject::obj_lookupSpecial,
TypedObject::obj_defineGeneric,
TypedObject::obj_defineProperty,
TypedObject::obj_defineElement,
TypedObject::obj_defineSpecial,
TypedObject::obj_getGeneric,
TypedObject::obj_getProperty,
TypedObject::obj_getElement,
TypedObject::obj_getSpecial,
TypedObject::obj_setGeneric,
TypedObject::obj_setProperty,
TypedObject::obj_setElement,
TypedObject::obj_setSpecial,
TypedObject::obj_getGenericAttributes,
TypedObject::obj_setGenericAttributes,
TypedObject::obj_deleteProperty,
TypedObject::obj_deleteElement,
TypedObject::obj_deleteSpecial,
nullptr, nullptr, // watch/unwatch
nullptr, // slice
TypedObject::obj_enumerate,

View File

@ -489,11 +489,6 @@ class TypedObject : public ArrayBufferViewObject
uint32_t index, MutableHandleObject objp,
MutableHandleShape propp);
static bool obj_lookupSpecial(JSContext *cx, HandleObject obj,
HandleSpecialId sid,
MutableHandleObject objp,
MutableHandleShape propp);
static bool obj_defineGeneric(JSContext *cx, HandleObject obj, HandleId id, HandleValue v,
PropertyOp getter, StrictPropertyOp setter, unsigned attrs);
@ -504,9 +499,6 @@ class TypedObject : public ArrayBufferViewObject
static bool obj_defineElement(JSContext *cx, HandleObject obj, uint32_t index, HandleValue v,
PropertyOp getter, StrictPropertyOp setter, unsigned attrs);
static bool obj_defineSpecial(JSContext *cx, HandleObject obj, HandleSpecialId sid, HandleValue v,
PropertyOp getter, StrictPropertyOp setter, unsigned attrs);
static bool obj_getGeneric(JSContext *cx, HandleObject obj, HandleObject receiver,
HandleId id, MutableHandleValue vp);
@ -519,17 +511,12 @@ class TypedObject : public ArrayBufferViewObject
static bool obj_getUnsizedArrayElement(JSContext *cx, HandleObject obj, HandleObject receiver,
uint32_t index, MutableHandleValue vp);
static bool obj_getSpecial(JSContext *cx, HandleObject obj, HandleObject receiver,
HandleSpecialId sid, MutableHandleValue vp);
static bool obj_setGeneric(JSContext *cx, HandleObject obj, HandleId id,
MutableHandleValue vp, bool strict);
static bool obj_setProperty(JSContext *cx, HandleObject obj, HandlePropertyName name,
MutableHandleValue vp, bool strict);
static bool obj_setElement(JSContext *cx, HandleObject obj, uint32_t index,
MutableHandleValue vp, bool strict);
static bool obj_setSpecial(JSContext *cx, HandleObject obj,
HandleSpecialId sid, MutableHandleValue vp, bool strict);
static bool obj_getGenericAttributes(JSContext *cx, HandleObject obj,
HandleId id, unsigned *attrsp);
@ -540,8 +527,6 @@ class TypedObject : public ArrayBufferViewObject
bool *succeeded);
static bool obj_deleteElement(JSContext *cx, HandleObject obj, uint32_t index,
bool *succeeded);
static bool obj_deleteSpecial(JSContext *cx, HandleObject obj, HandleSpecialId sid,
bool *succeeded);
static bool obj_enumerate(JSContext *cx, HandleObject obj, JSIterateOp enum_op,
MutableHandleValue statep, MutableHandleId idp);

View File

@ -3437,10 +3437,6 @@ JS_DeletePropertyById2(JSContext *cx, HandleObject obj, HandleId id, bool *resul
assertSameCompartment(cx, obj, id);
JSAutoResolveFlags rf(cx, 0);
if (JSID_IS_SPECIAL(id)) {
Rooted<SpecialId> sid(cx, JSID_TO_SPECIALID(id));
return JSObject::deleteSpecial(cx, obj, sid, result);
}
return JSObject::deleteByValue(cx, obj, IdToValue(id), result);
}

View File

@ -268,24 +268,19 @@ namespace js {
js::proxy_LookupGeneric, \
js::proxy_LookupProperty, \
js::proxy_LookupElement, \
js::proxy_LookupSpecial, \
js::proxy_DefineGeneric, \
js::proxy_DefineProperty, \
js::proxy_DefineElement, \
js::proxy_DefineSpecial, \
js::proxy_GetGeneric, \
js::proxy_GetProperty, \
js::proxy_GetElement, \
js::proxy_GetSpecial, \
js::proxy_SetGeneric, \
js::proxy_SetProperty, \
js::proxy_SetElement, \
js::proxy_SetSpecial, \
js::proxy_GetGenericAttributes, \
js::proxy_SetGenericAttributes, \
js::proxy_DeleteProperty, \
js::proxy_DeleteElement, \
js::proxy_DeleteSpecial, \
js::proxy_Watch, js::proxy_Unwatch, \
js::proxy_Slice, \
nullptr, /* enumerate */ \
@ -318,9 +313,6 @@ extern JS_FRIEND_API(bool)
proxy_LookupElement(JSContext *cx, JS::HandleObject obj, uint32_t index, JS::MutableHandleObject objp,
JS::MutableHandle<Shape*> propp);
extern JS_FRIEND_API(bool)
proxy_LookupSpecial(JSContext *cx, JS::HandleObject obj, HandleSpecialId sid,
JS::MutableHandleObject objp, JS::MutableHandle<Shape*> propp);
extern JS_FRIEND_API(bool)
proxy_DefineGeneric(JSContext *cx, JS::HandleObject obj, JS::HandleId id, JS::HandleValue value,
JSPropertyOp getter, JSStrictPropertyOp setter, unsigned attrs);
extern JS_FRIEND_API(bool)
@ -331,10 +323,6 @@ extern JS_FRIEND_API(bool)
proxy_DefineElement(JSContext *cx, JS::HandleObject obj, uint32_t index, JS::HandleValue value,
JSPropertyOp getter, JSStrictPropertyOp setter, unsigned attrs);
extern JS_FRIEND_API(bool)
proxy_DefineSpecial(JSContext *cx, JS::HandleObject obj, HandleSpecialId sid,
JS::HandleValue value, JSPropertyOp getter, JSStrictPropertyOp setter,
unsigned attrs);
extern JS_FRIEND_API(bool)
proxy_GetGeneric(JSContext *cx, JS::HandleObject obj, JS::HandleObject receiver, JS::HandleId id,
JS::MutableHandleValue vp);
extern JS_FRIEND_API(bool)
@ -344,9 +332,6 @@ extern JS_FRIEND_API(bool)
proxy_GetElement(JSContext *cx, JS::HandleObject obj, JS::HandleObject receiver, uint32_t index,
JS::MutableHandleValue vp);
extern JS_FRIEND_API(bool)
proxy_GetSpecial(JSContext *cx, JS::HandleObject obj, JS::HandleObject receiver,
HandleSpecialId sid, JS::MutableHandleValue vp);
extern JS_FRIEND_API(bool)
proxy_SetGeneric(JSContext *cx, JS::HandleObject obj, JS::HandleId id,
JS::MutableHandleValue bp, bool strict);
extern JS_FRIEND_API(bool)
@ -356,9 +341,6 @@ extern JS_FRIEND_API(bool)
proxy_SetElement(JSContext *cx, JS::HandleObject obj, uint32_t index, JS::MutableHandleValue vp,
bool strict);
extern JS_FRIEND_API(bool)
proxy_SetSpecial(JSContext *cx, JS::HandleObject obj, HandleSpecialId sid,
JS::MutableHandleValue vp, bool strict);
extern JS_FRIEND_API(bool)
proxy_GetGenericAttributes(JSContext *cx, JS::HandleObject obj, JS::HandleId id, unsigned *attrsp);
extern JS_FRIEND_API(bool)
proxy_SetGenericAttributes(JSContext *cx, JS::HandleObject obj, JS::HandleId id, unsigned *attrsp);
@ -367,8 +349,6 @@ proxy_DeleteProperty(JSContext *cx, JS::HandleObject obj, JS::Handle<PropertyNam
bool *succeeded);
extern JS_FRIEND_API(bool)
proxy_DeleteElement(JSContext *cx, JS::HandleObject obj, uint32_t index, bool *succeeded);
extern JS_FRIEND_API(bool)
proxy_DeleteSpecial(JSContext *cx, JS::HandleObject obj, HandleSpecialId sid, bool *succeeded);
extern JS_FRIEND_API(void)
proxy_Trace(JSTracer *trc, JSObject *obj);

View File

@ -1706,9 +1706,6 @@ JSObject::deleteByValue(JSContext *cx, HandleObject obj, const Value &property,
return deleteElement(cx, obj, index, succeeded);
RootedValue propval(cx, property);
Rooted<SpecialId> sid(cx);
if (ValueIsSpecial(obj, &propval, &sid, cx))
return deleteSpecial(cx, obj, sid, succeeded);
JSAtom *name = ToAtom<CanGC>(cx, propval);
if (!name)
@ -3502,15 +3499,6 @@ JSObject::defineProperty(ExclusiveContext *cx, HandleObject obj,
return defineGeneric(cx, obj, id, value, getter, setter, attrs);
}
/* static */ bool
JSObject::defineSpecial(ExclusiveContext *cx, HandleObject obj,
SpecialId sid, HandleValue value,
JSPropertyOp getter, JSStrictPropertyOp setter, unsigned attrs)
{
RootedId id(cx, SPECIALID_TO_JSID(sid));
return defineGeneric(cx, obj, id, value, getter, setter, attrs);
}
bool
baseops::DefineElement(ExclusiveContext *cx, HandleObject obj, uint32_t index, HandleValue value,
PropertyOp getter, StrictPropertyOp setter, unsigned attrs)
@ -4301,7 +4289,6 @@ js::HasOwnProperty(JSContext *cx, HandleObject obj, HandleId id, bool *resultp)
return true;
}
template <AllowGC allowGC>
static MOZ_ALWAYS_INLINE bool
NativeGetInline(JSContext *cx,
@ -5224,13 +5211,6 @@ baseops::DeleteElement(JSContext *cx, HandleObject obj, uint32_t index, bool *su
return baseops::DeleteGeneric(cx, obj, id, succeeded);
}
bool
baseops::DeleteSpecial(JSContext *cx, HandleObject obj, HandleSpecialId sid, bool *succeeded)
{
Rooted<jsid> id(cx, SPECIALID_TO_JSID(sid));
return baseops::DeleteGeneric(cx, obj, id, succeeded);
}
bool
js::WatchGuts(JSContext *cx, JS::HandleObject origObj, JS::HandleId id, JS::HandleObject callable)
{

View File

@ -150,9 +150,6 @@ DeleteProperty(JSContext *cx, HandleObject obj, HandlePropertyName name, bool *s
extern bool
DeleteElement(JSContext *cx, HandleObject obj, uint32_t index, bool *succeeded);
extern bool
DeleteSpecial(JSContext *cx, HandleObject obj, HandleSpecialId sid, bool *succeeded);
extern bool
DeleteGeneric(JSContext *cx, HandleObject obj, HandleId id, bool *succeeded);
@ -975,13 +972,6 @@ class JSObject : public js::ObjectImpl
return (op ? op : js::baseops::LookupElement)(cx, obj, index, objp, propp);
}
static bool lookupSpecial(JSContext *cx, js::HandleObject obj, js::SpecialId sid,
js::MutableHandleObject objp, js::MutableHandleShape propp)
{
JS::RootedId id(cx, SPECIALID_TO_JSID(sid));
return lookupGeneric(cx, obj, id, objp, propp);
}
static bool defineGeneric(js::ExclusiveContext *cx, js::HandleObject obj,
js::HandleId id, js::HandleValue value,
JSPropertyOp getter = JS_PropertyStub,
@ -1000,12 +990,6 @@ class JSObject : public js::ObjectImpl
JSStrictPropertyOp setter = JS_StrictPropertyStub,
unsigned attrs = JSPROP_ENUMERATE);
static bool defineSpecial(js::ExclusiveContext *cx, js::HandleObject obj,
js::SpecialId sid, js::HandleValue value,
JSPropertyOp getter = JS_PropertyStub,
JSStrictPropertyOp setter = JS_StrictPropertyStub,
unsigned attrs = JSPROP_ENUMERATE);
static bool getGeneric(JSContext *cx, js::HandleObject obj, js::HandleObject receiver,
js::HandleId id, js::MutableHandleValue vp)
{
@ -1048,14 +1032,6 @@ class JSObject : public js::ObjectImpl
static inline bool getElementNoGC(JSContext *cx, JSObject *obj, JSObject *receiver,
uint32_t index, js::Value *vp);
static bool getSpecial(JSContext *cx, js::HandleObject obj,
js::HandleObject receiver, js::SpecialId sid,
js::MutableHandleValue vp)
{
JS::RootedId id(cx, SPECIALID_TO_JSID(sid));
return getGeneric(cx, obj, receiver, id, vp);
}
static bool setGeneric(JSContext *cx, js::HandleObject obj, js::HandleObject receiver,
js::HandleId id, js::MutableHandleValue vp, bool strict)
{
@ -1081,14 +1057,6 @@ class JSObject : public js::ObjectImpl
return js::baseops::SetElementHelper(cx, obj, receiver, index, 0, vp, strict);
}
static bool setSpecial(JSContext *cx, js::HandleObject obj, js::HandleObject receiver,
js::SpecialId sid, js::MutableHandleValue vp, bool strict)
{
JS::RootedId id(cx, SPECIALID_TO_JSID(sid));
return setGeneric(cx, obj, receiver, id, vp, strict);
}
static bool nonNativeSetProperty(JSContext *cx, js::HandleObject obj,
js::HandleId id, js::MutableHandleValue vp, bool strict);
static bool nonNativeSetElement(JSContext *cx, js::HandleObject obj,
@ -1109,8 +1077,6 @@ class JSObject : public js::ObjectImpl
bool *succeeded);
static inline bool deleteElement(JSContext *cx, js::HandleObject obj,
uint32_t index, bool *succeeded);
static inline bool deleteSpecial(JSContext *cx, js::HandleObject obj,
js::HandleSpecialId sid, bool *succeeded);
static bool deleteByValue(JSContext *cx, js::HandleObject obj,
const js::Value &property, bool *succeeded);

View File

@ -61,16 +61,6 @@ JSObject::deleteElement(JSContext *cx, js::HandleObject obj, uint32_t index, boo
return (op ? op : js::baseops::DeleteElement)(cx, obj, index, succeeded);
}
/* static */ inline bool
JSObject::deleteSpecial(JSContext *cx, js::HandleObject obj, js::HandleSpecialId sid,
bool *succeeded)
{
JS::RootedId id(cx, SPECIALID_TO_JSID(sid));
js::types::MarkTypePropertyNonData(cx, obj, id);
js::DeleteSpecialOp op = obj->getOps()->deleteSpecial;
return (op ? op : js::baseops::DeleteSpecial)(cx, obj, sid, succeeded);
}
/* static */ inline bool
JSObject::watch(JSContext *cx, JS::HandleObject obj, JS::HandleId id,
JS::HandleObject callable)
@ -1057,19 +1047,6 @@ IsObjectWithClass(const Value &v, ESClassValue classValue, JSContext *cx)
return ObjectClassIs(obj, classValue, cx);
}
static MOZ_ALWAYS_INLINE bool
ValueMightBeSpecial(const Value &propval)
{
return propval.isObject();
}
static MOZ_ALWAYS_INLINE bool
ValueIsSpecial(JSObject *obj, MutableHandleValue propval, MutableHandle<SpecialId> sidp,
JSContext *cx)
{
return false;
}
static MOZ_ALWAYS_INLINE bool
NewObjectMetadata(ExclusiveContext *cxArg, JSObject **pmetadata)
{

View File

@ -2824,14 +2824,6 @@ js::proxy_LookupElement(JSContext *cx, HandleObject obj, uint32_t index,
return proxy_LookupGeneric(cx, obj, id, objp, propp);
}
bool
js::proxy_LookupSpecial(JSContext *cx, HandleObject obj, HandleSpecialId sid,
MutableHandleObject objp, MutableHandleShape propp)
{
RootedId id(cx, SPECIALID_TO_JSID(sid));
return proxy_LookupGeneric(cx, obj, id, objp, propp);
}
bool
js::proxy_DefineGeneric(JSContext *cx, HandleObject obj, HandleId id, HandleValue value,
PropertyOp getter, StrictPropertyOp setter, unsigned attrs)
@ -2863,14 +2855,6 @@ js::proxy_DefineElement(JSContext *cx, HandleObject obj, uint32_t index, HandleV
return proxy_DefineGeneric(cx, obj, id, value, getter, setter, attrs);
}
bool
js::proxy_DefineSpecial(JSContext *cx, HandleObject obj, HandleSpecialId sid, HandleValue value,
PropertyOp getter, StrictPropertyOp setter, unsigned attrs)
{
Rooted<jsid> id(cx, SPECIALID_TO_JSID(sid));
return proxy_DefineGeneric(cx, obj, id, value, getter, setter, attrs);
}
bool
js::proxy_GetGeneric(JSContext *cx, HandleObject obj, HandleObject receiver, HandleId id,
MutableHandleValue vp)
@ -2896,14 +2880,6 @@ js::proxy_GetElement(JSContext *cx, HandleObject obj, HandleObject receiver, uin
return proxy_GetGeneric(cx, obj, receiver, id, vp);
}
bool
js::proxy_GetSpecial(JSContext *cx, HandleObject obj, HandleObject receiver, HandleSpecialId sid,
MutableHandleValue vp)
{
Rooted<jsid> id(cx, SPECIALID_TO_JSID(sid));
return proxy_GetGeneric(cx, obj, receiver, id, vp);
}
bool
js::proxy_SetGeneric(JSContext *cx, HandleObject obj, HandleId id,
MutableHandleValue vp, bool strict)
@ -2929,14 +2905,6 @@ js::proxy_SetElement(JSContext *cx, HandleObject obj, uint32_t index,
return proxy_SetGeneric(cx, obj, id, vp, strict);
}
bool
js::proxy_SetSpecial(JSContext *cx, HandleObject obj, HandleSpecialId sid,
MutableHandleValue vp, bool strict)
{
Rooted<jsid> id(cx, SPECIALID_TO_JSID(sid));
return proxy_SetGeneric(cx, obj, id, vp, strict);
}
bool
js::proxy_GetGenericAttributes(JSContext *cx, HandleObject obj, HandleId id, unsigned *attrsp)
{
@ -2984,13 +2952,6 @@ js::proxy_DeleteElement(JSContext *cx, HandleObject obj, uint32_t index, bool *s
return proxy_DeleteGeneric(cx, obj, id, succeeded);
}
bool
js::proxy_DeleteSpecial(JSContext *cx, HandleObject obj, HandleSpecialId sid, bool *succeeded)
{
RootedId id(cx, SPECIALID_TO_JSID(sid));
return proxy_DeleteGeneric(cx, obj, id, succeeded);
}
void
js::proxy_Trace(JSTracer *trc, JSObject *obj)
{

View File

@ -132,24 +132,19 @@ const Class ArrayBufferObject::class_ = {
ArrayBufferObject::obj_lookupGeneric,
ArrayBufferObject::obj_lookupProperty,
ArrayBufferObject::obj_lookupElement,
ArrayBufferObject::obj_lookupSpecial,
ArrayBufferObject::obj_defineGeneric,
ArrayBufferObject::obj_defineProperty,
ArrayBufferObject::obj_defineElement,
ArrayBufferObject::obj_defineSpecial,
ArrayBufferObject::obj_getGeneric,
ArrayBufferObject::obj_getProperty,
ArrayBufferObject::obj_getElement,
ArrayBufferObject::obj_getSpecial,
ArrayBufferObject::obj_setGeneric,
ArrayBufferObject::obj_setProperty,
ArrayBufferObject::obj_setElement,
ArrayBufferObject::obj_setSpecial,
ArrayBufferObject::obj_getGenericAttributes,
ArrayBufferObject::obj_setGenericAttributes,
ArrayBufferObject::obj_deleteProperty,
ArrayBufferObject::obj_deleteElement,
ArrayBufferObject::obj_deleteSpecial,
nullptr, nullptr, /* watch/unwatch */
nullptr, /* slice */
ArrayBufferObject::obj_enumerate,
@ -1030,14 +1025,6 @@ ArrayBufferObject::obj_lookupElement(JSContext *cx, HandleObject obj, uint32_t i
return true;
}
bool
ArrayBufferObject::obj_lookupSpecial(JSContext *cx, HandleObject obj, HandleSpecialId sid,
MutableHandleObject objp, MutableHandleShape propp)
{
Rooted<jsid> id(cx, SPECIALID_TO_JSID(sid));
return obj_lookupGeneric(cx, obj, id, objp, propp);
}
bool
ArrayBufferObject::obj_defineGeneric(JSContext *cx, HandleObject obj, HandleId id, HandleValue v,
PropertyOp getter, StrictPropertyOp setter, unsigned attrs)
@ -1071,14 +1058,6 @@ ArrayBufferObject::obj_defineElement(JSContext *cx, HandleObject obj, uint32_t i
return baseops::DefineElement(cx, delegate, index, v, getter, setter, attrs);
}
bool
ArrayBufferObject::obj_defineSpecial(JSContext *cx, HandleObject obj, HandleSpecialId sid, HandleValue v,
PropertyOp getter, StrictPropertyOp setter, unsigned attrs)
{
Rooted<jsid> id(cx, SPECIALID_TO_JSID(sid));
return obj_defineGeneric(cx, obj, id, v, getter, setter, attrs);
}
bool
ArrayBufferObject::obj_getGeneric(JSContext *cx, HandleObject obj, HandleObject receiver,
HandleId id, MutableHandleValue vp)
@ -1110,15 +1089,6 @@ ArrayBufferObject::obj_getElement(JSContext *cx, HandleObject obj,
return baseops::GetElement(cx, delegate, receiver, index, vp);
}
bool
ArrayBufferObject::obj_getSpecial(JSContext *cx, HandleObject obj,
HandleObject receiver, HandleSpecialId sid,
MutableHandleValue vp)
{
Rooted<jsid> id(cx, SPECIALID_TO_JSID(sid));
return obj_getGeneric(cx, obj, receiver, id, vp);
}
bool
ArrayBufferObject::obj_setGeneric(JSContext *cx, HandleObject obj, HandleId id,
MutableHandleValue vp, bool strict)
@ -1149,14 +1119,6 @@ ArrayBufferObject::obj_setElement(JSContext *cx, HandleObject obj,
return baseops::SetElementHelper(cx, delegate, obj, index, 0, vp, strict);
}
bool
ArrayBufferObject::obj_setSpecial(JSContext *cx, HandleObject obj,
HandleSpecialId sid, MutableHandleValue vp, bool strict)
{
Rooted<jsid> id(cx, SPECIALID_TO_JSID(sid));
return obj_setGeneric(cx, obj, id, vp, strict);
}
bool
ArrayBufferObject::obj_getGenericAttributes(JSContext *cx, HandleObject obj,
HandleId id, unsigned *attrsp)
@ -1197,16 +1159,6 @@ ArrayBufferObject::obj_deleteElement(JSContext *cx, HandleObject obj, uint32_t i
return baseops::DeleteElement(cx, delegate, index, succeeded);
}
bool
ArrayBufferObject::obj_deleteSpecial(JSContext *cx, HandleObject obj, HandleSpecialId sid,
bool *succeeded)
{
RootedObject delegate(cx, ArrayBufferDelegate(cx, obj));
if (!delegate)
return false;
return baseops::DeleteSpecial(cx, delegate, sid, succeeded);
}
bool
ArrayBufferObject::obj_enumerate(JSContext *cx, HandleObject obj, JSIterateOp enum_op,
MutableHandleValue statep, MutableHandleId idp)

View File

@ -90,8 +90,6 @@ class ArrayBufferObject : public JSObject
MutableHandleObject objp, MutableHandleShape propp);
static bool obj_lookupElement(JSContext *cx, HandleObject obj, uint32_t index,
MutableHandleObject objp, MutableHandleShape propp);
static bool obj_lookupSpecial(JSContext *cx, HandleObject obj, HandleSpecialId sid,
MutableHandleObject objp, MutableHandleShape propp);
static bool obj_defineGeneric(JSContext *cx, HandleObject obj, HandleId id, HandleValue v,
PropertyOp getter, StrictPropertyOp setter, unsigned attrs);
@ -100,30 +98,20 @@ class ArrayBufferObject : public JSObject
PropertyOp getter, StrictPropertyOp setter, unsigned attrs);
static bool obj_defineElement(JSContext *cx, HandleObject obj, uint32_t index, HandleValue v,
PropertyOp getter, StrictPropertyOp setter, unsigned attrs);
static bool obj_defineSpecial(JSContext *cx, HandleObject obj,
HandleSpecialId sid, HandleValue v,
PropertyOp getter, StrictPropertyOp setter, unsigned attrs);
static bool obj_getGeneric(JSContext *cx, HandleObject obj, HandleObject receiver,
HandleId id, MutableHandleValue vp);
static bool obj_getProperty(JSContext *cx, HandleObject obj, HandleObject receiver,
HandlePropertyName name, MutableHandleValue vp);
static bool obj_getElement(JSContext *cx, HandleObject obj, HandleObject receiver,
uint32_t index, MutableHandleValue vp);
static bool obj_getSpecial(JSContext *cx, HandleObject obj, HandleObject receiver,
HandleSpecialId sid, MutableHandleValue vp);
static bool obj_setGeneric(JSContext *cx, HandleObject obj, HandleId id,
MutableHandleValue vp, bool strict);
static bool obj_setProperty(JSContext *cx, HandleObject obj, HandlePropertyName name,
MutableHandleValue vp, bool strict);
static bool obj_setElement(JSContext *cx, HandleObject obj, uint32_t index,
MutableHandleValue vp, bool strict);
static bool obj_setSpecial(JSContext *cx, HandleObject obj,
HandleSpecialId sid, MutableHandleValue vp, bool strict);
static bool obj_getGenericAttributes(JSContext *cx, HandleObject obj,
HandleId id, unsigned *attrsp);
@ -134,8 +122,6 @@ class ArrayBufferObject : public JSObject
bool *succeeded);
static bool obj_deleteElement(JSContext *cx, HandleObject obj, uint32_t index,
bool *succeeded);
static bool obj_deleteSpecial(JSContext *cx, HandleObject obj, HandleSpecialId sid,
bool *succeeded);
static bool obj_enumerate(JSContext *cx, HandleObject obj, JSIterateOp enum_op,
MutableHandleValue statep, MutableHandleId idp);

View File

@ -345,19 +345,6 @@ GetObjectElementOperation(JSContext *cx, JSOp op, JSObject *objArg, bool wasObje
break;
}
if (ValueMightBeSpecial(rref)) {
RootedObject obj(cx, objArg);
Rooted<SpecialId> special(cx);
res.set(rref);
if (ValueIsSpecial(obj, res, &special, cx)) {
if (!JSObject::getSpecial(cx, obj, obj, special, res))
return false;
objArg = obj;
break;
}
objArg = obj;
}
JSAtom *name = ToAtom<NoGC>(cx, rref);
if (name) {
if (name->isIndex(&index)) {

View File

@ -457,14 +457,6 @@ with_LookupElement(JSContext *cx, HandleObject obj, uint32_t index,
return with_LookupGeneric(cx, obj, id, objp, propp);
}
static bool
with_LookupSpecial(JSContext *cx, HandleObject obj, HandleSpecialId sid,
MutableHandleObject objp, MutableHandleShape propp)
{
RootedId id(cx, SPECIALID_TO_JSID(sid));
return with_LookupGeneric(cx, obj, id, objp, propp);
}
static bool
with_GetGeneric(JSContext *cx, HandleObject obj, HandleObject receiver, HandleId id,
MutableHandleValue vp)
@ -491,14 +483,6 @@ with_GetElement(JSContext *cx, HandleObject obj, HandleObject receiver, uint32_t
return with_GetGeneric(cx, obj, receiver, id, vp);
}
static bool
with_GetSpecial(JSContext *cx, HandleObject obj, HandleObject receiver, HandleSpecialId sid,
MutableHandleValue vp)
{
RootedId id(cx, SPECIALID_TO_JSID(sid));
return with_GetGeneric(cx, obj, receiver, id, vp);
}
static bool
with_SetGeneric(JSContext *cx, HandleObject obj, HandleId id,
MutableHandleValue vp, bool strict)
@ -523,14 +507,6 @@ with_SetElement(JSContext *cx, HandleObject obj, uint32_t index,
return JSObject::setElement(cx, actual, actual, index, vp, strict);
}
static bool
with_SetSpecial(JSContext *cx, HandleObject obj, HandleSpecialId sid,
MutableHandleValue vp, bool strict)
{
RootedObject actual(cx, &obj->as<DynamicWithObject>().object());
return JSObject::setSpecial(cx, actual, actual, sid, vp, strict);
}
static bool
with_GetGenericAttributes(JSContext *cx, HandleObject obj, HandleId id, unsigned *attrsp)
{
@ -561,14 +537,6 @@ with_DeleteElement(JSContext *cx, HandleObject obj, uint32_t index,
return JSObject::deleteElement(cx, actual, index, succeeded);
}
static bool
with_DeleteSpecial(JSContext *cx, HandleObject obj, HandleSpecialId sid,
bool *succeeded)
{
RootedObject actual(cx, &obj->as<DynamicWithObject>().object());
return JSObject::deleteSpecial(cx, actual, sid, succeeded);
}
static JSObject *
with_ThisObject(JSContext *cx, HandleObject obj)
{
@ -611,24 +579,19 @@ const Class DynamicWithObject::class_ = {
with_LookupGeneric,
with_LookupProperty,
with_LookupElement,
with_LookupSpecial,
nullptr, /* defineGeneric */
nullptr, /* defineProperty */
nullptr, /* defineElement */
nullptr, /* defineSpecial */
with_GetGeneric,
with_GetProperty,
with_GetElement,
with_GetSpecial,
with_SetGeneric,
with_SetProperty,
with_SetElement,
with_SetSpecial,
with_GetGenericAttributes,
with_SetGenericAttributes,
with_DeleteProperty,
with_DeleteElement,
with_DeleteSpecial,
nullptr, nullptr, /* watch/unwatch */
nullptr, /* slice */
nullptr, /* enumerate (native enumeration of target doesn't work) */

View File

@ -320,24 +320,19 @@ const Class SharedArrayBufferObject::class_ = {
ArrayBufferObject::obj_lookupGeneric,
ArrayBufferObject::obj_lookupProperty,
ArrayBufferObject::obj_lookupElement,
ArrayBufferObject::obj_lookupSpecial,
ArrayBufferObject::obj_defineGeneric,
ArrayBufferObject::obj_defineProperty,
ArrayBufferObject::obj_defineElement,
ArrayBufferObject::obj_defineSpecial,
ArrayBufferObject::obj_getGeneric,
ArrayBufferObject::obj_getProperty,
ArrayBufferObject::obj_getElement,
ArrayBufferObject::obj_getSpecial,
ArrayBufferObject::obj_setGeneric,
ArrayBufferObject::obj_setProperty,
ArrayBufferObject::obj_setElement,
ArrayBufferObject::obj_setSpecial,
ArrayBufferObject::obj_getGenericAttributes,
ArrayBufferObject::obj_setGenericAttributes,
ArrayBufferObject::obj_deleteProperty,
ArrayBufferObject::obj_deleteElement,
ArrayBufferObject::obj_deleteSpecial,
nullptr, nullptr, /* watch/unwatch */
nullptr, /* slice */
ArrayBufferObject::obj_enumerate,

View File

@ -692,24 +692,19 @@ const XPCWrappedNativeJSClass XPC_WN_NoHelper_JSClass = {
nullptr, // lookupGeneric
nullptr, // lookupProperty
nullptr, // lookupElement
nullptr, // lookupSpecial
nullptr, // defineGeneric
nullptr, // defineProperty
nullptr, // defineElement
nullptr, // defineSpecial
nullptr, // getGeneric
nullptr, // getProperty
nullptr, // getElement
nullptr, // getSpecial
nullptr, // setGeneric
nullptr, // setProperty
nullptr, // setElement
nullptr, // setSpecial
nullptr, // getGenericAttributes
nullptr, // setGenericAttributes
nullptr, // deleteProperty
nullptr, // deleteElement
nullptr, // deleteSpecial
nullptr, nullptr, // watch/unwatch
nullptr, // slice
XPC_WN_JSOp_Enumerate,

View File

@ -907,24 +907,19 @@ XPC_WN_JSOp_ThisObject(JSContext *cx, JS::HandleObject obj);
nullptr, /* lookupGeneric */ \
nullptr, /* lookupProperty */ \
nullptr, /* lookupElement */ \
nullptr, /* lookupSpecial */ \
nullptr, /* defineGeneric */ \
nullptr, /* defineProperty */ \
nullptr, /* defineElement */ \
nullptr, /* defineSpecial */ \
nullptr, /* getGeneric */ \
nullptr, /* getProperty */ \
nullptr, /* getElement */ \
nullptr, /* getSpecial */ \
nullptr, /* setGeneric */ \
nullptr, /* setProperty */ \
nullptr, /* setElement */ \
nullptr, /* setSpecial */ \
nullptr, /* getGenericAttributes */ \
nullptr, /* setGenericAttributes */ \
nullptr, /* deleteProperty */ \
nullptr, /* deleteElement */ \
nullptr, /* deleteSpecial */ \
nullptr, nullptr, /* watch/unwatch */ \
nullptr, /* slice */ \
XPC_WN_JSOp_Enumerate, \
@ -936,24 +931,19 @@ XPC_WN_JSOp_ThisObject(JSContext *cx, JS::HandleObject obj);
nullptr, /* lookupGeneric */ \
nullptr, /* lookupProperty */ \
nullptr, /* lookupElement */ \
nullptr, /* lookupSpecial */ \
nullptr, /* defineGeneric */ \
nullptr, /* defineProperty */ \
nullptr, /* defineElement */ \
nullptr, /* defineSpecial */ \
nullptr, /* getGeneric */ \
nullptr, /* getProperty */ \
nullptr, /* getElement */ \
nullptr, /* getSpecial */ \
nullptr, /* setGeneric */ \
nullptr, /* setProperty */ \
nullptr, /* setElement */ \
nullptr, /* setSpecial */ \
nullptr, /* getGenericAttributes */ \
nullptr, /* setGenericAttributes */ \
nullptr, /* deleteProperty */ \
nullptr, /* deleteElement */ \
nullptr, /* deleteSpecial */ \
nullptr, nullptr, /* watch/unwatch */ \
nullptr, /* slice */ \
XPC_WN_JSOp_Enumerate, \