Bug 1130576 - Rename JSPropertyOp -> JSGetterOp and JSStrictPropertyOp -> JSSetterOp. r=efaust.

--HG--
extra : rebase_source : 44edb174028da6dbd637975e6358112060de535b
extra : amend_source : dd79490550af1370dac037057bdc2c06cb4c71f5
This commit is contained in:
Jason Orendorff 2015-01-30 13:56:15 -06:00
parent 06a50f8795
commit 85abad51f2
39 changed files with 203 additions and 202 deletions

View File

@ -627,7 +627,7 @@ JavaScriptShared::toDescriptor(JSContext *cx, const PPropertyDescriptor &in,
getter = fromObjectVariant(cx, in.getter().get_ObjectVariant());
if (!getter)
return false;
out.setGetter(JS_DATA_TO_FUNC_PTR(JSPropertyOp, getter.get()));
out.setGetter(JS_DATA_TO_FUNC_PTR(JSGetterOp, getter.get()));
} else {
out.setGetter(UnknownPropertyStub);
}
@ -639,7 +639,7 @@ JavaScriptShared::toDescriptor(JSContext *cx, const PPropertyDescriptor &in,
setter = fromObjectVariant(cx, in.setter().get_ObjectVariant());
if (!setter)
return false;
out.setSetter(JS_DATA_TO_FUNC_PTR(JSStrictPropertyOp, setter.get()));
out.setSetter(JS_DATA_TO_FUNC_PTR(JSSetterOp, setter.get()));
} else {
out.setSetter(UnknownStrictPropertyStub);
}

View File

@ -52,8 +52,10 @@ class AutoIdVector;
// be a string (Unicode property identifier) or an int (element index). The
// *vp out parameter, on success, is the new property value after the action.
typedef bool
(* JSPropertyOp)(JSContext *cx, JS::HandleObject obj, JS::HandleId id,
JS::MutableHandleValue vp);
(* JSGetterOp)(JSContext *cx, JS::HandleObject obj, JS::HandleId id,
JS::MutableHandleValue vp);
typedef JSGetterOp JSAddPropertyOp;
// Set a property named by id in obj, treating the assignment as strict
// mode code if strict is true. Note the jsid id type -- id may be a string
@ -61,8 +63,8 @@ typedef bool
// parameter, on success, is the new property value after the
// set.
typedef bool
(* JSStrictPropertyOp)(JSContext *cx, JS::HandleObject obj, JS::HandleId id,
bool strict, JS::MutableHandleValue vp);
(* JSSetterOp)(JSContext *cx, JS::HandleObject obj, JS::HandleId id,
bool strict, JS::MutableHandleValue vp);
// Delete a property named by id in obj.
//
@ -166,7 +168,7 @@ typedef bool
JS::MutableHandleObject objp, JS::MutableHandle<Shape*> propp);
typedef bool
(* DefinePropertyOp)(JSContext *cx, JS::HandleObject obj, JS::HandleId id, JS::HandleValue value,
JSPropertyOp getter, JSStrictPropertyOp setter, unsigned attrs);
JSGetterOp getter, JSSetterOp setter, unsigned attrs);
typedef bool
(* HasPropertyOp)(JSContext *cx, JS::HandleObject obj, JS::HandleId id, bool *foundp);
typedef bool
@ -243,10 +245,10 @@ typedef void
uint32_t flags; \
\
/* Function pointer members (may be null). */ \
JSPropertyOp addProperty; \
JSAddPropertyOp addProperty; \
JSDeletePropertyOp delProperty; \
JSPropertyOp getProperty; \
JSStrictPropertyOp setProperty; \
JSGetterOp getProperty; \
JSSetterOp setProperty; \
JSEnumerateOp enumerate; \
JSResolveOp resolve; \
JSConvertOp convert; \

View File

