mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Speed up adding new properties with a common base shape, bug 704327.
This commit is contained in:
parent
299ac2bf87
commit
8f0417b715
@ -657,11 +657,16 @@ JSObject::addPropertyInternal(JSContext *cx, jsid id,
|
|||||||
/* Find or create a property tree node labeled by our arguments. */
|
/* Find or create a property tree node labeled by our arguments. */
|
||||||
Shape *shape;
|
Shape *shape;
|
||||||
{
|
{
|
||||||
BaseShape base(getClass(), getParent(), lastProperty()->getObjectFlags(),
|
BaseShape *nbase;
|
||||||
attrs, getter, setter);
|
if (lastProperty()->base()->matchesGetterSetter(getter, setter)) {
|
||||||
BaseShape *nbase = BaseShape::getUnowned(cx, base);
|
nbase = lastProperty()->base();
|
||||||
if (!nbase)
|
} else {
|
||||||
return NULL;
|
BaseShape base(getClass(), getParent(), lastProperty()->getObjectFlags(),
|
||||||
|
attrs, getter, setter);
|
||||||
|
nbase = BaseShape::getUnowned(cx, base);
|
||||||
|
if (!nbase)
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
Shape child(nbase, id, slot, numFixedSlots(), attrs, flags, shortid);
|
Shape child(nbase, id, slot, numFixedSlots(), attrs, flags, shortid);
|
||||||
shape = getChildProperty(cx, lastProperty(), child);
|
shape = getChildProperty(cx, lastProperty(), child);
|
||||||
|
@ -412,10 +412,13 @@ class BaseShape : public js::gc::Cell
|
|||||||
|
|
||||||
inline BaseShape(Class *clasp, JSObject *parent, uint32 objectFlags);
|
inline BaseShape(Class *clasp, JSObject *parent, uint32 objectFlags);
|
||||||
inline BaseShape(Class *clasp, JSObject *parent, uint32 objectFlags,
|
inline BaseShape(Class *clasp, JSObject *parent, uint32 objectFlags,
|
||||||
uint8 attrs, js::PropertyOp rawGetter, js::StrictPropertyOp rawSetter);
|
uint8 attrs, PropertyOp rawGetter, StrictPropertyOp rawSetter);
|
||||||
|
|
||||||
bool isOwned() const { return !!(flags & OWNED_SHAPE); }
|
bool isOwned() const { return !!(flags & OWNED_SHAPE); }
|
||||||
|
|
||||||
|
inline bool matchesGetterSetter(PropertyOp rawGetter,
|
||||||
|
StrictPropertyOp rawSetter) const;
|
||||||
|
|
||||||
inline void adoptUnowned(UnownedBaseShape *other);
|
inline void adoptUnowned(UnownedBaseShape *other);
|
||||||
inline void setOwned(UnownedBaseShape *unowned);
|
inline void setOwned(UnownedBaseShape *unowned);
|
||||||
|
|
||||||
|
@ -108,6 +108,12 @@ BaseShape::BaseShape(Class *clasp, JSObject *parent, uint32 objectFlags,
|
|||||||
flags |= HAS_SETTER_OBJECT;
|
flags |= HAS_SETTER_OBJECT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool
|
||||||
|
BaseShape::matchesGetterSetter(PropertyOp rawGetter, StrictPropertyOp rawSetter) const
|
||||||
|
{
|
||||||
|
return rawGetter == this->rawGetter && rawSetter == this->rawSetter;
|
||||||
|
}
|
||||||
|
|
||||||
inline void
|
inline void
|
||||||
BaseShape::setParent(JSObject *obj)
|
BaseShape::setParent(JSObject *obj)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user