mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset 64aa4c4d0691 (bug 1103368)
This commit is contained in:
parent
1fb6419611
commit
34ba1564db
@ -2550,7 +2550,7 @@ DefineStandardSlot(JSContext *cx, HandleObject obj, JSProtoKey key, JSAtom *atom
|
||||
global->setConstructorPropertySlot(key, v);
|
||||
|
||||
uint32_t slot = GlobalObject::constructorPropertySlot(key);
|
||||
if (!NativeObject::addProperty(cx, global, id, nullptr, nullptr, slot, attrs, 0))
|
||||
if (!NativeObject::addProperty(cx, global, id, JS_PropertyStub, JS_StrictPropertyStub, slot, attrs, 0))
|
||||
return false;
|
||||
|
||||
named = true;
|
||||
|
@ -1272,10 +1272,6 @@ DefinePropertyOrElement(typename ExecutionModeTraits<mode>::ExclusiveContextType
|
||||
|
||||
AutoRooterGetterSetter gsRoot(cx, attrs, &getter, &setter);
|
||||
|
||||
if (getter == JS_PropertyStub)
|
||||
getter = nullptr;
|
||||
if (setter == JS_StrictPropertyStub)
|
||||
setter = nullptr;
|
||||
RootedShape shape(cx, NativeObject::putProperty<mode>(cx, obj, id, getter, setter,
|
||||
SHAPE_INVALID_SLOT, attrs, 0));
|
||||
if (!shape)
|
||||
@ -1302,7 +1298,7 @@ DefinePropertyOrElement(typename ExecutionModeTraits<mode>::ExclusiveContextType
|
||||
if (result == NativeObject::ED_FAILED)
|
||||
return false;
|
||||
if (result == NativeObject::ED_OK) {
|
||||
MOZ_ASSERT(!setter);
|
||||
MOZ_ASSERT(setter == JS_StrictPropertyStub);
|
||||
return CallAddPropertyHookDense<mode>(cx, obj->getClass(), obj, index, value);
|
||||
}
|
||||
}
|
||||
@ -1310,7 +1306,7 @@ DefinePropertyOrElement(typename ExecutionModeTraits<mode>::ExclusiveContextType
|
||||
if (!CallAddPropertyHook<mode>(cx, obj->getClass(), obj, shape, value))
|
||||
return false;
|
||||
|
||||
if (callSetterAfterwards && setter) {
|
||||
if (callSetterAfterwards && setter != JS_StrictPropertyStub) {
|
||||
if (!cx->shouldBeJSContext())
|
||||
return false;
|
||||
RootedValue nvalue(cx, value);
|
||||
@ -1437,10 +1433,6 @@ js::DefineNativeProperty(ExclusiveContext *cx, HandleNativeObject obj, HandleId
|
||||
}
|
||||
if (shape->isAccessorDescriptor()) {
|
||||
attrs = ApplyOrDefaultAttributes(attrs, shape);
|
||||
if (getter == JS_PropertyStub)
|
||||
getter = nullptr;
|
||||
if (setter == JS_StrictPropertyStub)
|
||||
setter = nullptr;
|
||||
shape = NativeObject::changeProperty<SequentialExecution>(cx, obj, shape, attrs,
|
||||
JSPROP_GETTER | JSPROP_SETTER,
|
||||
(attrs & JSPROP_GETTER)
|
||||
|
@ -338,16 +338,8 @@ DeclEnvObject::createTemplateObject(JSContext *cx, HandleFunction fun, gc::Initi
|
||||
Rooted<jsid> id(cx, AtomToId(fun->atom()));
|
||||
const Class *clasp = obj->getClass();
|
||||
unsigned attrs = JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY;
|
||||
|
||||
JSPropertyOp getter = clasp->getProperty;
|
||||
if (getter == JS_PropertyStub)
|
||||
getter = nullptr;
|
||||
JSStrictPropertyOp setter = clasp->setProperty;
|
||||
if (setter == JS_StrictPropertyStub)
|
||||
setter = nullptr;
|
||||
|
||||
if (!NativeObject::putProperty<SequentialExecution>(cx, obj, id, getter, setter, lambdaSlot(),
|
||||
attrs, 0)) {
|
||||
if (!NativeObject::putProperty<SequentialExecution>(cx, obj, id, clasp->getProperty,
|
||||
clasp->setProperty, lambdaSlot(), attrs, 0)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -715,7 +707,7 @@ StaticBlockObject::addVar(ExclusiveContext *cx, Handle<StaticBlockObject*> block
|
||||
|
||||
*redeclared = false;
|
||||
|
||||
/* Inline NativeObject::addProperty in order to trap the redefinition case. */
|
||||
/* Inline JSObject::addProperty in order to trap the redefinition case. */
|
||||
Shape **spp;
|
||||
if (Shape::search(cx, block->lastProperty(), id, &spp, true)) {
|
||||
*redeclared = true;
|
||||
|
@ -500,6 +500,28 @@ js::NativeObject::toDictionaryMode(ThreadSafeContext *cx)
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Normalize stub getter and setter values for faster is-stub testing in the
|
||||
* SHAPE_CALL_[GS]ETTER macros.
|
||||
*/
|
||||
static inline bool
|
||||
NormalizeGetterAndSetter(JSObject *obj,
|
||||
jsid id, unsigned attrs, unsigned flags,
|
||||
PropertyOp &getter,
|
||||
StrictPropertyOp &setter)
|
||||
{
|
||||
if (setter == JS_StrictPropertyStub) {
|
||||
MOZ_ASSERT(!(attrs & JSPROP_SETTER));
|
||||
setter = nullptr;
|
||||
}
|
||||
if (getter == JS_PropertyStub) {
|
||||
MOZ_ASSERT(!(attrs & JSPROP_GETTER));
|
||||
getter = nullptr;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* static */ Shape *
|
||||
NativeObject::addProperty(ExclusiveContext *cx, HandleNativeObject obj, HandleId id,
|
||||
PropertyOp getter, StrictPropertyOp setter,
|
||||
@ -507,8 +529,6 @@ NativeObject::addProperty(ExclusiveContext *cx, HandleNativeObject obj, HandleId
|
||||
unsigned flags, bool allowDictionary)
|
||||
{
|
||||
MOZ_ASSERT(!JSID_IS_VOID(id));
|
||||
MOZ_ASSERT(getter != JS_PropertyStub);
|
||||
MOZ_ASSERT(setter != JS_StrictPropertyStub);
|
||||
|
||||
bool extensible;
|
||||
if (!JSObject::isExtensible(cx, obj, &extensible))
|
||||
@ -519,6 +539,8 @@ NativeObject::addProperty(ExclusiveContext *cx, HandleNativeObject obj, HandleId
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
NormalizeGetterAndSetter(obj, id, attrs, flags, getter, setter);
|
||||
|
||||
Shape **spp = nullptr;
|
||||
if (obj->inDictionaryMode())
|
||||
spp = obj->lastProperty()->table().search(id, true);
|
||||
@ -560,8 +582,6 @@ NativeObject::addPropertyInternal(typename ExecutionModeTraits<mode>::ExclusiveC
|
||||
{
|
||||
MOZ_ASSERT(cx->isThreadLocal(obj));
|
||||
MOZ_ASSERT_IF(!allowDictionary, !obj->inDictionaryMode());
|
||||
MOZ_ASSERT(getter != JS_PropertyStub);
|
||||
MOZ_ASSERT(setter != JS_StrictPropertyStub);
|
||||
|
||||
AutoRooterGetterSetter gsRoot(cx, attrs, &getter, &setter);
|
||||
|
||||
@ -747,8 +767,6 @@ NativeObject::putProperty(typename ExecutionModeTraits<mode>::ExclusiveContextTy
|
||||
{
|
||||
MOZ_ASSERT(cx->isThreadLocal(obj));
|
||||
MOZ_ASSERT(!JSID_IS_VOID(id));
|
||||
MOZ_ASSERT(getter != JS_PropertyStub);
|
||||
MOZ_ASSERT(setter != JS_StrictPropertyStub);
|
||||
|
||||
#ifdef DEBUG
|
||||
if (obj->is<ArrayObject>()) {
|
||||
@ -759,6 +777,8 @@ NativeObject::putProperty(typename ExecutionModeTraits<mode>::ExclusiveContextTy
|
||||
}
|
||||
#endif
|
||||
|
||||
NormalizeGetterAndSetter(obj, id, attrs, flags, getter, setter);
|
||||
|
||||
AutoRooterGetterSetter gsRoot(cx, attrs, &getter, &setter);
|
||||
|
||||
/*
|
||||
@ -962,8 +982,6 @@ NativeObject::changeProperty(typename ExecutionModeTraits<mode>::ExclusiveContex
|
||||
{
|
||||
MOZ_ASSERT(cx->isThreadLocal(obj));
|
||||
MOZ_ASSERT(obj->containsPure(shape));
|
||||
MOZ_ASSERT(getter != JS_PropertyStub);
|
||||
MOZ_ASSERT(setter != JS_StrictPropertyStub);
|
||||
|
||||
attrs |= shape->attrs & mask;
|
||||
MOZ_ASSERT_IF(attrs & (JSPROP_GETTER | JSPROP_SETTER), attrs & JSPROP_SHARED);
|
||||
@ -979,6 +997,11 @@ NativeObject::changeProperty(typename ExecutionModeTraits<mode>::ExclusiveContex
|
||||
types::MarkTypePropertyNonData(cx->asExclusiveContext(), obj, shape->propid());
|
||||
}
|
||||
|
||||
if (getter == JS_PropertyStub)
|
||||
getter = nullptr;
|
||||
if (setter == JS_StrictPropertyStub)
|
||||
setter = nullptr;
|
||||
|
||||
if (!CheckCanChangeAttrs(cx, obj, shape, &attrs))
|
||||
return nullptr;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user