@ -710,7 +710,7 @@ InitCollatorClass(JSContext *cx, HandleObject Intl, Handle<GlobalObject*> global
if (!GlobalObject::getIntrinsicValue(cx, cx->global(), cx->names().CollatorCompareGet, &getter))
return nullptr;
if (!DefineProperty(cx, proto, cx->names().compare, UndefinedHandleValue,
JS_DATA_TO_FUNC_PTR(JSPropertyOp, &getter.toObject()),
JS_DATA_TO_FUNC_PTR(JSGetterOp, &getter.toObject()),
nullptr, JSPROP_GETTER | JSPROP_SHARED))
{
return nullptr;
@ -1203,7 +1203,7 @@ InitNumberFormatClass(JSContext *cx, HandleObject Intl, Handle<GlobalObject*> gl
if (!GlobalObject::getIntrinsicValue(cx, cx->global(), cx->names().NumberFormatFormatGet, &getter))
return nullptr;
if (!DefineProperty(cx, proto, cx->names().format, UndefinedHandleValue,
JS_DATA_TO_FUNC_PTR(JSPropertyOp, &getter.toObject()),
JS_DATA_TO_FUNC_PTR(JSGetterOp, &getter.toObject()),
nullptr, JSPROP_GETTER | JSPROP_SHARED))
{
return nullptr;
@ -1662,7 +1662,7 @@ InitDateTimeFormatClass(JSContext *cx, HandleObject Intl, Handle<GlobalObject*>
if (!GlobalObject::getIntrinsicValue(cx, cx->global(), cx->names().DateTimeFormatFormatGet, &getter))
return nullptr;
if (!DefineProperty(cx, proto, cx->names().format, UndefinedHandleValue,
JS_DATA_TO_FUNC_PTR(JSPropertyOp, &getter.toObject()),
JS_DATA_TO_FUNC_PTR(JSGetterOp, &getter.toObject()),
nullptr, JSPROP_GETTER | JSPROP_SHARED))
{
return nullptr;

View File

@ -1757,7 +1757,7 @@ ReportPropertyError(JSContext *cx,
bool
TypedObject::obj_defineProperty(JSContext *cx, HandleObject obj, HandleId id, HandleValue v,
PropertyOp getter, StrictPropertyOp setter, unsigned attrs)
GetterOp getter, SetterOp setter, unsigned attrs)
{
Rooted<TypedObject *> typedObj(cx, &obj->as<TypedObject>());
return ReportTypedObjTypeError(cx, JSMSG_OBJECT_NOT_EXTENSIBLE, typedObj);

View File

@ -529,7 +529,7 @@ class TypedObject : public JSObject
MutableHandleObject objp, MutableHandleShape propp);
static bool obj_defineProperty(JSContext *cx, HandleObject obj, HandleId id, HandleValue v,
PropertyOp getter, StrictPropertyOp setter, unsigned attrs);
GetterOp getter, SetterOp setter, unsigned attrs);
static bool obj_hasProperty(JSContext *cx, HandleObject obj, HandleId id, bool *foundp);

View File

@ -348,12 +348,12 @@ JSPropertyDescriptor::trace(JSTracer *trc)
if ((attrs & JSPROP_GETTER) && getter) {
JSObject *tmp = JS_FUNC_TO_DATA_PTR(JSObject *, getter);
MarkObjectRoot(trc, &tmp, "Descriptor::get");
getter = JS_DATA_TO_FUNC_PTR(JSPropertyOp, tmp);
getter = JS_DATA_TO_FUNC_PTR(JSGetterOp, tmp);
}
if ((attrs & JSPROP_SETTER) && setter) {
JSObject *tmp = JS_FUNC_TO_DATA_PTR(JSObject *, setter);
MarkObjectRoot(trc, &tmp, "Descriptor::set");
setter = JS_DATA_TO_FUNC_PTR(JSStrictPropertyOp, tmp);
setter = JS_DATA_TO_FUNC_PTR(JSSetterOp, tmp);
}
}

View File

@ -1005,13 +1005,13 @@ EmitGetterCall(JSContext *cx, MacroAssembler &masm,
Register argObjReg = argUintNReg;
Register argIdReg = regSet.takeGeneral();
PropertyOp target = shape->getterOp();
GetterOp target = shape->getterOp();
MOZ_ASSERT(target);
// Push stubCode for marking.
attacher.pushStubCodePointer(masm);
// JSPropertyOp: bool fn(JSContext *cx, HandleObject obj, HandleId id, MutableHandleValue vp)
// JSGetterOp: bool fn(JSContext *cx, HandleObject obj, HandleId id, MutableHandleValue vp)
// Push args on stack first so we can take pointers to make handles.
masm.Push(UndefinedValue());
@ -2098,10 +2098,9 @@ IsCacheableSetPropCallPropertyOp(HandleObject obj, HandleObject holder, HandleSh
if (shape->hasSetterValue())
return false;
// Despite the vehement claims of Shape.h that writable() is only
// relevant for data descriptors, some PropertyOp setters care
// desperately about its value. The flag should be always true, apart
// from these rare instances.
// Despite the vehement claims of Shape.h that writable() is only relevant
// for data descriptors, some SetterOps care desperately about its
// value. The flag should be always true, apart from these rare instances.
if (!shape->writable())
return false;
@ -2380,10 +2379,10 @@ GenerateCallSetter(JSContext *cx, IonScript *ion, MacroAssembler &masm,
attacher.pushStubCodePointer(masm);
StrictPropertyOp target = shape->setterOp();
SetterOp target = shape->setterOp();
MOZ_ASSERT(target);
// JSStrictPropertyOp: bool fn(JSContext *cx, HandleObject obj,
// HandleId id, bool strict, MutableHandleValue vp);
// JSSetterOp: bool fn(JSContext *cx, HandleObject obj,
// HandleId id, bool strict, MutableHandleValue vp);
// Push args on stack first so we can take pointers to make handles.
if (value.constant())

View File

@ -2050,8 +2050,8 @@ DefinePropertyById(JSContext *cx, HandleObject obj, HandleId id, HandleValue val
const JSNativeWrapper &get, const JSNativeWrapper &set,
unsigned attrs, unsigned flags)
{
JSPropertyOp getter = JS_CAST_NATIVE_TO(get.op, JSPropertyOp);
JSStrictPropertyOp setter = JS_CAST_NATIVE_TO(set.op, JSStrictPropertyOp);
JSGetterOp getter = JS_CAST_NATIVE_TO(get.op, JSGetterOp);
JSSetterOp setter = JS_CAST_NATIVE_TO(set.op, JSSetterOp);
// JSPROP_READONLY has no meaning when accessors are involved. Ideally we'd
// throw if this happens, but we've accepted it for long enough that it's
@ -2066,7 +2066,7 @@ DefinePropertyById(JSContext *cx, HandleObject obj, HandleId id, HandleValue val
// JS Function objects.
//
// But skip doing this if our accessors are the well-known stub
// accessors, since those are known to be JSPropertyOps. Assert
// accessors, since those are known to be JSGetterOps. Assert
// some sanity about it, though.
MOZ_ASSERT_IF(getter == JS_PropertyStub,
setter == JS_StrictPropertyStub || (attrs & JSPROP_PROPOP_ACCESSORS));
@ -2094,7 +2094,7 @@ DefinePropertyById(JSContext *cx, HandleObject obj, HandleId id, HandleValue val
if (get.info)
getobj->setJitInfo(get.info);
getter = JS_DATA_TO_FUNC_PTR(PropertyOp, getobj);
getter = JS_DATA_TO_FUNC_PTR(GetterOp, getobj);
attrs |= JSPROP_GETTER;
}
if (setter && !(attrs & JSPROP_SETTER)) {
@ -2109,7 +2109,7 @@ DefinePropertyById(JSContext *cx, HandleObject obj, HandleId id, HandleValue val
if (set.info)
setobj->setJitInfo(set.info);
setter = JS_DATA_TO_FUNC_PTR(StrictPropertyOp, setobj);
setter = JS_DATA_TO_FUNC_PTR(SetterOp, setobj);
attrs |= JSPROP_SETTER;
}
} else {

View File

@ -887,7 +887,7 @@ class MOZ_STACK_CLASS SourceBufferHolder MOZ_FINAL
#define JSPROP_PERMANENT 0x04 /* property cannot be deleted */
#define JSPROP_PROPOP_ACCESSORS 0x08 /* Passed to JS_Define(UC)Property* and
JS_DefineElement if getters/setters
are JSPropertyOp/JSStrictPropertyOp */
are JSGetterOp/JSSetterOp */
#define JSPROP_GETTER 0x10 /* property holds getter function */
#define JSPROP_SETTER 0x20 /* property holds setter function */
#define JSPROP_SHARED 0x40 /* don't allocate a value slot for this
@ -2094,10 +2094,10 @@ inline int
CheckIsCharacterLiteral(const char (&arr)[N]);
/* NEVER DEFINED, DON'T USE. For use by JS_PROPERTYOP_GETTER only. */
inline int CheckIsPropertyOp(JSPropertyOp op);
inline int CheckIsGetterOp(JSGetterOp op);
/* NEVER DEFINED, DON'T USE. For use by JS_PROPERTYOP_SETTER only. */
inline int CheckIsStrictPropertyOp(JSStrictPropertyOp op);
inline int CheckIsSetterOp(JSSetterOp op);
} // namespace detail
@ -2116,11 +2116,11 @@ inline int CheckIsStrictPropertyOp(JSStrictPropertyOp op);
(flags))
#define JS_PROPERTYOP_GETTER(v) \
(static_cast<void>(sizeof(JS::detail::CheckIsPropertyOp(v))), \
(static_cast<void>(sizeof(JS::detail::CheckIsGetterOp(v))), \
reinterpret_cast<JSNative>(v))
#define JS_PROPERTYOP_SETTER(v) \
(static_cast<void>(sizeof(JS::detail::CheckIsStrictPropertyOp(v))), \
(static_cast<void>(sizeof(JS::detail::CheckIsSetterOp(v))), \
reinterpret_cast<JSNative>(v))
#define JS_STUBGETTER JS_PROPERTYOP_GETTER(JS_PropertyStub)
@ -2598,11 +2598,11 @@ extern JS_PUBLIC_API(bool)
JS_HasPropertyById(JSContext *cx, JS::HandleObject obj, JS::HandleId id, bool *foundp);
struct JSPropertyDescriptor {
JSObject *obj;
unsigned attrs;
JSPropertyOp getter;
JSStrictPropertyOp setter;
JS::Value value;
JSObject *obj;
unsigned attrs;
JSGetterOp getter;
JSSetterOp setter;
JS::Value value;
JSPropertyDescriptor()
: obj(nullptr), attrs(0), getter(nullptr), setter(nullptr), value(JSVAL_VOID)
@ -2632,8 +2632,8 @@ class PropertyDescriptorOperations
bool isIndex() const { return desc()->attrs & JSPROP_INDEX; }
bool hasAttributes(unsigned attrs) const { return desc()->attrs & attrs; }
// Descriptors with JSPropertyOps are considered data descriptors. It's
// complicated.
// Descriptors with JSGetterOp/JSSetterOp are considered data
// descriptors. It's complicated.
bool isAccessorDescriptor() const { return hasGetterOrSetterObject(); }
bool isDataDescriptor() const { return !isAccessorDescriptor(); }
@ -2643,8 +2643,8 @@ class PropertyDescriptorOperations
return JS::HandleObject::fromMarkedLocation(&desc()->obj);
}
unsigned attributes() const { return desc()->attrs; }
JSPropertyOp getter() const { return desc()->getter; }
JSStrictPropertyOp setter() const { return desc()->setter; }
JSGetterOp getter() const { return desc()->getter; }
JSSetterOp setter() const { return desc()->setter; }
JS::HandleObject getterObject() const {
MOZ_ASSERT(hasGetterObject());
return JS::HandleObject::fromMarkedLocation(
@ -2687,8 +2687,8 @@ class MutablePropertyDescriptorOperations : public PropertyDescriptorOperations<
return JS::MutableHandleObject::fromMarkedLocation(&desc()->obj);
}
unsigned &attributesRef() { return desc()->attrs; }
JSPropertyOp &getter() { return desc()->getter; }
JSStrictPropertyOp &setter() { return desc()->setter; }
JSGetterOp &getter() { return desc()->getter; }
JSSetterOp &setter() { return desc()->setter; }
JS::MutableHandleValue value() {
return JS::MutableHandleValue::fromMarkedLocation(&desc()->value);
}
@ -2696,16 +2696,16 @@ class MutablePropertyDescriptorOperations : public PropertyDescriptorOperations<
void setEnumerable() { desc()->attrs |= JSPROP_ENUMERATE; }
void setAttributes(unsigned attrs) { desc()->attrs = attrs; }
void setGetter(JSPropertyOp op) {
void setGetter(JSGetterOp op) {
MOZ_ASSERT(op != JS_PropertyStub);
desc()->getter = op;
}
void setSetter(JSStrictPropertyOp op) {
void setSetter(JSSetterOp op) {
MOZ_ASSERT(op != JS_StrictPropertyStub);
desc()->setter = op;
}
void setGetterObject(JSObject *obj) { desc()->getter = reinterpret_cast<JSPropertyOp>(obj); }
void setSetterObject(JSObject *obj) { desc()->setter = reinterpret_cast<JSStrictPropertyOp>(obj); }
void setGetterObject(JSObject *obj) { desc()->getter = reinterpret_cast<JSGetterOp>(obj); }
void setSetterObject(JSObject *obj) { desc()->setter = reinterpret_cast<JSSetterOp>(obj); }
JS::MutableHandleObject getterObject() {
MOZ_ASSERT(this->hasGetterObject());

View File

@ -289,7 +289,8 @@ CallJSNativeConstructor(JSContext *cx, Native native, const CallArgs &args)
}
MOZ_ALWAYS_INLINE bool
CallJSPropertyOp(JSContext *cx, PropertyOp op, HandleObject receiver, HandleId id, MutableHandleValue vp)
CallJSGetterOp(JSContext *cx, GetterOp op, HandleObject receiver, HandleId id,
MutableHandleValue vp)
{
JS_CHECK_RECURSION(cx, return false);
@ -301,8 +302,8 @@ CallJSPropertyOp(JSContext *cx, PropertyOp op, HandleObject receiver, HandleId i
}
MOZ_ALWAYS_INLINE bool
CallJSPropertyOpSetter(JSContext *cx, StrictPropertyOp op, HandleObject obj, HandleId id,
bool strict, MutableHandleValue vp)
CallJSSetterOp(JSContext *cx, SetterOp op, HandleObject obj, HandleId id, bool strict,
MutableHandleValue vp)
{
JS_CHECK_RECURSION(cx, return false);
@ -324,7 +325,7 @@ CallJSDeletePropertyOp(JSContext *cx, JSDeletePropertyOp op, HandleObject receiv
}
inline bool
CallSetter(JSContext *cx, HandleObject obj, HandleId id, StrictPropertyOp op, unsigned attrs,
CallSetter(JSContext *cx, HandleObject obj, HandleId id, SetterOp op, unsigned attrs,
bool strict, MutableHandleValue vp)
{
if (attrs & JSPROP_SETTER) {
@ -338,7 +339,7 @@ CallSetter(JSContext *cx, HandleObject obj, HandleId id, StrictPropertyOp op, un
if (!op)
return true;
return CallJSPropertyOpSetter(cx, op, obj, id, strict, vp);
return CallJSSetterOp(cx, op, obj, id, strict, vp);
}
inline uintptr_t

View File

@ -361,7 +361,7 @@ proxy_LookupProperty(JSContext *cx, JS::HandleObject obj, JS::HandleId id, JS::M
JS::MutableHandle<Shape*> propp);
extern JS_FRIEND_API(bool)
proxy_DefineProperty(JSContext *cx, JS::HandleObject obj, JS::HandleId id, JS::HandleValue value,
JSPropertyOp getter, JSStrictPropertyOp setter, unsigned attrs);
JSGetterOp getter, JSSetterOp setter, unsigned attrs);
extern JS_FRIEND_API(bool)
proxy_HasProperty(JSContext *cx, JS::HandleObject obj, JS::HandleId id, bool *foundp);
extern JS_FRIEND_API(bool)

View File

@ -2188,8 +2188,8 @@ js::DefineFunction(JSContext *cx, HandleObject obj, HandleId id, Native native,
unsigned nargs, unsigned flags, AllocKind allocKind /* = FinalizeKind */,
NewObjectKind newKind /* = GenericObject */)
{
PropertyOp gop;
StrictPropertyOp sop;
GetterOp gop;
SetterOp sop;
if (flags & JSFUN_STUB_GSOPS) {
/*
* JSFUN_STUB_GSOPS is a request flag only, not stored in fun->flags or

View File

@ -475,6 +475,7 @@ Reject(JSContext *cx, HandleId id, unsigned errorNumber, bool throwError, bool *
return true;
}
/*** Standard-compliant property definition (used by Object.defineProperty) **********************/
static bool
@ -571,7 +572,7 @@ DefinePropertyOnObject(JSContext *cx, HandleNativeObject obj, HandleId id, const
v = obj->getDenseOrTypedArrayElement(JSID_TO_INT(id));
} else if (shape->isDataDescriptor()) {
/*
* We must rule out a non-configurable js::PropertyOp-guarded
* We must rule out a non-configurable js::SetterOp-guarded
* property becoming a writable unguarded data property, since
* such a property can have its value changed to one the getter
* and setter preclude.
@ -602,14 +603,14 @@ DefinePropertyOnObject(JSContext *cx, HandleNativeObject obj, HandleId id, const
return false;
if (!same) {
/*
* Insist that a non-configurable js::PropertyOp data
* Insist that a non-configurable js::GetterOp data
* property is frozen at exactly the last-got value.
*
* Duplicate the first part of the big conjunction that
* we tested above, rather than add a local bool flag.
* Likewise, don't try to keep shape->writable() in a
* flag we veto from true to false for non-configurable
* PropertyOp-based data properties and test before the
* GetterOp-based data properties and test before the
* SameValue check later on in order to re-use that "if
* (!SameValue) Reject" logic.
*
@ -701,8 +702,8 @@ DefinePropertyOnObject(JSContext *cx, HandleNativeObject obj, HandleId id, const
/* 8.12.9 step 12. */
unsigned attrs;
PropertyOp getter;
StrictPropertyOp setter;
GetterOp getter;
SetterOp setter;
if (desc.isGenericDescriptor()) {
unsigned changed = 0;
if (desc.hasConfigurable())
@ -1712,7 +1713,7 @@ JS_CopyPropertyFrom(JSContext *cx, HandleId id, HandleObject target,
return false;
MOZ_ASSERT(desc.object());
// Silently skip JSPropertyOp-implemented accessors.
// Silently skip JSGetterOp/JSSetterOp-implemented accessors.
if (desc.getter() && !desc.hasGetterObject())
return true;
if (desc.setter() && !desc.hasSetterObject())
@ -3251,7 +3252,7 @@ js::GetOwnPropertyDescriptor(JSContext *cx, HandleObject obj, HandleId id,
desc.setSetterObject(shape->setterObject());
} else {
// This is either a straight-up data property or (rarely) a
// property with a JSPropertyOp getter/setter. The latter must be
// property with a JSGetterOp/JSSetterOp. The latter must be
// reported to the caller as a plain data property, so don't
// populate desc.getter/setter, and mask away the SHARED bit.
desc.attributesRef() &= ~JSPROP_SHARED;
@ -3268,7 +3269,7 @@ js::GetOwnPropertyDescriptor(JSContext *cx, HandleObject obj, HandleId id,
bool
js::DefineProperty(ExclusiveContext *cx, HandleObject obj, HandleId id, HandleValue value,
JSPropertyOp getter, JSStrictPropertyOp setter, unsigned attrs)
JSGetterOp getter, JSSetterOp setter, unsigned attrs)
{
MOZ_ASSERT(getter != JS_PropertyStub);
MOZ_ASSERT(setter != JS_StrictPropertyStub);
@ -3286,7 +3287,7 @@ js::DefineProperty(ExclusiveContext *cx, HandleObject obj, HandleId id, HandleVa
bool
js::DefineProperty(ExclusiveContext *cx, HandleObject obj,
PropertyName *name, HandleValue value,
JSPropertyOp getter, JSStrictPropertyOp setter, unsigned attrs)
JSGetterOp getter, JSSetterOp setter, unsigned attrs)
{
RootedId id(cx, NameToId(name));
return DefineProperty(cx, obj, id, value, getter, setter, attrs);
@ -3294,7 +3295,7 @@ js::DefineProperty(ExclusiveContext *cx, HandleObject obj,
bool
js::DefineElement(ExclusiveContext *cx, HandleObject obj, uint32_t index, HandleValue value,
JSPropertyOp getter, JSStrictPropertyOp setter, unsigned attrs)
JSGetterOp getter, JSSetterOp setter, unsigned attrs)
{
MOZ_ASSERT(getter != JS_PropertyStub);
MOZ_ASSERT(setter != JS_StrictPropertyStub);

View File

@ -45,25 +45,25 @@ class RelocationOverlay;
}
inline JSObject *
CastAsObject(PropertyOp op)
CastAsObject(GetterOp op)
{
return JS_FUNC_TO_DATA_PTR(JSObject *, op);
}
inline JSObject *
CastAsObject(StrictPropertyOp op)
CastAsObject(SetterOp op)
{
return JS_FUNC_TO_DATA_PTR(JSObject *, op);
}
inline Value
CastAsObjectJsval(PropertyOp op)
CastAsObjectJsval(GetterOp op)
{
return ObjectOrNullValue(CastAsObject(op));
}
inline Value
CastAsObjectJsval(StrictPropertyOp op)
CastAsObjectJsval(SetterOp op)
{
return ObjectOrNullValue(CastAsObject(op));
}
@ -763,20 +763,20 @@ StandardDefineProperty(JSContext *cx, HandleObject obj, HandleId id,
extern bool
DefineProperty(ExclusiveContext *cx, HandleObject obj, HandleId id, HandleValue value,
JSPropertyOp getter = nullptr,
JSStrictPropertyOp setter = nullptr,
JSGetterOp getter = nullptr,
JSSetterOp setter = nullptr,
unsigned attrs = JSPROP_ENUMERATE);
extern bool
DefineProperty(ExclusiveContext *cx, HandleObject obj, PropertyName *name, HandleValue value,
JSPropertyOp getter = nullptr,
JSStrictPropertyOp setter = nullptr,
JSGetterOp getter = nullptr,
JSSetterOp setter = nullptr,
unsigned attrs = JSPROP_ENUMERATE);
extern bool
DefineElement(ExclusiveContext *cx, HandleObject obj, uint32_t index, HandleValue value,
JSPropertyOp getter = nullptr,
JSStrictPropertyOp setter = nullptr,
JSGetterOp getter = nullptr,
JSSetterOp setter = nullptr,
unsigned attrs = JSPROP_ENUMERATE);
/*

View File

@ -282,13 +282,13 @@ Shape::fixupShapeTreeAfterMovingGC()
if (IsForwarded(unowned))
unowned = Forwarded(unowned);
PropertyOp getter = key->getter();
GetterOp getter = key->getter();
if (key->hasGetterObject())
getter = PropertyOp(MaybeForwarded(key->getterObject()));
getter = GetterOp(MaybeForwarded(key->getterObject()));
StrictPropertyOp setter = key->setter();
SetterOp setter = key->setter();
if (key->hasSetterObject())
setter = StrictPropertyOp(MaybeForwarded(key->setterObject()));
setter = SetterOp(MaybeForwarded(key->setterObject()));
StackShape lookup(unowned,
const_cast<Shape *>(key)->propidRef(),

View File

@ -198,12 +198,12 @@
** Macros to convert between function and data pointers of the same
** size. Use them like this:
**
** JSPropertyOp nativeGetter;
** JSGetterOp nativeGetter;
** JSObject *scriptedGetter;
** ...
** scriptedGetter = JS_FUNC_TO_DATA_PTR(JSObject *, nativeGetter);
** ...
** nativeGetter = JS_DATA_TO_FUNC_PTR(JSPropertyOp, scriptedGetter);
** nativeGetter = JS_DATA_TO_FUNC_PTR(JSGetterOp, scriptedGetter);
**
***********************************************************************/

View File

@ -68,7 +68,7 @@ BaseProxyHandler::get(JSContext *cx, HandleObject proxy, HandleObject receiver,
else
vp.setUndefined();
return CallJSPropertyOp(cx, desc.getter(), receiver, id, vp);
return CallJSGetterOp(cx, desc.getter(), receiver, id, vp);
}
bool
@ -115,7 +115,7 @@ BaseProxyHandler::set(JSContext *cx, HandleObject proxy, HandleObject receiver,
}
// Nonstandard SpiderMonkey special case: setter ops.
StrictPropertyOp setter = ownDesc.setter();
SetterOp setter = ownDesc.setter();
MOZ_ASSERT(setter != JS_StrictPropertyStub);
if (setter && setter != JS_StrictPropertyStub)
return CallSetter(cx, receiver, id, setter, ownDesc.attributes(), strict, vp);

View File

@ -551,7 +551,7 @@ js::proxy_LookupProperty(JSContext *cx, HandleObject obj, HandleId id,
bool
js::proxy_DefineProperty(JSContext *cx, HandleObject obj, HandleId id, HandleValue value,
PropertyOp getter, StrictPropertyOp setter, unsigned attrs)
GetterOp getter, SetterOp setter, unsigned attrs)
{
Rooted<PropertyDescriptor> desc(cx);
desc.object().set(obj);

View File

@ -478,8 +478,8 @@ strictargs_resolve(JSContext *cx, HandleObject obj, HandleId id, bool *resolvedp
Rooted<StrictArgumentsObject*> argsobj(cx, &obj->as<StrictArgumentsObject>());
unsigned attrs = JSPROP_SHARED | JSPROP_SHADOWABLE;
PropertyOp getter = StrictArgGetter;
StrictPropertyOp setter = StrictArgSetter;
GetterOp getter = StrictArgGetter;
SetterOp setter = StrictArgSetter;
if (JSID_IS_INT(id)) {
uint32_t arg = uint32_t(JSID_TO_INT(id));
@ -495,8 +495,8 @@ strictargs_resolve(JSContext *cx, HandleObject obj, HandleId id, bool *resolvedp
return true;
attrs = JSPROP_PERMANENT | JSPROP_GETTER | JSPROP_SETTER | JSPROP_SHARED;
getter = CastAsPropertyOp(argsobj->global().getThrowTypeError());
setter = CastAsStrictPropertyOp(argsobj->global().getThrowTypeError());
getter = CastAsGetterOp(argsobj->global().getThrowTypeError());
setter = CastAsSetterOp(argsobj->global().getThrowTypeError());
}
if (!NativeDefineProperty(cx, argsobj, id, UndefinedHandleValue, getter, setter, attrs))

View File

@ -1554,7 +1554,7 @@ js::InitArrayBufferClass(JSContext *cx, HandleObject obj)
return nullptr;
if (!NativeDefineProperty(cx, arrayBufferProto, byteLengthId, UndefinedHandleValue,
JS_DATA_TO_FUNC_PTR(PropertyOp, getter), nullptr, attrs))
JS_DATA_TO_FUNC_PTR(GetterOp, getter), nullptr, attrs))
return nullptr;
if (!JS_DefineFunctions(cx, ctor, ArrayBufferObject::jsstaticfuncs))

View File

@ -5848,7 +5848,7 @@ DebuggerFrame_getArguments(JSContext *cx, unsigned argc, Value *vp)
id = INT_TO_JSID(i);
if (!getobj ||
!NativeDefineProperty(cx, argsobj, id, UndefinedHandleValue,
JS_DATA_TO_FUNC_PTR(PropertyOp, getobj.get()), nullptr,
JS_DATA_TO_FUNC_PTR(GetterOp, getobj.get()), nullptr,
JSPROP_ENUMERATE | JSPROP_SHARED | JSPROP_GETTER))
{
return false;

View File

@ -4033,20 +4033,20 @@ js::InitGetterSetterOperation(JSContext *cx, jsbytecode *pc, HandleObject obj, H
HandleObject val)
{
MOZ_ASSERT(val->isCallable());
PropertyOp getter;
StrictPropertyOp setter;
GetterOp getter;
SetterOp setter;
unsigned attrs = JSPROP_ENUMERATE | JSPROP_SHARED;
JSOp op = JSOp(*pc);
if (op == JSOP_INITPROP_GETTER || op == JSOP_INITELEM_GETTER) {
getter = CastAsPropertyOp(val);
getter = CastAsGetterOp(val);
setter = nullptr;
attrs |= JSPROP_GETTER;
} else {
MOZ_ASSERT(op == JSOP_INITPROP_SETTER || op == JSOP_INITELEM_SETTER);
getter = nullptr;
setter = CastAsStrictPropertyOp(val);
setter = CastAsSetterOp(val);
attrs |= JSPROP_SETTER;
}

View File

@ -600,7 +600,7 @@ NativeLookupProperty(ExclusiveContext *cx, HandleNativeObject obj, PropertyName
inline bool
NativeDefineProperty(ExclusiveContext *cx, HandleNativeObject obj, PropertyName *name,
HandleValue value, PropertyOp getter, StrictPropertyOp setter,
HandleValue value, GetterOp getter, SetterOp setter,
unsigned attrs)
{
MOZ_ASSERT(getter != JS_PropertyStub);

View File

@ -1047,17 +1047,19 @@ static inline bool
CallAddPropertyHook(ExclusiveContext *cx, HandleNativeObject obj, HandleShape shape,
HandleValue nominal)
{
if (JSPropertyOp addProperty = obj->getClass()->addProperty) {
if (JSAddPropertyOp addProperty = obj->getClass()->addProperty) {
MOZ_ASSERT(addProperty != JS_PropertyStub);
if (!cx->shouldBeJSContext())
return false;
/* Make a local copy of value so addProperty can mutate its inout parameter. */
// Make a local copy of value so addProperty can mutate its inout parameter.
RootedValue value(cx, nominal);
// Use CallJSGetterOp, since JSGetterOp and JSAddPropertyOp happen to
// have all the same argument types.
Rooted<jsid> id(cx, shape->propid());
if (!CallJSPropertyOp(cx->asJSContext(), addProperty, obj, id, &value)) {
if (!CallJSGetterOp(cx->asJSContext(), addProperty, obj, id, &value)) {
obj->removeProperty(cx, shape->propid());
return false;
}
@ -1073,7 +1075,7 @@ static inline bool
CallAddPropertyHookDense(ExclusiveContext *cx, HandleNativeObject obj, uint32_t index,
HandleValue nominal)
{
/* Inline addProperty for array objects. */
// Inline addProperty for array objects.
if (obj->is<ArrayObject>()) {
ArrayObject *arr = &obj->as<ArrayObject>();
uint32_t length = arr->length();
@ -1082,7 +1084,7 @@ CallAddPropertyHookDense(ExclusiveContext *cx, HandleNativeObject obj, uint32_t
return true;
}
if (JSPropertyOp addProperty = obj->getClass()->addProperty) {
if (JSAddPropertyOp addProperty = obj->getClass()->addProperty) {
MOZ_ASSERT(addProperty != JS_PropertyStub);
if (!cx->shouldBeJSContext())
@ -1091,11 +1093,13 @@ CallAddPropertyHookDense(ExclusiveContext *cx, HandleNativeObject obj, uint32_t
if (!obj->maybeCopyElementsForWrite(cx))
return false;
/* Make a local copy of value so addProperty can mutate its inout parameter. */
// Make a local copy of value so addProperty can mutate its inout parameter.
RootedValue value(cx, nominal);
// Use CallJSGetterOp, since JSGetterOp and JSAddPropertyOp happen to
// have all the same argument types.
Rooted<jsid> id(cx, INT_TO_JSID(index));
if (!CallJSPropertyOp(cx->asJSContext(), addProperty, obj, id, &value)) {
if (!CallJSGetterOp(cx->asJSContext(), addProperty, obj, id, &value)) {
obj->setDenseElementHole(cx, index);
return false;
}
@ -1134,8 +1138,7 @@ NativeSet(JSContext *cx, HandleNativeObject obj, HandleObject receiver,
static inline bool
DefinePropertyOrElement(ExclusiveContext *cx, HandleNativeObject obj, HandleId id,
PropertyOp getter, StrictPropertyOp setter,
unsigned attrs, HandleValue value,
GetterOp getter, SetterOp setter, unsigned attrs, HandleValue value,
bool callSetterAfterwards, bool setterIsStrict)
{
MOZ_ASSERT(getter != JS_PropertyStub);
@ -1315,7 +1318,7 @@ PurgeScopeChain(ExclusiveContext *cx, HandleObject obj, HandleId id)
*/
static inline bool
CheckAccessorRedefinition(ExclusiveContext *cx, HandleObject obj, HandleShape shape,
PropertyOp getter, StrictPropertyOp setter, HandleId id, unsigned attrs)
GetterOp getter, SetterOp setter, HandleId id, unsigned attrs)
{
MOZ_ASSERT(shape->isAccessorDescriptor());
if (shape->configurable() || (getter == shape->getter() && setter == shape->setter()))
@ -1342,7 +1345,7 @@ CheckAccessorRedefinition(ExclusiveContext *cx, HandleObject obj, HandleShape sh
bool
js::NativeDefineProperty(ExclusiveContext *cx, HandleNativeObject obj, HandleId id, HandleValue value,
PropertyOp getter, StrictPropertyOp setter, unsigned attrs)
GetterOp getter, SetterOp setter, unsigned attrs)
{
MOZ_ASSERT(getter != JS_PropertyStub);
MOZ_ASSERT(setter != JS_StrictPropertyStub);
@ -1548,7 +1551,7 @@ js::NativeLookupElement(JSContext *cx, HandleNativeObject obj, uint32_t index,
bool
js::NativeDefineElement(ExclusiveContext *cx, HandleNativeObject obj, uint32_t index, HandleValue value,
PropertyOp getter, StrictPropertyOp setter, unsigned attrs)
GetterOp getter, SetterOp setter, unsigned attrs)
{
RootedId id(cx);
if (index <= JSID_INT_MAX) {
@ -1629,7 +1632,7 @@ CallGetter(JSContext* cx, HandleObject receiver, HandleShape shape, MutableHandl
}
RootedId id(cx, shape->propid());
return CallJSPropertyOp(cx, shape->getterOp(), receiver, id, vp);
return CallJSGetterOp(cx, shape->getterOp(), receiver, id, vp);
}
template <AllowGC allowGC>
@ -1763,8 +1766,8 @@ GetNonexistentProperty(JSContext *cx, HandleNativeObject obj, HandleId id,
// Non-standard extension: Call the getProperty hook. If it sets vp to a
// value other than undefined, we're done. If not, fall through to the
// warning/error checks below.
if (JSPropertyOp getProperty = obj->getClass()->getProperty) {
if (!CallJSPropertyOp(cx, getProperty, obj, id, vp))
if (JSGetterOp getProperty = obj->getClass()->getProperty) {
if (!CallJSGetterOp(cx, getProperty, obj, id, vp))
return false;
if (!vp.isUndefined())
@ -2016,8 +2019,8 @@ js::SetPropertyByDefining(JSContext *cx, HandleObject obj, HandleObject receiver
existing
? JSPROP_IGNORE_ENUMERATE | JSPROP_IGNORE_READONLY | JSPROP_IGNORE_PERMANENT
: JSPROP_ENUMERATE;
JSPropertyOp getter = clasp->getProperty;
JSStrictPropertyOp setter = clasp->setProperty;
JSGetterOp getter = clasp->getProperty;
JSSetterOp setter = clasp->setProperty;
MOZ_ASSERT(getter != JS_PropertyStub);
MOZ_ASSERT(setter != JS_StrictPropertyStub);
if (!receiver->is<NativeObject>())

View File

@ -666,7 +666,7 @@ class NativeObject : public JSObject
public:
/* Add a property whose id is not yet in this scope. */
static Shape *addProperty(ExclusiveContext *cx, HandleNativeObject obj, HandleId id,
JSPropertyOp getter, JSStrictPropertyOp setter,
JSGetterOp getter, JSSetterOp setter,
uint32_t slot, unsigned attrs, unsigned flags,
bool allowDictionary = true);
@ -679,12 +679,12 @@ class NativeObject : public JSObject
/* Add or overwrite a property for id in this scope. */
static Shape *
putProperty(ExclusiveContext *cx, HandleNativeObject obj, HandleId id,
JSPropertyOp getter, JSStrictPropertyOp setter,
JSGetterOp getter, JSSetterOp setter,
uint32_t slot, unsigned attrs,
unsigned flags);
static inline Shape *
putProperty(ExclusiveContext *cx, HandleObject obj, PropertyName *name,
JSPropertyOp getter, JSStrictPropertyOp setter,
JSGetterOp getter, JSSetterOp setter,
uint32_t slot, unsigned attrs,
unsigned flags);
@ -692,7 +692,7 @@ class NativeObject : public JSObject
static Shape *
changeProperty(ExclusiveContext *cx, HandleNativeObject obj,
HandleShape shape, unsigned attrs, unsigned mask,
JSPropertyOp getter, JSStrictPropertyOp setter);
JSGetterOp getter, JSSetterOp setter);
static inline bool changePropertyAttributes(JSContext *cx, HandleNativeObject obj,
HandleShape shape, unsigned attrs);
@ -713,9 +713,8 @@ class NativeObject : public JSObject
*/
static Shape *
addPropertyInternal(ExclusiveContext *cx, HandleNativeObject obj, HandleId id,
JSPropertyOp getter, JSStrictPropertyOp setter,
uint32_t slot, unsigned attrs, unsigned flags, ShapeTable::Entry *entry,
bool allowDictionary);
JSGetterOp getter, JSSetterOp setter, uint32_t slot, unsigned attrs,
unsigned flags, ShapeTable::Entry *entry, bool allowDictionary);
void fillInAfterSwap(JSContext *cx, const Vector<Value> &values, void *priv);
@ -1254,16 +1253,16 @@ IsObjectValueInCompartment(Value v, JSCompartment *comp)
extern bool
NativeDefineProperty(ExclusiveContext *cx, HandleNativeObject obj, HandleId id, HandleValue value,
JSPropertyOp getter, JSStrictPropertyOp setter, unsigned attrs);
JSGetterOp getter, JSSetterOp setter, unsigned attrs);
inline bool
NativeDefineProperty(ExclusiveContext *cx, HandleNativeObject obj, PropertyName *name,
HandleValue value, PropertyOp getter, StrictPropertyOp setter,
HandleValue value, GetterOp getter, SetterOp setter,
unsigned attrs);
extern bool
NativeDefineElement(ExclusiveContext *cx, HandleNativeObject obj, uint32_t index, HandleValue value,
JSPropertyOp getter, JSStrictPropertyOp setter, unsigned attrs);
JSGetterOp getter, JSSetterOp setter, unsigned attrs);
extern bool
NativeHasProperty(JSContext *cx, HandleNativeObject obj, HandleId id, bool *foundp);

View File

@ -12,16 +12,16 @@
namespace js {
static inline JSPropertyOp
CastAsPropertyOp(JSObject *object)
static inline JSGetterOp
CastAsGetterOp(JSObject *object)
{
return JS_DATA_TO_FUNC_PTR(JSPropertyOp, object);
return JS_DATA_TO_FUNC_PTR(JSGetterOp, object);
}
static inline JSStrictPropertyOp
CastAsStrictPropertyOp(JSObject *object)
static inline JSSetterOp
CastAsSetterOp(JSObject *object)
{
return JS_DATA_TO_FUNC_PTR(JSStrictPropertyOp, object);
return JS_DATA_TO_FUNC_PTR(JSSetterOp, object);
}
/*
@ -213,11 +213,11 @@ struct PropDesc {
* Unfortunately the values produced by these methods are used such that
* we can't assert anything here. :-(
*/
JSPropertyOp getter() const {
return CastAsPropertyOp(get_.isUndefined() ? nullptr : &get_.toObject());
JSGetterOp getter() const {
return CastAsGetterOp(get_.isUndefined() ? nullptr : &get_.toObject());
}
JSStrictPropertyOp setter() const {
return CastAsStrictPropertyOp(set_.isUndefined() ? nullptr : &set_.toObject());
JSSetterOp setter() const {
return CastAsSetterOp(set_.isUndefined() ? nullptr : &set_.toObject());
}
/*
@ -263,8 +263,8 @@ class PropDescOperations
HandleValue getterValue() const { return desc()->getterValue(); }
HandleValue setterValue() const { return desc()->setterValue(); }
JSPropertyOp getter() const { return desc()->getter(); }
JSStrictPropertyOp setter() const { return desc()->setter(); }
JSGetterOp getter() const { return desc()->getter(); }
JSSetterOp setter() const { return desc()->setter(); }
void populatePropertyDescriptor(HandleObject obj,
MutableHandle<JSPropertyDescriptor> descriptor) const {

View File

@ -347,8 +347,8 @@ DeclEnvObject::createTemplateObject(JSContext *cx, HandleFunction fun, gc::Initi
const Class *clasp = obj->getClass();
unsigned attrs = JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY;
JSPropertyOp getter = clasp->getProperty;
JSStrictPropertyOp setter = clasp->setProperty;
JSGetterOp getter = clasp->getProperty;
JSSetterOp setter = clasp->setProperty;
MOZ_ASSERT(getter != JS_PropertyStub);
MOZ_ASSERT(setter != JS_StrictPropertyStub);
@ -471,7 +471,7 @@ with_LookupProperty(JSContext *cx, HandleObject obj, HandleId id,
static bool
with_DefineProperty(JSContext *cx, HandleObject obj, HandleId id, HandleValue value,
JSPropertyOp getter, JSStrictPropertyOp setter, unsigned attrs)
JSGetterOp getter, JSSetterOp setter, unsigned attrs)
{
RootedObject actual(cx, &obj->as<DynamicWithObject>().object());
return DefineProperty(cx, actual, id, value, getter, setter, attrs);

View File

@ -59,7 +59,7 @@ Shape::set(JSContext* cx, HandleNativeObject obj, HandleObject receiver, bool st
return true;
RootedId id(cx, propid());
return CallJSPropertyOpSetter(cx, setterOp(), obj, id, strict, vp);
return CallJSSetterOp(cx, setterOp(), obj, id, strict, vp);
}
/* static */ inline Shape *
@ -158,7 +158,7 @@ EmptyShape::ensureInitialCustomShape(ExclusiveContext *cx, Handle<ObjectSubclass
inline
AutoRooterGetterSetter::Inner::Inner(ExclusiveContext *cx, uint8_t attrs,
PropertyOp *pgetter_, StrictPropertyOp *psetter_)
GetterOp *pgetter_, SetterOp *psetter_)
: CustomAutoRooter(cx), attrs(attrs),
pgetter(pgetter_), psetter(psetter_)
{
@ -168,7 +168,7 @@ AutoRooterGetterSetter::Inner::Inner(ExclusiveContext *cx, uint8_t attrs,
inline
AutoRooterGetterSetter::AutoRooterGetterSetter(ExclusiveContext *cx, uint8_t attrs,
PropertyOp *pgetter, StrictPropertyOp *psetter
GetterOp *pgetter, SetterOp *psetter
MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
{
if (attrs & (JSPROP_GETTER | JSPROP_SETTER))
@ -182,8 +182,8 @@ AutoRooterGetterSetter::AutoRooterGetterSetter(ExclusiveContext *cx, uint8_t att
MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
{
if (attrs & (JSPROP_GETTER | JSPROP_SETTER)) {
inner.emplace(cx, attrs, reinterpret_cast<PropertyOp *>(pgetter),
reinterpret_cast<StrictPropertyOp *>(psetter));
inner.emplace(cx, attrs, reinterpret_cast<GetterOp *>(pgetter),
reinterpret_cast<SetterOp *>(psetter));
}
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}

View File

@ -473,8 +473,7 @@ js::NativeObject::toDictionaryMode(ExclusiveContext *cx)
/* static */ Shape *
NativeObject::addProperty(ExclusiveContext *cx, HandleNativeObject obj, HandleId id,
PropertyOp getter, StrictPropertyOp setter,
uint32_t slot, unsigned attrs,
GetterOp getter, SetterOp setter, uint32_t slot, unsigned attrs,
unsigned flags, bool allowDictionary)
{
MOZ_ASSERT(!JSID_IS_VOID(id));
@ -513,7 +512,7 @@ ShouldConvertToDictionary(NativeObject *obj)
/* static */ Shape *
NativeObject::addPropertyInternal(ExclusiveContext *cx,
HandleNativeObject obj, HandleId id,
PropertyOp getter, StrictPropertyOp setter,
GetterOp getter, SetterOp setter,
uint32_t slot, unsigned attrs,
unsigned flags, ShapeTable::Entry *entry,
bool allowDictionary)
@ -679,8 +678,8 @@ CheckCanChangeAttrs(ExclusiveContext *cx, JSObject *obj, Shape *shape, unsigned
/* static */ Shape *
NativeObject::putProperty(ExclusiveContext *cx, HandleNativeObject obj, HandleId id,
PropertyOp getter, StrictPropertyOp setter,
uint32_t slot, unsigned attrs, unsigned flags)
GetterOp getter, SetterOp setter, uint32_t slot, unsigned attrs,
unsigned flags)
{
MOZ_ASSERT(!JSID_IS_VOID(id));
MOZ_ASSERT(getter != JS_PropertyStub);
@ -868,9 +867,8 @@ NativeObject::putProperty(ExclusiveContext *cx, HandleNativeObject obj, HandleId
}
/* static */ Shape *
NativeObject::changeProperty(ExclusiveContext *cx, HandleNativeObject obj,
HandleShape shape, unsigned attrs,
unsigned mask, PropertyOp getter, StrictPropertyOp setter)
NativeObject::changeProperty(ExclusiveContext *cx, HandleNativeObject obj, HandleShape shape,
unsigned attrs, unsigned mask, GetterOp getter, SetterOp setter)
{
MOZ_ASSERT(obj->containsPure(shape));
MOZ_ASSERT(getter != JS_PropertyStub);

View File

@ -115,8 +115,8 @@ class Debugger;
class Nursery;
class StaticBlockObject;
typedef JSPropertyOp PropertyOp;
typedef JSStrictPropertyOp StrictPropertyOp;
typedef JSGetterOp GetterOp;
typedef JSSetterOp SetterOp;
typedef JSPropertyDescriptor PropertyDescriptor;
/* Limit on the number of slotful properties in an object. */
@ -893,9 +893,9 @@ class Shape : public gc::TenuredCell
return (flags & IN_DICTIONARY) != 0;
}
inline PropertyOp getter() const;
inline GetterOp getter() const;
bool hasDefaultGetter() const { return !getter(); }
PropertyOp getterOp() const { MOZ_ASSERT(!hasGetterValue()); return getter(); }
GetterOp getterOp() const { MOZ_ASSERT(!hasGetterValue()); return getter(); }
inline JSObject *getterObject() const;
bool hasGetterObject() const { return hasGetterValue() && getterObject(); }
@ -911,9 +911,9 @@ class Shape : public gc::TenuredCell
return hasGetterValue() ? getterValue() : UndefinedValue();
}
inline StrictPropertyOp setter() const;
inline SetterOp setter() const;
bool hasDefaultSetter() const { return !setter(); }
StrictPropertyOp setterOp() const { MOZ_ASSERT(!hasSetterValue()); return setter(); }
SetterOp setterOp() const { MOZ_ASSERT(!hasSetterValue()); return setter(); }
inline JSObject *setterObject() const;
bool hasSetterObject() const { return hasSetterValue() && setterObject(); }
@ -936,7 +936,7 @@ class Shape : public gc::TenuredCell
return flags & OVERWRITTEN;
}
void update(PropertyOp getter, StrictPropertyOp setter, uint8_t attrs);
void update(GetterOp getter, SetterOp setter, uint8_t attrs);
bool matches(const Shape *other) const {
return propid_.get() == other->propid_.get() &&
@ -947,7 +947,7 @@ class Shape : public gc::TenuredCell
inline bool matches(const StackShape &other) const;
bool matchesParamsAfterId(BaseShape *base, uint32_t aslot, unsigned aattrs, unsigned aflags,
PropertyOp rawGetter, StrictPropertyOp rawSetter) const
GetterOp rawGetter, SetterOp rawSetter) const
{
return base->unowned() == this->base()->unowned() &&
maybeSlot() == aslot &&
@ -1049,7 +1049,7 @@ class Shape : public gc::TenuredCell
}
/*
* For ES5 compatibility, we allow properties with PropertyOp-flavored
* For ES5 compatibility, we allow properties with SetterOp-flavored
* setters to be shadowed when set. The "own" property thereby created in
* the directly referenced object will have the same getter and setter as
* the prototype property. See bug 552432.
@ -1122,14 +1122,14 @@ class AccessorShape : public Shape
friend class NativeObject;
union {
PropertyOp rawGetter; /* getter hook for shape */
JSObject *getterObj; /* user-defined callable "get" object or
null if shape->hasGetterValue() */
GetterOp rawGetter; /* getter hook for shape */
JSObject *getterObj; /* user-defined callable "get" object or
null if shape->hasGetterValue() */
};
union {
StrictPropertyOp rawSetter; /* setter hook for shape */
JSObject *setterObj; /* user-defined callable "set" object or
null if shape->hasSetterValue() */
SetterOp rawSetter; /* setter hook for shape */
JSObject *setterObj; /* user-defined callable "set" object or
null if shape->hasSetterValue() */
};
public:
@ -1151,20 +1151,19 @@ class AutoRooterGetterSetter
class Inner : private JS::CustomAutoRooter
{
public:
inline Inner(ExclusiveContext *cx, uint8_t attrs,
PropertyOp *pgetter_, StrictPropertyOp *psetter_);
inline Inner(ExclusiveContext *cx, uint8_t attrs, GetterOp *pgetter_, SetterOp *psetter_);
private:
virtual void trace(JSTracer *trc);
uint8_t attrs;
PropertyOp *pgetter;
StrictPropertyOp *psetter;
GetterOp *pgetter;
SetterOp *psetter;
};
public:
inline AutoRooterGetterSetter(ExclusiveContext *cx, uint8_t attrs,
PropertyOp *pgetter, StrictPropertyOp *psetter
GetterOp *pgetter, SetterOp *psetter
MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
inline AutoRooterGetterSetter(ExclusiveContext *cx, uint8_t attrs,
JSNative *pgetter, JSNative *psetter
@ -1291,12 +1290,12 @@ struct StackShape
{
/* For performance, StackShape only roots when absolutely necessary. */
UnownedBaseShape *base;
jsid propid;
PropertyOp rawGetter;
StrictPropertyOp rawSetter;
uint32_t slot_;
uint8_t attrs;
uint8_t flags;
jsid propid;
GetterOp rawGetter;
SetterOp rawSetter;
uint32_t slot_;
uint8_t attrs;
uint8_t flags;
explicit StackShape(UnownedBaseShape *base, jsid propid, uint32_t slot,
unsigned attrs, unsigned flags)
@ -1324,7 +1323,7 @@ struct StackShape
flags(shape->flags)
{}
void updateGetterSetter(PropertyOp rawGetter, StrictPropertyOp rawSetter) {
void updateGetterSetter(GetterOp rawGetter, SetterOp rawSetter) {
MOZ_ASSERT_IF((attrs & JSPROP_GETTER) && rawGetter, !IsPoisonedPtr(rawGetter));
MOZ_ASSERT_IF((attrs & JSPROP_SETTER) && rawSetter, !IsPoisonedPtr(rawSetter));
@ -1419,13 +1418,13 @@ Shape::Shape(UnownedBaseShape *base, uint32_t nfixed)
kids.setNull();
}
inline PropertyOp
inline GetterOp
Shape::getter() const
{
return isAccessorShape() ? asAccessorShape().rawGetter : nullptr;
}
inline StrictPropertyOp
inline SetterOp
Shape::setter() const
{
return isAccessorShape() ? asAccessorShape().rawSetter : nullptr;

View File

@ -351,7 +351,7 @@ js::InitSharedArrayBufferClass(JSContext *cx, HandleObject obj)
return nullptr;
if (!NativeDefineProperty(cx, proto, byteLengthId, UndefinedHandleValue,
JS_DATA_TO_FUNC_PTR(PropertyOp, getter), nullptr, attrs))
JS_DATA_TO_FUNC_PTR(GetterOp, getter), nullptr, attrs))
return nullptr;
if (!JS_DefineFunctions(cx, ctor, SharedArrayBufferObject::jsstaticfuncs))

View File

@ -356,7 +356,7 @@ class SharedTypedArrayObjectTemplate : public SharedTypedArrayObject
return false;
return NativeDefineProperty(cx, proto, id, UndefinedHandleValue,
JS_DATA_TO_FUNC_PTR(PropertyOp, getter), nullptr,
JS_DATA_TO_FUNC_PTR(GetterOp, getter), nullptr,
attrs);
}
@ -591,7 +591,7 @@ const JSFunctionSpec Shared##_typedArray##Object::jsfuncs[] = {
B2G ICS. Older GCC versions have a bug in which they fail to compile \
reinterpret_casts of templated functions with the message: "insufficient \
contextual information to determine type". JS_PSG needs to \
reinterpret_cast<JSPropertyOp>, so this causes problems for us here. \
reinterpret_cast<JSGetterOp>, so this causes problems for us here. \
\
We could restructure all this code to make this nicer, but since ICS isn't \
going to be around forever (and since this bug is fixed with the newer GCC \

View File

@ -718,7 +718,7 @@ FinishTypedArrayInit(JSContext *cx, HandleObject ctor, HandleObject proto)
* B2G ICS. Older GCC versions have a bug in which they fail to compile
* reinterpret_casts of templated functions with the message: "insufficient
* contextual information to determine type". JS_PSG needs to
* reinterpret_cast<JSPropertyOp>, so this causes problems for us here.
* reinterpret_cast<JSGetterOp>, so this causes problems for us here.
*
* We could restructure all this code to make this nicer, but since ICS isn't
* going to be around forever (and since this bug is fixed with the newer GCC
@ -1950,7 +1950,7 @@ DataViewObject::defineGetter(JSContext *cx, PropertyName *name, HandleNativeObje
return false;
return NativeDefineProperty(cx, proto, id, UndefinedHandleValue,
JS_DATA_TO_FUNC_PTR(PropertyOp, getter), nullptr, attrs);
JS_DATA_TO_FUNC_PTR(GetterOp, getter), nullptr, attrs);
}
/* static */ bool

View File

@ -358,7 +358,7 @@ UnboxedPlainObject::obj_lookupProperty(JSContext *cx, HandleObject obj,
/* static */ bool
UnboxedPlainObject::obj_defineProperty(JSContext *cx, HandleObject obj, HandleId id, HandleValue v,
PropertyOp getter, StrictPropertyOp setter, unsigned attrs)
GetterOp getter, SetterOp setter, unsigned attrs)
{
if (!convertToNative(cx, obj))
return false;

View File

@ -165,7 +165,7 @@ class UnboxedPlainObject : public JSObject
MutableHandleShape propp);
static bool obj_defineProperty(JSContext *cx, HandleObject obj, HandleId id, HandleValue v,
PropertyOp getter, StrictPropertyOp setter, unsigned attrs);
GetterOp getter, SetterOp setter, unsigned attrs);
static bool obj_hasProperty(JSContext *cx, HandleObject obj, HandleId id, bool *foundp);

View File

@ -29,7 +29,6 @@ class nsAXPCNativeCallContext;
[ptr] native JSFreeOpPtr(JSFreeOp);
[ptr] native JSObjectPtr(JSObject);
[ptr] native JSValConstPtr(const JS::Value);
native JSPropertyOp(JSPropertyOp);
native JSEqualityOp(JSEqualityOp);
[ptr] native JSScriptPtr(JSScript);
[ptr] native voidPtrPtr(void*);
@ -55,13 +54,13 @@ interface nsIObjectInputStream;
interface nsIObjectOutputStream;
/***************************************************************************/
[uuid(909e8641-7c54-4dff-9b94-ba631f057b33)]
[uuid(73e6ff4a-ab99-4d99-ac00-ba39ccb8e4d7)]
interface nsIXPConnectJSObjectHolder : nsISupports
{
[notxpcom, nostdcall] JSObjectPtr GetJSObject();
};
[uuid(cf6b00de-8ff4-443a-932c-b72ff341367a)]
[uuid(e787be29-db5d-4a45-a3d6-1de1d6b85c30)]
interface nsIXPConnectWrappedNative : nsIXPConnectJSObjectHolder
{
/* attribute 'JSObject' inherited from nsIXPConnectJSObjectHolder */
@ -116,7 +115,7 @@ do_QueryWrappedNative(nsIXPConnectWrappedNative *aWrappedNative,
%}
[uuid(BED52030-BCA6-11d2-BA79-00805F8A5DD7)]
[uuid(3a01b0d6-074b-49ed-bac3-08c76366cae4)]
interface nsIXPConnectWrappedJS : nsIXPConnectJSObjectHolder
{
/* attribute 'JSObject' inherited from nsIXPConnectJSObjectHolder */

View File

@ -998,7 +998,7 @@ XPCNativeScriptableShared::PopulateJSClass()
if (mFlags.IsGlobalObject())
mJSClass.base.flags |= XPCONNECT_GLOBAL_FLAGS;
JSPropertyOp addProperty;
JSAddPropertyOp addProperty;
if (mFlags.WantAddProperty())
addProperty = XPC_WN_Helper_AddProperty;
else if (mFlags.UseJSStubForAddProperty())
@ -1023,7 +1023,7 @@ XPCNativeScriptableShared::PopulateJSClass()
else
mJSClass.base.getProperty = nullptr;
JSStrictPropertyOp setProperty;
JSSetterOp setProperty;
if (mFlags.WantSetProperty())
setProperty = XPC_WN_Helper_SetProperty;
else if (mFlags.UseJSStubForSetProperty())

View File

@ -513,9 +513,9 @@ JSXrayTraits::resolveOwnProperty(JSContext *cx, const Wrapper &jsWrapper,
}
} else {
desc.setGetter(JS_CAST_NATIVE_TO(psMatch->getter.native.op,
JSPropertyOp));
JSGetterOp));
desc.setSetter(JS_CAST_NATIVE_TO(psMatch->setter.native.op,
JSStrictPropertyOp));
JSSetterOp));
}
desc.setAttributes(flags);

View File

@ -303,10 +303,10 @@ SpecialPowersHandler.prototype.doGetPropertyDescriptor = function(name, own) {
if (typeof desc === 'undefined')
return undefined;
// When accessors are implemented as JSPropertyOps rather than JSNatives (ie,
// QuickStubs), the js engine does the wrong thing and treats it as a value
// descriptor rather than an accessor descriptor. Jorendorff suggested this
// little hack to work around it. See bug 520882.
// When accessors are implemented as JSGetterOp/JSSetterOps rather than
// JSNatives (ie, QuickStubs), the js engine does the wrong thing and treats
// it as a value descriptor rather than an accessor descriptor. Jorendorff
// suggested this little hack to work around it. See bug 520882.
if (desc && 'value' in desc && desc.value === undefined)
desc.value = obj[name];