Bug 1127121 - Remove property key type splitting in ObjectOps. r=bhackett.

--HG--
extra : rebase_source : dab65791e3efc9fc625365b6aa5dc26d5cad19fb
This commit is contained in:
Jason Orendorff 2015-01-28 17:12:44 -06:00
Родитель 209afa562a
Коммит 8f9fef2147
18 изменённых файлов: 157 добавлений и 677 удалений

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

@ -392,21 +392,13 @@ class CGDOMJSClass(CGThing):
${objectMoved} /* objectMovedOp */
},
{
nullptr, /* lookupGeneric */
nullptr, /* lookupProperty */
nullptr, /* lookupElement */
nullptr, /* defineGeneric */
nullptr, /* defineProperty */
nullptr, /* defineElement */
nullptr, /* getGeneric */
nullptr, /* getProperty */
nullptr, /* getElement */
nullptr, /* setGeneric */
nullptr, /* setProperty */
nullptr, /* setElement */
nullptr, /* getOwnPropertyDescriptor */
nullptr, /* setGenericAttributes */
nullptr, /* deleteGeneric */
nullptr, /* setPropertyAttributes */
nullptr, /* deleteProperty */
nullptr, /* watch */
nullptr, /* unwatch */
nullptr, /* getElements */

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

@ -222,21 +222,13 @@ const static js::Class sNPObjectJSWrapperClass =
NPObjWrapper_ObjectMoved
},
{
nullptr, // lookupGeneric
nullptr, // lookupProperty
nullptr, // lookupElement
nullptr, // defineGeneric
nullptr, // defineProperty
nullptr, // defineElement
nullptr, // getGeneric
nullptr, // getProperty
nullptr, // getElement
nullptr, // setGeneric
nullptr, // setProperty
nullptr, // setElement
nullptr, // getOwnPropertyDescriptor
nullptr, // setGenericAttributes
nullptr, // deleteGeneric
nullptr, // setPropertyAttributes
nullptr, // deleteProperty
nullptr, nullptr, // watch/unwatch
nullptr, // getElements
NPObjWrapper_Enumerate,

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

@ -162,49 +162,24 @@ typedef void
namespace js {
typedef bool
(* LookupGenericOp)(JSContext *cx, JS::HandleObject obj, JS::HandleId id,
JS::MutableHandleObject objp, JS::MutableHandle<Shape*> propp);
(* LookupPropertyOp)(JSContext *cx, JS::HandleObject obj, JS::HandleId id,
JS::MutableHandleObject objp, JS::MutableHandle<Shape*> propp);
typedef bool
(* LookupPropOp)(JSContext *cx, JS::HandleObject obj, JS::Handle<PropertyName*> name,
JS::MutableHandleObject objp, JS::MutableHandle<Shape*> propp);
(* DefinePropertyOp)(JSContext *cx, JS::HandleObject obj, JS::HandleId id, JS::HandleValue value,
JSPropertyOp getter, JSStrictPropertyOp setter, unsigned attrs);
typedef bool
(* LookupElementOp)(JSContext *cx, JS::HandleObject obj, uint32_t index,
JS::MutableHandleObject objp, JS::MutableHandle<Shape*> propp);
(* GetPropertyOp)(JSContext *cx, JS::HandleObject obj, JS::HandleObject receiver, JS::HandleId id,
JS::MutableHandleValue vp);
typedef bool
(* DefineGenericOp)(JSContext *cx, JS::HandleObject obj, JS::HandleId id, JS::HandleValue value,
JSPropertyOp getter, JSStrictPropertyOp setter, unsigned attrs);
typedef bool
(* DefinePropOp)(JSContext *cx, JS::HandleObject obj, JS::Handle<PropertyName*> name,
JS::HandleValue value, JSPropertyOp getter, JSStrictPropertyOp setter,
unsigned attrs);
typedef bool
(* DefineElementOp)(JSContext *cx, JS::HandleObject obj, uint32_t index, 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
(* PropertyIdOp)(JSContext *cx, JS::HandleObject obj, JS::HandleObject receiver,
JS::Handle<PropertyName*> name, JS::MutableHandleValue vp);
typedef bool
(* ElementIdOp)(JSContext *cx, JS::HandleObject obj, JS::HandleObject receiver, uint32_t index,
JS::MutableHandleValue vp);
typedef bool
(* StrictGenericIdOp)(JSContext *cx, JS::HandleObject obj, JS::HandleId id,
JS::MutableHandleValue vp, bool strict);
typedef bool
(* StrictPropertyIdOp)(JSContext *cx, JS::HandleObject obj, JS::Handle<PropertyName*> name,
JS::MutableHandleValue vp, bool strict);
typedef bool
(* StrictElementIdOp)(JSContext *cx, JS::HandleObject obj, uint32_t index,
JS::MutableHandleValue vp, bool strict);
(* SetPropertyOp)(JSContext *cx, JS::HandleObject obj, JS::HandleId id,
JS::MutableHandleValue vp, bool strict);
typedef bool
(* GetOwnPropertyOp)(JSContext *cx, JS::HandleObject obj, JS::HandleId id,
JS::MutableHandle<JSPropertyDescriptor> desc);
typedef bool
(* GenericAttributesOp)(JSContext *cx, JS::HandleObject obj, JS::HandleId id, unsigned *attrsp);
(* SetAttributesOp)(JSContext *cx, JS::HandleObject obj, JS::HandleId id, unsigned *attrsp);
typedef bool
(* DeleteGenericOp)(JSContext *cx, JS::HandleObject obj, JS::HandleId id, bool *succeeded);
(* DeletePropertyOp)(JSContext *cx, JS::HandleObject obj, JS::HandleId id, bool *succeeded);
typedef bool
(* WatchOp)(JSContext *cx, JS::HandleObject obj, JS::HandleId id, JS::HandleObject callable);
@ -366,21 +341,13 @@ struct ClassExtension
struct ObjectOps
{
LookupGenericOp lookupGeneric;
LookupPropOp lookupProperty;
LookupElementOp lookupElement;
DefineGenericOp defineGeneric;
DefinePropOp defineProperty;
DefineElementOp defineElement;
GenericIdOp getGeneric;
PropertyIdOp getProperty;
ElementIdOp getElement;
StrictGenericIdOp setGeneric;
StrictPropertyIdOp setProperty;
StrictElementIdOp setElement;
LookupPropertyOp lookupProperty;
DefinePropertyOp defineProperty;
GetPropertyOp getProperty;
SetPropertyOp setProperty;
GetOwnPropertyOp getOwnPropertyDescriptor;
GenericAttributesOp setGenericAttributes;
DeleteGenericOp deleteGeneric;
SetAttributesOp setAttributes;
DeletePropertyOp deleteProperty;
WatchOp watch;
UnwatchOp unwatch;
GetElementsOp getElements;
@ -390,7 +357,6 @@ 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}
} // namespace js
@ -402,7 +368,7 @@ typedef void (*JSClassInternal)();
struct JSClass {
JS_CLASS_MEMBERS(JSFinalizeOp);
void *reserved[32];
void *reserved[24];
};
#define JSCLASS_HAS_PRIVATE (1<<0) // objects have private slot

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

@ -1681,8 +1681,8 @@ OutlineTypedObject::obj_trace(JSTracer *trc, JSObject *object)
}
bool
TypedObject::obj_lookupGeneric(JSContext *cx, HandleObject obj, HandleId id,
MutableHandleObject objp, MutableHandleShape propp)
TypedObject::obj_lookupProperty(JSContext *cx, HandleObject obj, HandleId id,
MutableHandleObject objp, MutableHandleShape propp)
{
MOZ_ASSERT(obj->is<TypedObject>());
@ -1730,20 +1730,9 @@ TypedObject::obj_lookupGeneric(JSContext *cx, HandleObject obj, HandleId id,
return LookupProperty(cx, proto, id, objp, propp);
}
bool
TypedObject::obj_lookupProperty(JSContext *cx,
HandleObject obj,
HandlePropertyName name,
MutableHandleObject objp,
MutableHandleShape propp)
{
RootedId id(cx, NameToId(name));
return obj_lookupGeneric(cx, obj, id, objp, propp);
}
bool
TypedObject::obj_lookupElement(JSContext *cx, HandleObject obj, uint32_t index,
MutableHandleObject objp, MutableHandleShape propp)
MutableHandleObject objp, MutableHandleShape propp)
{
MOZ_ASSERT(obj->is<TypedObject>());
MarkNonNativePropertyFound<CanGC>(propp);
@ -1772,35 +1761,15 @@ ReportPropertyError(JSContext *cx,
}
bool
TypedObject::obj_defineGeneric(JSContext *cx, HandleObject obj, HandleId id, HandleValue v,
PropertyOp getter, StrictPropertyOp setter, unsigned attrs)
TypedObject::obj_defineProperty(JSContext *cx, HandleObject obj, HandleId id, HandleValue v,
PropertyOp getter, StrictPropertyOp setter, unsigned attrs)
{
return ReportPropertyError(cx, JSMSG_UNDEFINED_PROP, id);
}
bool
TypedObject::obj_defineProperty(JSContext *cx, HandleObject obj,
HandlePropertyName name, HandleValue v,
PropertyOp getter, StrictPropertyOp setter, unsigned attrs)
{
Rooted<jsid> id(cx, NameToId(name));
return obj_defineGeneric(cx, obj, id, v, getter, setter, attrs);
}
bool
TypedObject::obj_defineElement(JSContext *cx, HandleObject obj, uint32_t index, HandleValue v,
PropertyOp getter, StrictPropertyOp setter, unsigned attrs)
{
AutoRooterGetterSetter gsRoot(cx, attrs, &getter, &setter);
Rooted<jsid> id(cx);
if (!IndexToId(cx, index, &id))
return false;
return obj_defineGeneric(cx, obj, id, v, getter, setter, attrs);
}
bool
TypedObject::obj_getGeneric(JSContext *cx, HandleObject obj, HandleObject receiver,
HandleId id, MutableHandleValue vp)
TypedObject::obj_getProperty(JSContext *cx, HandleObject obj, HandleObject receiver,
HandleId id, MutableHandleValue vp)
{
MOZ_ASSERT(obj->is<TypedObject>());
Rooted<TypedObject *> typedObj(cx, &obj->as<TypedObject>());
@ -1856,17 +1825,9 @@ TypedObject::obj_getGeneric(JSContext *cx, HandleObject obj, HandleObject receiv
return GetProperty(cx, proto, receiver, id, vp);
}
bool
TypedObject::obj_getProperty(JSContext *cx, HandleObject obj, HandleObject receiver,
HandlePropertyName name, MutableHandleValue vp)
{
RootedId id(cx, NameToId(name));
return obj_getGeneric(cx, obj, receiver, id, vp);
}
bool
TypedObject::obj_getElement(JSContext *cx, HandleObject obj, HandleObject receiver,
uint32_t index, MutableHandleValue vp)
uint32_t index, MutableHandleValue vp)
{
MOZ_ASSERT(obj->is<TypedObject>());
Rooted<TypedObject *> typedObj(cx, &obj->as<TypedObject>());
@ -1894,10 +1855,10 @@ TypedObject::obj_getElement(JSContext *cx, HandleObject obj, HandleObject receiv
/*static*/ bool
TypedObject::obj_getArrayElement(JSContext *cx,
Handle<TypedObject*> typedObj,
Handle<TypeDescr*> typeDescr,
uint32_t index,
MutableHandleValue vp)
Handle<TypedObject*> typedObj,
Handle<TypeDescr*> typeDescr,
uint32_t index,
MutableHandleValue vp)
{
if (index >= (size_t) typedObj->length()) {
vp.setUndefined();
@ -1910,8 +1871,8 @@ TypedObject::obj_getArrayElement(JSContext *cx,
}
bool
TypedObject::obj_setGeneric(JSContext *cx, HandleObject obj, HandleId id,
MutableHandleValue vp, bool strict)
TypedObject::obj_setProperty(JSContext *cx, HandleObject obj, HandleId id,
MutableHandleValue vp, bool strict)
{
MOZ_ASSERT(obj->is<TypedObject>());
Rooted<TypedObject *> typedObj(cx, &obj->as<TypedObject>());
@ -1953,18 +1914,9 @@ TypedObject::obj_setGeneric(JSContext *cx, HandleObject obj, HandleId id,
return ReportTypedObjTypeError(cx, JSMSG_OBJECT_NOT_EXTENSIBLE, typedObj);
}
bool
TypedObject::obj_setProperty(JSContext *cx, HandleObject obj,
HandlePropertyName name, MutableHandleValue vp,
bool strict)
{
RootedId id(cx, NameToId(name));
return obj_setGeneric(cx, obj, id, vp, strict);
}
bool
TypedObject::obj_setElement(JSContext *cx, HandleObject obj, uint32_t index,
MutableHandleValue vp, bool strict)
MutableHandleValue vp, bool strict)
{
MOZ_ASSERT(obj->is<TypedObject>());
Rooted<TypedObject *> typedObj(cx, &obj->as<TypedObject>());
@ -2087,8 +2039,8 @@ IsOwnId(JSContext *cx, HandleObject obj, HandleId id)
}
bool
TypedObject::obj_setGenericAttributes(JSContext *cx, HandleObject obj,
HandleId id, unsigned *attrsp)
TypedObject::obj_setPropertyAttributes(JSContext *cx, HandleObject obj, HandleId id,
unsigned *attrsp)
{
if (IsOwnId(cx, obj, id))
return ReportPropertyError(cx, JSMSG_CANT_REDEFINE_PROP, id);
@ -2103,7 +2055,7 @@ TypedObject::obj_setGenericAttributes(JSContext *cx, HandleObject obj,
}
bool
TypedObject::obj_deleteGeneric(JSContext *cx, HandleObject obj, HandleId id, bool *succeeded)
TypedObject::obj_deleteProperty(JSContext *cx, HandleObject obj, HandleId id, bool *succeeded)
{
if (IsOwnId(cx, obj, id))
return ReportPropertyError(cx, JSMSG_CANT_DELETE, id);
@ -2370,21 +2322,13 @@ LazyArrayBufferTable::sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf)
JS_NULL_CLASS_SPEC, \
JS_NULL_CLASS_EXT, \
{ \
TypedObject::obj_lookupGeneric, \
TypedObject::obj_lookupProperty, \
TypedObject::obj_lookupElement, \
TypedObject::obj_defineGeneric, \
TypedObject::obj_defineProperty, \
TypedObject::obj_defineElement, \
TypedObject::obj_getGeneric, \
TypedObject::obj_getProperty, \
TypedObject::obj_getElement, \
TypedObject::obj_setGeneric, \
TypedObject::obj_setProperty, \
TypedObject::obj_setElement, \
TypedObject::obj_getOwnPropertyDescriptor, \
TypedObject::obj_setGenericAttributes, \
TypedObject::obj_deleteGeneric, \
TypedObject::obj_setPropertyAttributes, \
TypedObject::obj_deleteProperty, \
nullptr, nullptr, /* watch/unwatch */ \
nullptr, /* getElements */ \
TypedObject::obj_enumerate, \

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

@ -525,52 +525,35 @@ class TypedObject : public JSObject
MutableHandleValue vp);
protected:
static bool obj_lookupGeneric(JSContext *cx, HandleObject obj,
HandleId id, MutableHandleObject objp,
MutableHandleShape propp);
static bool obj_lookupProperty(JSContext *cx, HandleObject obj,
HandlePropertyName name,
MutableHandleObject objp,
HandleId id, MutableHandleObject objp,
MutableHandleShape propp);
static bool obj_lookupElement(JSContext *cx, HandleObject obj,
uint32_t index, MutableHandleObject objp,
MutableHandleShape propp);
static bool obj_lookupElement(JSContext *cx, HandleObject obj, uint32_t index,
MutableHandleObject objp, MutableHandleShape propp);
static bool obj_defineGeneric(JSContext *cx, HandleObject obj, HandleId id, HandleValue v,
PropertyOp getter, StrictPropertyOp setter, unsigned attrs);
static bool obj_defineProperty(JSContext *cx, HandleObject obj,
HandlePropertyName name, HandleValue v,
static bool obj_defineProperty(JSContext *cx, HandleObject obj, HandleId id, HandleValue v,
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_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);
HandleId id, MutableHandleValue vp);
static bool obj_getElement(JSContext *cx, HandleObject obj, HandleObject receiver,
uint32_t index, 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,
static bool obj_setProperty(JSContext *cx, HandleObject obj, HandleId id,
MutableHandleValue vp, bool strict);
static bool obj_setElement(JSContext *cx, HandleObject obj, uint32_t index,
MutableHandleValue vp, bool strict);
static bool obj_getOwnPropertyDescriptor(JSContext *cx, HandleObject obj, HandleId id,
MutableHandle<JSPropertyDescriptor> desc);
static bool obj_setGenericAttributes(JSContext *cx, HandleObject obj,
HandleId id, unsigned *attrsp);
static bool obj_setPropertyAttributes(JSContext *cx, HandleObject obj,
HandleId id, unsigned *attrsp);
static bool obj_deleteGeneric(JSContext *cx, HandleObject obj, HandleId id, bool *succeeded);
static bool obj_deleteProperty(JSContext *cx, HandleObject obj, HandleId id, bool *succeeded);
static bool obj_enumerate(JSContext *cx, HandleObject obj, AutoIdVector &properties);

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

@ -6814,7 +6814,7 @@ static bool
ClassHasEffectlessLookup(const Class *clasp, PropertyName *name)
{
return (clasp == &UnboxedPlainObject::class_) ||
(clasp->isNative() && !clasp->ops.lookupGeneric);
(clasp->isNative() && !clasp->ops.lookupProperty);
}
static bool
@ -9367,11 +9367,11 @@ IonBuilder::objectsHaveCommonPrototype(types::TemporaryTypeSet *types, PropertyN
}
// Look for a getter/setter on the class itself which may need
// to be called. Ignore the getGeneric hook for typed arrays, it
// to be called. Ignore the getProperty op for typed arrays, it
// only handles integers and forwards names to the prototype.
if (isGetter && clasp->ops.getGeneric && !IsAnyTypedArrayClass(clasp))
if (isGetter && clasp->ops.getProperty && !IsAnyTypedArrayClass(clasp))
return false;
if (!isGetter && clasp->ops.setGeneric)
if (!isGetter && clasp->ops.setProperty)
return false;
// Test for isOwnProperty() without freezing. If we end up

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

@ -2715,7 +2715,7 @@ struct SortComparatorIndexes
// Returns all indexed properties in the range [begin, end) found on |obj| or
// its proto chain. This function does not handle proxies, objects with
// resolve/lookupGeneric hooks or indexed getters, as those can introduce
// resolve/lookupProperty hooks or indexed getters, as those can introduce
// new properties. In those cases, *success is set to |false|.
static bool
GetIndexedPropertiesInRange(JSContext *cx, HandleObject obj, uint32_t begin, uint32_t end,
@ -2727,7 +2727,7 @@ GetIndexedPropertiesInRange(JSContext *cx, HandleObject obj, uint32_t begin, uin
// properties.
JSObject *pobj = obj;
do {
if (!pobj->isNative() || pobj->getClass()->resolve || pobj->getOps()->lookupGeneric)
if (!pobj->isNative() || pobj->getClass()->resolve || pobj->getOps()->lookupProperty)
return true;
} while ((pobj = pobj->getProto()));

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

@ -297,21 +297,13 @@ namespace js {
JS_NULL_CLASS_SPEC, \
ext, \
{ \
js::proxy_LookupGeneric, \
js::proxy_LookupProperty, \
js::proxy_LookupElement, \
js::proxy_DefineGeneric, \
js::proxy_DefineProperty, \
js::proxy_DefineElement, \
js::proxy_GetGeneric, \
js::proxy_GetProperty, \
js::proxy_GetElement, \
js::proxy_SetGeneric, \
js::proxy_SetProperty, \
js::proxy_SetElement, \
js::proxy_GetOwnPropertyDescriptor, \
js::proxy_SetGenericAttributes, \
js::proxy_DeleteGeneric, \
js::proxy_SetPropertyAttributes, \
js::proxy_DeleteProperty, \
js::proxy_Watch, js::proxy_Unwatch, \
js::proxy_GetElements, \
nullptr, /* enumerate */ \
@ -335,49 +327,25 @@ namespace js {
*/
extern JS_FRIEND_API(bool)
proxy_LookupGeneric(JSContext *cx, JS::HandleObject obj, JS::HandleId id, JS::MutableHandleObject objp,
proxy_LookupProperty(JSContext *cx, JS::HandleObject obj, JS::HandleId id, JS::MutableHandleObject objp,
JS::MutableHandle<Shape*> propp);
extern JS_FRIEND_API(bool)
proxy_LookupProperty(JSContext *cx, JS::HandleObject obj, JS::Handle<PropertyName*> name,
JS::MutableHandleObject objp, JS::MutableHandle<Shape*> propp);
proxy_DefineProperty(JSContext *cx, JS::HandleObject obj, JS::HandleId id, JS::HandleValue value,
JSPropertyOp getter, JSStrictPropertyOp setter, unsigned attrs);
extern JS_FRIEND_API(bool)
proxy_LookupElement(JSContext *cx, JS::HandleObject obj, uint32_t index, JS::MutableHandleObject objp,
JS::MutableHandle<Shape*> propp);
proxy_GetProperty(JSContext *cx, JS::HandleObject obj, JS::HandleObject receiver, JS::HandleId id,
JS::MutableHandleValue vp);
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)
proxy_DefineProperty(JSContext *cx, JS::HandleObject obj, JS::Handle<PropertyName*> name,
JS::HandleValue value, JSPropertyOp getter, JSStrictPropertyOp setter,
unsigned attrs);
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_GetGeneric(JSContext *cx, JS::HandleObject obj, JS::HandleObject receiver, JS::HandleId id,
JS::MutableHandleValue vp);
extern JS_FRIEND_API(bool)
proxy_GetProperty(JSContext *cx, JS::HandleObject obj, JS::HandleObject receiver,
JS::Handle<PropertyName*> name, JS::MutableHandleValue vp);
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_SetGeneric(JSContext *cx, JS::HandleObject obj, JS::HandleId id,
JS::MutableHandleValue bp, bool strict);
extern JS_FRIEND_API(bool)
proxy_SetProperty(JSContext *cx, JS::HandleObject obj, JS::Handle<PropertyName*> name,
proxy_SetProperty(JSContext *cx, JS::HandleObject obj, JS::HandleId id,
JS::MutableHandleValue bp, bool strict);
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_GetOwnPropertyDescriptor(JSContext *cx, JS::HandleObject obj, JS::HandleId id,
JS::MutableHandle<JSPropertyDescriptor> desc);
extern JS_FRIEND_API(bool)
proxy_SetGenericAttributes(JSContext *cx, JS::HandleObject obj, JS::HandleId id, unsigned *attrsp);
proxy_SetPropertyAttributes(JSContext *cx, JS::HandleObject obj, JS::HandleId id,
unsigned *attrsp);
extern JS_FRIEND_API(bool)
proxy_DeleteGeneric(JSContext *cx, JS::HandleObject obj, JS::HandleId id, bool *succeeded);
proxy_DeleteProperty(JSContext *cx, JS::HandleObject obj, JS::HandleId id, bool *succeeded);
extern JS_FRIEND_API(void)
proxy_Trace(JSTracer *trc, JSObject *obj);

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

@ -2432,8 +2432,8 @@ static inline bool
ClassCanHaveExtraProperties(const Class *clasp)
{
return clasp->resolve
|| clasp->ops.lookupGeneric
|| clasp->ops.getGeneric
|| clasp->ops.lookupProperty
|| clasp->ops.getProperty
|| IsAnyTypedArrayClass(clasp);
}

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

@ -538,7 +538,7 @@ DefinePropertyOnObject(JSContext *cx, HandleNativeObject obj, HandleId id, const
{
/* 8.12.9 step 1. */
RootedShape shape(cx);
MOZ_ASSERT(!obj->getOps()->lookupGeneric);
MOZ_ASSERT(!obj->getOps()->lookupProperty);
if (!NativeLookupOwnProperty<CanGC>(cx, obj, id, &shape))
return false;
@ -962,7 +962,7 @@ js::StandardDefineProperty(JSContext *cx, HandleObject obj, HandleId id, const P
if (obj->is<UnboxedPlainObject>() && !obj->as<UnboxedPlainObject>().convertToNative(cx))
return false;
if (obj->getOps()->lookupGeneric) {
if (obj->getOps()->lookupProperty) {
if (obj->is<ProxyObject>()) {
Rooted<PropertyDescriptor> pd(cx);
desc.populatePropertyDescriptor(obj, &pd);
@ -1036,7 +1036,7 @@ js::DefineProperties(JSContext *cx, HandleObject obj, HandleObject props)
if (obj->is<UnboxedPlainObject>() && !obj->as<UnboxedPlainObject>().convertToNative(cx))
return false;
if (obj->getOps()->lookupGeneric) {
if (obj->getOps()->lookupProperty) {
if (obj->is<ProxyObject>()) {
Rooted<PropertyDescriptor> pd(cx);
for (size_t i = 0, len = ids.length(); i < len; i++) {
@ -1175,7 +1175,7 @@ js::SetIntegrityLevel(JSContext *cx, HandleObject obj, IntegrityLevel level)
// Ordinarily ArraySetLength handles this, but we're going behind its back
// right now, so we must do this manually. Neither the custom property
// tree mutations nor the setGenericAttributes call in the above code will
// tree mutations nor the setPropertyAttributes call in the above code will
// do this for us.
//
// ArraySetLength also implements the capacity <= length invariant for
@ -1780,34 +1780,22 @@ JSObject::nonNativeSetProperty(JSContext *cx, HandleObject obj, HandleObject rec
}
if (obj->is<ProxyObject>())
return Proxy::set(cx, obj, receiver, id, strict, vp);
return obj->getOps()->setGeneric(cx, obj, id, vp, strict);
return obj->getOps()->setProperty(cx, obj, id, vp, strict);
}
/* static */ bool
JSObject::nonNativeSetElement(JSContext *cx, HandleObject obj, HandleObject receiver,
uint32_t index, MutableHandleValue vp, bool strict)
{
if (MOZ_UNLIKELY(obj->watched())) {
RootedId id(cx);
if (!IndexToId(cx, index, &id))
return false;
WatchpointMap *wpmap = cx->compartment()->watchpointMap;
if (wpmap && !wpmap->triggerWatchpoint(cx, obj, id, vp))
return false;
}
if (obj->is<ProxyObject>()) {
RootedId id(cx);
return IndexToId(cx, index, &id) &&
Proxy::set(cx, obj, receiver, id, strict, vp);
}
return obj->getOps()->setElement(cx, obj, index, vp, strict);
RootedId id(cx);
if (!IndexToId(cx, index, &id))
return false;
return nonNativeSetProperty(cx, obj, receiver, id, vp, strict);
}
JS_FRIEND_API(bool)
JS_CopyPropertyFrom(JSContext *cx, HandleId id, HandleObject target,
HandleObject obj,
PropertyCopyBehavior copyBehavior)
HandleObject obj, PropertyCopyBehavior copyBehavior)
{
// |obj| and |cx| are generally not same-compartment with |target| here.
assertSameCompartment(cx, obj, id);
@ -2925,11 +2913,11 @@ bool
js::LookupProperty(JSContext *cx, HandleObject obj, js::HandleId id,
MutableHandleObject objp, MutableHandleShape propp)
{
/* NB: The logic of lookupGeneric is implicitly reflected in
/* NB: The logic of lookupProperty is implicitly reflected in
* BaselineIC.cpp's |EffectlesslyLookupProperty| logic.
* If this changes, please remember to update the logic there as well.
*/
if (LookupGenericOp op = obj->getOps()->lookupGeneric)
if (LookupPropertyOp op = obj->getOps()->lookupProperty)
return op(cx, obj, id, objp, propp);
return NativeLookupProperty<CanGC>(cx, obj.as<NativeObject>(), id, objp, propp);
}
@ -2964,7 +2952,7 @@ js::LookupNameNoGC(JSContext *cx, PropertyName *name, JSObject *scopeChain,
MOZ_ASSERT(!*objp && !*pobjp && !*propp);
for (JSObject *scope = scopeChain; scope; scope = scope->enclosingScope()) {
if (scope->getOps()->lookupGeneric)
if (scope->getOps()->lookupProperty)
return false;
if (!LookupPropertyInline<NoGC>(cx, &scope->as<NativeObject>(), NameToId(name), pobjp, propp))
return false;
@ -3301,7 +3289,7 @@ js::DefineProperty(ExclusiveContext *cx, HandleObject obj, HandleId id, HandleVa
MOZ_ASSERT(setter != JS_StrictPropertyStub);
MOZ_ASSERT(!(attrs & JSPROP_PROPOP_ACCESSORS));
DefineGenericOp op = obj->getOps()->defineGeneric;
DefinePropertyOp op = obj->getOps()->defineProperty;
if (op) {
if (!cx->shouldBeJSContext())
return false;
@ -3326,13 +3314,10 @@ js::DefineElement(ExclusiveContext *cx, HandleObject obj, uint32_t index, Handle
MOZ_ASSERT(getter != JS_PropertyStub);
MOZ_ASSERT(setter != JS_StrictPropertyStub);
DefineElementOp op = obj->getOps()->defineElement;
if (op) {
if (!cx->shouldBeJSContext())
return false;
return op(cx->asJSContext(), obj, index, value, getter, setter, attrs);
}
return NativeDefineElement(cx, obj.as<NativeObject>(), index, value, getter, setter, attrs);
RootedId id(cx);
if (!IndexToId(cx, index, &id))
return false;
return DefineProperty(cx, obj, id, value, getter, setter, attrs);
}
@ -4131,7 +4116,7 @@ JSObject::hasIdempotentProtoChain() const
if (resolve && resolve != js::fun_resolve && resolve != js::str_resolve)
return false;
if (obj->getOps()->lookupProperty || obj->getOps()->lookupGeneric || obj->getOps()->lookupElement)
if (obj->getOps()->lookupProperty)
return false;
obj = obj->getProto();

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

@ -157,9 +157,6 @@ inline bool
js::GetElement(JSContext *cx, HandleObject obj, HandleObject receiver, uint32_t index,
MutableHandleValue vp)
{
if (ElementIdOp op = obj->getOps()->getElement)
return op(cx, obj, receiver, index, vp);
RootedId id(cx);
if (!IndexToId(cx, index, &id))
return false;
@ -169,7 +166,7 @@ js::GetElement(JSContext *cx, HandleObject obj, HandleObject receiver, uint32_t
inline bool
js::GetElementNoGC(JSContext *cx, JSObject *obj, JSObject *receiver, uint32_t index, Value *vp)
{
if (obj->getOps()->getElement)
if (obj->getOps()->getProperty)
return false;
if (index > JSID_INT_MAX)
@ -181,7 +178,7 @@ inline bool
js::DeleteProperty(JSContext *cx, HandleObject obj, HandleId id, bool *succeeded)
{
types::MarkTypePropertyNonData(cx, obj, id);
if (DeleteGenericOp op = obj->getOps()->deleteGeneric)
if (DeletePropertyOp op = obj->getOps()->deleteProperty)
return op(cx, obj, id, succeeded);
return NativeDeleteProperty(cx, obj.as<NativeObject>(), id, succeeded);
}
@ -202,7 +199,7 @@ inline bool
js::SetPropertyAttributes(JSContext *cx, HandleObject obj, HandleId id, unsigned *attrsp)
{
types::MarkTypePropertyNonData(cx, obj, id);
GenericAttributesOp op = obj->getOps()->setGenericAttributes;
SetAttributesOp op = obj->getOps()->setAttributes;
if (op)
return op(cx, obj, id, attrsp);
return NativeSetPropertyAttributes(cx, obj.as<NativeObject>(), id, attrsp);

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

@ -551,8 +551,8 @@ js::proxy_innerObject(JSObject *obj)
}
bool
js::proxy_LookupGeneric(JSContext *cx, HandleObject obj, HandleId id,
MutableHandleObject objp, MutableHandleShape propp)
js::proxy_LookupProperty(JSContext *cx, HandleObject obj, HandleId id,
MutableHandleObject objp, MutableHandleShape propp)
{
bool found;
if (!Proxy::has(cx, obj, id, &found))
@ -569,26 +569,8 @@ js::proxy_LookupGeneric(JSContext *cx, HandleObject obj, HandleId id,
}
bool
js::proxy_LookupProperty(JSContext *cx, HandleObject obj, HandlePropertyName name,
MutableHandleObject objp, MutableHandleShape propp)
{
RootedId id(cx, NameToId(name));
return proxy_LookupGeneric(cx, obj, id, objp, propp);
}
bool
js::proxy_LookupElement(JSContext *cx, HandleObject obj, uint32_t index,
MutableHandleObject objp, MutableHandleShape propp)
{
RootedId id(cx);
if (!IndexToId(cx, index, &id))
return false;
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)
js::proxy_DefineProperty(JSContext *cx, HandleObject obj, HandleId id, HandleValue value,
PropertyOp getter, StrictPropertyOp setter, unsigned attrs)
{
Rooted<PropertyDescriptor> desc(cx);
desc.object().set(obj);
@ -600,71 +582,17 @@ js::proxy_DefineGeneric(JSContext *cx, HandleObject obj, HandleId id, HandleValu
}
bool
js::proxy_DefineProperty(JSContext *cx, HandleObject obj, HandlePropertyName name, HandleValue value,
PropertyOp getter, StrictPropertyOp setter, unsigned attrs)
{
Rooted<jsid> id(cx, NameToId(name));
return proxy_DefineGeneric(cx, obj, id, value, getter, setter, attrs);
}
bool
js::proxy_DefineElement(JSContext *cx, HandleObject obj, uint32_t index, HandleValue value,
PropertyOp getter, StrictPropertyOp setter, unsigned attrs)
{
RootedId id(cx);
if (!IndexToId(cx, index, &id))
return false;
return proxy_DefineGeneric(cx, obj, id, value, getter, setter, attrs);
}
bool
js::proxy_GetGeneric(JSContext *cx, HandleObject obj, HandleObject receiver, HandleId id,
MutableHandleValue vp)
js::proxy_GetProperty(JSContext *cx, HandleObject obj, HandleObject receiver, HandleId id,
MutableHandleValue vp)
{
return Proxy::get(cx, obj, receiver, id, vp);
}
bool
js::proxy_GetProperty(JSContext *cx, HandleObject obj, HandleObject receiver, HandlePropertyName name,
MutableHandleValue vp)
{
Rooted<jsid> id(cx, NameToId(name));
return proxy_GetGeneric(cx, obj, receiver, id, vp);
}
bool
js::proxy_GetElement(JSContext *cx, HandleObject obj, HandleObject receiver, uint32_t index,
MutableHandleValue vp)
{
RootedId id(cx);
if (!IndexToId(cx, index, &id))
return false;
return proxy_GetGeneric(cx, obj, receiver, id, vp);
}
bool
js::proxy_SetGeneric(JSContext *cx, HandleObject obj, HandleId id,
MutableHandleValue vp, bool strict)
{
return Proxy::set(cx, obj, obj, id, strict, vp);
}
bool
js::proxy_SetProperty(JSContext *cx, HandleObject obj, HandlePropertyName name,
js::proxy_SetProperty(JSContext *cx, HandleObject obj, HandleId id,
MutableHandleValue vp, bool strict)
{
Rooted<jsid> id(cx, NameToId(name));
return proxy_SetGeneric(cx, obj, id, vp, strict);
}
bool
js::proxy_SetElement(JSContext *cx, HandleObject obj, uint32_t index,
MutableHandleValue vp, bool strict)
{
RootedId id(cx);
if (!IndexToId(cx, index, &id))
return false;
return proxy_SetGeneric(cx, obj, id, vp, strict);
return Proxy::set(cx, obj, obj, id, strict, vp);
}
bool
@ -675,7 +603,7 @@ js::proxy_GetOwnPropertyDescriptor(JSContext *cx, HandleObject obj, HandleId id,
}
bool
js::proxy_SetGenericAttributes(JSContext *cx, HandleObject obj, HandleId id, unsigned *attrsp)
js::proxy_SetPropertyAttributes(JSContext *cx, HandleObject obj, HandleId id, unsigned *attrsp)
{
/* Lookup the current property descriptor so we have setter/getter/value. */
Rooted<PropertyDescriptor> desc(cx);
@ -686,7 +614,7 @@ js::proxy_SetGenericAttributes(JSContext *cx, HandleObject obj, HandleId id, uns
}
bool
js::proxy_DeleteGeneric(JSContext *cx, HandleObject obj, HandleId id, bool *succeeded)
js::proxy_DeleteProperty(JSContext *cx, HandleObject obj, HandleId id, bool *succeeded)
{
bool deleted;
if (!Proxy::delete_(cx, obj, id, &deleted))

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

@ -1387,8 +1387,7 @@ inline bool
js::GetProperty(JSContext *cx, HandleObject obj, HandleObject receiver, HandleId id,
MutableHandleValue vp)
{
MOZ_ASSERT(!!obj->getOps()->getGeneric == !!obj->getOps()->getProperty);
if (GenericIdOp op = obj->getOps()->getGeneric)
if (GetPropertyOp op = obj->getOps()->getProperty)
return op(cx, obj, receiver, id, vp);
return NativeGetProperty(cx, obj.as<NativeObject>(), receiver, id, vp);
}
@ -1396,7 +1395,7 @@ js::GetProperty(JSContext *cx, HandleObject obj, HandleObject receiver, HandleId
inline bool
js::GetPropertyNoGC(JSContext *cx, JSObject *obj, JSObject *receiver, jsid id, Value *vp)
{
if (obj->getOps()->getGeneric)
if (obj->getOps()->getProperty)
return false;
return NativeGetPropertyNoGC(cx, &obj->as<NativeObject>(), receiver, id, vp);
}
@ -1405,7 +1404,7 @@ inline bool
js::SetProperty(JSContext *cx, HandleObject obj, HandleObject receiver,
HandleId id, MutableHandleValue vp, bool strict)
{
if (obj->getOps()->setGeneric)
if (obj->getOps()->setProperty)
return JSObject::nonNativeSetProperty(cx, obj, receiver, id, vp, strict);
return NativeSetProperty(cx, obj.as<NativeObject>(), receiver, id, Qualified, vp, strict);
}
@ -1414,7 +1413,7 @@ inline bool
js::SetElement(JSContext *cx, HandleObject obj, HandleObject receiver, uint32_t index,
MutableHandleValue vp, bool strict)
{
if (obj->getOps()->setElement)
if (obj->getOps()->setProperty)
return JSObject::nonNativeSetElement(cx, obj, receiver, index, vp, strict);
return NativeSetElement(cx, obj.as<NativeObject>(), receiver, index, vp, strict);
}

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

@ -461,105 +461,35 @@ DynamicWithObject::create(JSContext *cx, HandleObject object, HandleObject enclo
}
static bool
with_LookupGeneric(JSContext *cx, HandleObject obj, HandleId id,
MutableHandleObject objp, MutableHandleShape propp)
with_LookupProperty(JSContext *cx, HandleObject obj, HandleId id,
MutableHandleObject objp, MutableHandleShape propp)
{
RootedObject actual(cx, &obj->as<DynamicWithObject>().object());
return LookupProperty(cx, actual, id, objp, propp);
}
static bool
with_LookupProperty(JSContext *cx, HandleObject obj, HandlePropertyName name,
MutableHandleObject objp, MutableHandleShape propp)
{
Rooted<jsid> id(cx, NameToId(name));
return with_LookupGeneric(cx, obj, id, objp, propp);
}
static bool
with_LookupElement(JSContext *cx, HandleObject obj, uint32_t index,
MutableHandleObject objp, MutableHandleShape propp)
{
RootedId id(cx);
if (!IndexToId(cx, index, &id))
return false;
return with_LookupGeneric(cx, obj, id, objp, propp);
}
static bool
with_DefineGeneric(JSContext *cx, HandleObject obj, HandleId id, HandleValue value,
JSPropertyOp getter, JSStrictPropertyOp setter, unsigned attrs)
with_DefineProperty(JSContext *cx, HandleObject obj, HandleId id, HandleValue value,
JSPropertyOp getter, JSStrictPropertyOp setter, unsigned attrs)
{
RootedObject actual(cx, &obj->as<DynamicWithObject>().object());
return DefineProperty(cx, actual, id, value, getter, setter, attrs);
}
static bool
with_DefineProperty(JSContext *cx, HandleObject obj, HandlePropertyName name, HandleValue value,
JSPropertyOp getter, JSStrictPropertyOp setter, unsigned attrs)
{
Rooted<jsid> id(cx, NameToId(name));
return with_DefineGeneric(cx, obj, id, value, getter, setter, attrs);
}
static bool
with_DefineElement(JSContext *cx, HandleObject obj, uint32_t index, HandleValue value,
JSPropertyOp getter, JSStrictPropertyOp setter, unsigned attrs)
{
RootedId id(cx);
if (!IndexToId(cx, index, &id))
return false;
return with_DefineGeneric(cx, obj, id, value, getter, setter, attrs);
}
static bool
with_GetGeneric(JSContext *cx, HandleObject obj, HandleObject receiver, HandleId id,
MutableHandleValue vp)
with_GetProperty(JSContext *cx, HandleObject obj, HandleObject receiver, HandleId id,
MutableHandleValue vp)
{
RootedObject actual(cx, &obj->as<DynamicWithObject>().object());
return GetProperty(cx, actual, actual, id, vp);
}
static bool
with_GetProperty(JSContext *cx, HandleObject obj, HandleObject receiver, HandlePropertyName name,
MutableHandleValue vp)
{
RootedId id(cx, NameToId(name));
return with_GetGeneric(cx, obj, receiver, id, vp);
}
static bool
with_GetElement(JSContext *cx, HandleObject obj, HandleObject receiver, uint32_t index,
MutableHandleValue vp)
{
RootedId id(cx);
if (!IndexToId(cx, index, &id))
return false;
return with_GetGeneric(cx, obj, receiver, id, vp);
}
static bool
with_SetGeneric(JSContext *cx, HandleObject obj, HandleId id,
MutableHandleValue vp, bool strict)
{
RootedObject actual(cx, &obj->as<DynamicWithObject>().object());
return SetProperty(cx, actual, actual, id, vp, strict);
}
static bool
with_SetProperty(JSContext *cx, HandleObject obj, HandlePropertyName name,
with_SetProperty(JSContext *cx, HandleObject obj, HandleId id,
MutableHandleValue vp, bool strict)
{
RootedObject actual(cx, &obj->as<DynamicWithObject>().object());
return SetProperty(cx, actual, actual, name, vp, strict);
}
static bool
with_SetElement(JSContext *cx, HandleObject obj, uint32_t index,
MutableHandleValue vp, bool strict)
{
RootedObject actual(cx, &obj->as<DynamicWithObject>().object());
return SetElement(cx, actual, actual, index, vp, strict);
return SetProperty(cx, actual, actual, id, vp, strict);
}
static bool
@ -571,14 +501,14 @@ with_GetOwnPropertyDescriptor(JSContext *cx, HandleObject obj, HandleId id,
}
static bool
with_SetGenericAttributes(JSContext *cx, HandleObject obj, HandleId id, unsigned *attrsp)
with_SetPropertyAttributes(JSContext *cx, HandleObject obj, HandleId id, unsigned *attrsp)
{
RootedObject actual(cx, &obj->as<DynamicWithObject>().object());
return SetPropertyAttributes(cx, actual, id, attrsp);
}
static bool
with_DeleteGeneric(JSContext *cx, HandleObject obj, HandleId id, bool *succeeded)
with_DeleteProperty(JSContext *cx, HandleObject obj, HandleId id, bool *succeeded)
{
RootedObject actual(cx, &obj->as<DynamicWithObject>().object());
return DeleteProperty(cx, actual, id, succeeded);
@ -616,21 +546,13 @@ const Class DynamicWithObject::class_ = {
JS_NULL_CLASS_SPEC,
JS_NULL_CLASS_EXT,
{
with_LookupGeneric,
with_LookupProperty,
with_LookupElement,
with_DefineGeneric,
with_DefineProperty,
with_DefineElement,
with_GetGeneric,
with_GetProperty,
with_GetElement,
with_SetGeneric,
with_SetProperty,
with_SetElement,
with_GetOwnPropertyDescriptor,
with_SetGenericAttributes,
with_DeleteGeneric,
with_SetPropertyAttributes,
with_DeleteProperty,
nullptr, nullptr, /* watch/unwatch */
nullptr, /* getElements */
nullptr, /* enumerate (native enumeration of target doesn't work) */
@ -988,81 +910,27 @@ ReportUninitializedLexicalId(JSContext *cx, HandleId id)
}
static bool
uninitialized_LookupGeneric(JSContext *cx, HandleObject obj, HandleId id,
MutableHandleObject objp, MutableHandleShape propp)
uninitialized_LookupProperty(JSContext *cx, HandleObject obj, HandleId id,
MutableHandleObject objp, MutableHandleShape propp)
{
ReportUninitializedLexicalId(cx, id);
return false;
}
static bool
uninitialized_LookupProperty(JSContext *cx, HandleObject obj, HandlePropertyName name,
MutableHandleObject objp, MutableHandleShape propp)
{
Rooted<jsid> id(cx, NameToId(name));
return uninitialized_LookupGeneric(cx, obj, id, objp, propp);
}
static bool
uninitialized_LookupElement(JSContext *cx, HandleObject obj, uint32_t index,
MutableHandleObject objp, MutableHandleShape propp)
{
RootedId id(cx);
if (!IndexToId(cx, index, &id))
return false;
return uninitialized_LookupGeneric(cx, obj, id, objp, propp);
}
static bool
uninitialized_GetGeneric(JSContext *cx, HandleObject obj, HandleObject receiver, HandleId id,
MutableHandleValue vp)
uninitialized_GetProperty(JSContext *cx, HandleObject obj, HandleObject receiver, HandleId id,
MutableHandleValue vp)
{
ReportUninitializedLexicalId(cx, id);
return false;
}
static bool
uninitialized_GetProperty(JSContext *cx, HandleObject obj, HandleObject receiver,
HandlePropertyName name, MutableHandleValue vp)
{
RootedId id(cx, NameToId(name));
return uninitialized_GetGeneric(cx, obj, receiver, id, vp);
}
static bool
uninitialized_GetElement(JSContext *cx, HandleObject obj, HandleObject receiver, uint32_t index,
MutableHandleValue vp)
{
RootedId id(cx);
if (!IndexToId(cx, index, &id))
return false;
return uninitialized_GetGeneric(cx, obj, receiver, id, vp);
}
static bool
uninitialized_SetGeneric(JSContext *cx, HandleObject obj, HandleId id,
MutableHandleValue vp, bool strict)
{
ReportUninitializedLexicalId(cx, id);
return false;
}
static bool
uninitialized_SetProperty(JSContext *cx, HandleObject obj, HandlePropertyName name,
uninitialized_SetProperty(JSContext *cx, HandleObject obj, HandleId id,
MutableHandleValue vp, bool strict)
{
RootedId id(cx, NameToId(name));
return uninitialized_SetGeneric(cx, obj, id, vp, strict);
}
static bool
uninitialized_SetElement(JSContext *cx, HandleObject obj, uint32_t index,
MutableHandleValue vp, bool strict)
{
RootedId id(cx);
if (!IndexToId(cx, index, &id))
return false;
return uninitialized_SetGeneric(cx, obj, id, vp, strict);
ReportUninitializedLexicalId(cx, id);
return false;
}
static bool
@ -1074,14 +942,14 @@ uninitialized_GetOwnPropertyDescriptor(JSContext *cx, HandleObject obj, HandleId
}
static bool
uninitialized_SetGenericAttributes(JSContext *cx, HandleObject obj, HandleId id, unsigned *attrsp)
uninitialized_SetPropertyAttributes(JSContext *cx, HandleObject obj, HandleId id, unsigned *attrsp)
{
ReportUninitializedLexicalId(cx, id);
return false;
}
static bool
uninitialized_DeleteGeneric(JSContext *cx, HandleObject obj, HandleId id, bool *succeeded)
uninitialized_DeleteProperty(JSContext *cx, HandleObject obj, HandleId id, bool *succeeded)
{
ReportUninitializedLexicalId(cx, id);
return false;
@ -1106,21 +974,13 @@ const Class UninitializedLexicalObject::class_ = {
JS_NULL_CLASS_SPEC,
JS_NULL_CLASS_EXT,
{
uninitialized_LookupGeneric,
uninitialized_LookupProperty,
uninitialized_LookupElement,
nullptr, /* defineGeneric */
nullptr, /* defineProperty */
nullptr, /* defineElement */
uninitialized_GetGeneric,
uninitialized_GetProperty,
uninitialized_GetElement,
uninitialized_SetGeneric,
uninitialized_SetProperty,
uninitialized_SetElement,
uninitialized_GetOwnPropertyDescriptor,
uninitialized_SetGenericAttributes,
uninitialized_DeleteGeneric,
uninitialized_SetPropertyAttributes,
uninitialized_DeleteProperty,
nullptr, nullptr, /* watch/unwatch */
nullptr, /* getElements */
nullptr, /* enumerate (native enumeration of target doesn't work) */

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

@ -241,9 +241,9 @@ UnboxedPlainObject::create(JSContext *cx, HandleObjectGroup group, NewObjectKind
}
/* static */ bool
UnboxedPlainObject::obj_lookupGeneric(JSContext *cx, HandleObject obj,
HandleId id, MutableHandleObject objp,
MutableHandleShape propp)
UnboxedPlainObject::obj_lookupProperty(JSContext *cx, HandleObject obj,
HandleId id, MutableHandleObject objp,
MutableHandleShape propp)
{
if (obj->as<UnboxedPlainObject>().layout().lookup(id)) {
MarkNonNativePropertyFound<CanGC>(propp);
@ -262,29 +262,8 @@ UnboxedPlainObject::obj_lookupGeneric(JSContext *cx, HandleObject obj,
}
/* static */ bool
UnboxedPlainObject::obj_lookupProperty(JSContext *cx, HandleObject obj,
HandlePropertyName name,
MutableHandleObject objp,
MutableHandleShape propp)
{
RootedId id(cx, NameToId(name));
return obj_lookupGeneric(cx, obj, id, objp, propp);
}
/* static */ bool
UnboxedPlainObject::obj_lookupElement(JSContext *cx, HandleObject obj,
uint32_t index, MutableHandleObject objp,
MutableHandleShape propp)
{
RootedId id(cx);
if (!IndexToId(cx, index, &id))
return false;
return obj_lookupGeneric(cx, obj, id, objp, propp);
}
/* static */ bool
UnboxedPlainObject::obj_defineGeneric(JSContext *cx, HandleObject obj, HandleId id, HandleValue v,
PropertyOp getter, StrictPropertyOp setter, unsigned attrs)
UnboxedPlainObject::obj_defineProperty(JSContext *cx, HandleObject obj, HandleId id, HandleValue v,
PropertyOp getter, StrictPropertyOp setter, unsigned attrs)
{
if (!obj->as<UnboxedPlainObject>().convertToNative(cx))
return false;
@ -293,28 +272,8 @@ UnboxedPlainObject::obj_defineGeneric(JSContext *cx, HandleObject obj, HandleId
}
/* static */ bool
UnboxedPlainObject::obj_defineProperty(JSContext *cx, HandleObject obj,
HandlePropertyName name, HandleValue v,
PropertyOp getter, StrictPropertyOp setter, unsigned attrs)
{
Rooted<jsid> id(cx, NameToId(name));
return obj_defineGeneric(cx, obj, id, v, getter, setter, attrs);
}
/* static */ bool
UnboxedPlainObject::obj_defineElement(JSContext *cx, HandleObject obj, uint32_t index, HandleValue v,
PropertyOp getter, StrictPropertyOp setter, unsigned attrs)
{
AutoRooterGetterSetter gsRoot(cx, attrs, &getter, &setter);
RootedId id(cx);
if (!IndexToId(cx, index, &id))
return false;
return obj_defineGeneric(cx, obj, id, v, getter, setter, attrs);
}
/* static */ bool
UnboxedPlainObject::obj_getGeneric(JSContext *cx, HandleObject obj, HandleObject receiver,
HandleId id, MutableHandleValue vp)
UnboxedPlainObject::obj_getProperty(JSContext *cx, HandleObject obj, HandleObject receiver,
HandleId id, MutableHandleValue vp)
{
const UnboxedLayout &layout = obj->as<UnboxedPlainObject>().layout();
@ -333,26 +292,8 @@ UnboxedPlainObject::obj_getGeneric(JSContext *cx, HandleObject obj, HandleObject
}
/* static */ bool
UnboxedPlainObject::obj_getProperty(JSContext *cx, HandleObject obj, HandleObject receiver,
HandlePropertyName name, MutableHandleValue vp)
{
RootedId id(cx, NameToId(name));
return obj_getGeneric(cx, obj, receiver, id, vp);
}
/* static */ bool
UnboxedPlainObject::obj_getElement(JSContext *cx, HandleObject obj, HandleObject receiver,
uint32_t index, MutableHandleValue vp)
{
RootedId id(cx);
if (!IndexToId(cx, index, &id))
return false;
return obj_getGeneric(cx, obj, receiver, id, vp);
}
/* static */ bool
UnboxedPlainObject::obj_setGeneric(JSContext *cx, HandleObject obj, HandleId id,
MutableHandleValue vp, bool strict)
UnboxedPlainObject::obj_setProperty(JSContext *cx, HandleObject obj, HandleId id,
MutableHandleValue vp, bool strict)
{
const UnboxedLayout &layout = obj->as<UnboxedPlainObject>().layout();
@ -375,24 +316,6 @@ UnboxedPlainObject::obj_setGeneric(JSContext *cx, HandleObject obj, HandleId id,
return SetProperty(cx, proto, obj, id, vp, strict);
}
/* static */ bool
UnboxedPlainObject::obj_setProperty(JSContext *cx, HandleObject obj, HandlePropertyName name,
MutableHandleValue vp, bool strict)
{
RootedId id(cx, NameToId(name));
return obj_setGeneric(cx, obj, id, vp, strict);
}
/* static */ bool
UnboxedPlainObject::obj_setElement(JSContext *cx, HandleObject obj, uint32_t index,
MutableHandleValue vp, bool strict)
{
RootedId id(cx);
if (!IndexToId(cx, index, &id))
return false;
return obj_setGeneric(cx, obj, id, vp, strict);
}
/* static */ bool
UnboxedPlainObject::obj_getOwnPropertyDescriptor(JSContext *cx, HandleObject obj, HandleId id,
MutableHandle<JSPropertyDescriptor> desc)
@ -411,8 +334,8 @@ UnboxedPlainObject::obj_getOwnPropertyDescriptor(JSContext *cx, HandleObject obj
}
/* static */ bool
UnboxedPlainObject::obj_setGenericAttributes(JSContext *cx, HandleObject obj,
HandleId id, unsigned *attrsp)
UnboxedPlainObject::obj_setPropertyAttributes(JSContext *cx, HandleObject obj,
HandleId id, unsigned *attrsp)
{
if (!obj->as<UnboxedPlainObject>().convertToNative(cx))
return false;
@ -420,7 +343,8 @@ UnboxedPlainObject::obj_setGenericAttributes(JSContext *cx, HandleObject obj,
}
/* static */ bool
UnboxedPlainObject::obj_deleteGeneric(JSContext *cx, HandleObject obj, HandleId id, bool *succeeded)
UnboxedPlainObject::obj_deleteProperty(JSContext *cx, HandleObject obj, HandleId id,
bool *succeeded)
{
if (!obj->as<UnboxedPlainObject>().convertToNative(cx))
return false;
@ -464,21 +388,13 @@ const Class UnboxedPlainObject::class_ = {
JS_NULL_CLASS_SPEC,
JS_NULL_CLASS_EXT,
{
UnboxedPlainObject::obj_lookupGeneric,
UnboxedPlainObject::obj_lookupProperty,
UnboxedPlainObject::obj_lookupElement,
UnboxedPlainObject::obj_defineGeneric,
UnboxedPlainObject::obj_defineProperty,
UnboxedPlainObject::obj_defineElement,
UnboxedPlainObject::obj_getGeneric,
UnboxedPlainObject::obj_getProperty,
UnboxedPlainObject::obj_getElement,
UnboxedPlainObject::obj_setGeneric,
UnboxedPlainObject::obj_setProperty,
UnboxedPlainObject::obj_setElement,
UnboxedPlainObject::obj_getOwnPropertyDescriptor,
UnboxedPlainObject::obj_setGenericAttributes,
UnboxedPlainObject::obj_deleteGeneric,
UnboxedPlainObject::obj_setPropertyAttributes,
UnboxedPlainObject::obj_deleteProperty,
UnboxedPlainObject::obj_watch,
nullptr, /* No unwatch needed, as watch() converts the object to native */
nullptr, /* getElements */

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

@ -131,52 +131,26 @@ class UnboxedPlainObject : public JSObject
public:
static const Class class_;
static bool obj_lookupGeneric(JSContext *cx, HandleObject obj,
HandleId id, MutableHandleObject objp,
MutableHandleShape propp);
static bool obj_lookupProperty(JSContext *cx, HandleObject obj,
HandlePropertyName name,
MutableHandleObject objp,
HandleId id, MutableHandleObject objp,
MutableHandleShape propp);
static bool obj_lookupElement(JSContext *cx, HandleObject obj,
uint32_t index, MutableHandleObject objp,
MutableHandleShape propp);
static bool obj_defineGeneric(JSContext *cx, HandleObject obj, HandleId id, HandleValue v,
PropertyOp getter, StrictPropertyOp setter, unsigned attrs);
static bool obj_defineProperty(JSContext *cx, HandleObject obj,
HandlePropertyName name, HandleValue v,
static bool obj_defineProperty(JSContext *cx, HandleObject obj, HandleId id, HandleValue v,
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_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);
HandleId id, MutableHandleValue vp);
static bool obj_getElement(JSContext *cx, HandleObject obj, HandleObject receiver,
uint32_t index, 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,
static bool obj_setProperty(JSContext *cx, HandleObject obj, HandleId id,
MutableHandleValue vp, bool strict);
static bool obj_setElement(JSContext *cx, HandleObject obj, uint32_t index,
MutableHandleValue vp, bool strict);
static bool obj_getOwnPropertyDescriptor(JSContext *cx, HandleObject obj, HandleId id,
MutableHandle<JSPropertyDescriptor> desc);
static bool obj_setGenericAttributes(JSContext *cx, HandleObject obj,
HandleId id, unsigned *attrsp);
static bool obj_setPropertyAttributes(JSContext *cx, HandleObject obj,
HandleId id, unsigned *attrsp);
static bool obj_deleteGeneric(JSContext *cx, HandleObject obj, HandleId id, bool *succeeded);
static bool obj_deleteProperty(JSContext *cx, HandleObject obj, HandleId id, bool *succeeded);
static bool obj_enumerate(JSContext *cx, HandleObject obj, AutoIdVector &properties);
static bool obj_watch(JSContext *cx, HandleObject obj, HandleId id, HandleObject callable);

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

@ -681,21 +681,13 @@ const XPCWrappedNativeJSClass XPC_WN_NoHelper_JSClass = {
// ObjectOps
{
nullptr, // lookupGeneric
nullptr, // lookupProperty
nullptr, // lookupElement
nullptr, // defineGeneric
nullptr, // defineProperty
nullptr, // defineElement
nullptr, // getGeneric
nullptr, // getProperty
nullptr, // getElement
nullptr, // setGeneric
nullptr, // setProperty
nullptr, // setElement
nullptr, // getOwnPropertyDescriptor
nullptr, // setGenericAttributes
nullptr, // deleteGeneric
nullptr, // setPropertyAttributes
nullptr, // deleteProperty
nullptr, nullptr, // watch/unwatch
nullptr, // getElements
nullptr, // enumerate

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

@ -973,21 +973,13 @@ XPC_WN_JSOp_ThisObject(JSContext *cx, JS::HandleObject obj);
// Macros to initialize Object or Function like XPC_WN classes
#define XPC_WN_WithCall_ObjectOps \
{ \
nullptr, /* lookupGeneric */ \
nullptr, /* lookupProperty */ \
nullptr, /* lookupElement */ \
nullptr, /* defineGeneric */ \
nullptr, /* defineProperty */ \
nullptr, /* defineElement */ \
nullptr, /* getGeneric */ \
nullptr, /* getProperty */ \
nullptr, /* getElement */ \
nullptr, /* setGeneric */ \
nullptr, /* setProperty */ \
nullptr, /* setElement */ \
nullptr, /* getOwnPropertyDescriptor */ \
nullptr, /* setGenericAttributes */ \
nullptr, /* deleteGeneric */ \
nullptr, /* setPropertyAttributes */ \
nullptr, /* deleteProperty */ \
nullptr, nullptr, /* watch/unwatch */ \
nullptr, /* getElements */ \
nullptr, /* enumerate */ \
@ -996,21 +988,13 @@ XPC_WN_JSOp_ThisObject(JSContext *cx, JS::HandleObject obj);
#define XPC_WN_NoCall_ObjectOps \
{ \
nullptr, /* lookupGeneric */ \
nullptr, /* lookupProperty */ \
nullptr, /* lookupElement */ \
nullptr, /* defineGeneric */ \
nullptr, /* defineProperty */ \
nullptr, /* defineElement */ \
nullptr, /* getGeneric */ \
nullptr, /* getProperty */ \
nullptr, /* getElement */ \
nullptr, /* setGeneric */ \
nullptr, /* setProperty */ \
nullptr, /* setElement */ \
nullptr, /* getOwnPropertyDescriptor */ \
nullptr, /* setGenericAttributes */ \
nullptr, /* deleteGeneric */ \
nullptr, /* setPropertyAttributes */ \
nullptr, /* deleteProperty */ \
nullptr, nullptr, /* watch/unwatch */ \
nullptr, /* getElements */ \
nullptr, /* enumerate */ \