mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-29 21:25:35 +00:00
Bug 1339535 - Set the hadElementsAccess flag less eagerly to avoid unnecessary Shape changes. r=evilpie
This commit is contained in:
parent
d80b2440cc
commit
5e3013cebd
@ -1500,8 +1500,19 @@ SetObjectElementOperation(JSContext* cx, HandleObject obj, HandleId id, HandleVa
|
||||
}
|
||||
}
|
||||
|
||||
if (obj->isNative() && !JSID_IS_INT(id) && !JSObject::setHadElementsAccess(cx, obj))
|
||||
return false;
|
||||
// Set the HadElementsAccess flag on the object if needed. This flag is
|
||||
// used to do more eager dictionary-mode conversion for objects that are
|
||||
// used as hashmaps. Set this flag only for objects with many properties,
|
||||
// to avoid unnecessary Shape changes.
|
||||
if (obj->isNative() &&
|
||||
JSID_IS_ATOM(id) &&
|
||||
!obj->as<NativeObject>().inDictionaryMode() &&
|
||||
!obj->hadElementsAccess() &&
|
||||
obj->as<NativeObject>().slotSpan() > PropertyTree::MAX_HEIGHT_WITH_ELEMENTS_ACCESS / 3)
|
||||
{
|
||||
if (!JSObject::setHadElementsAccess(cx, obj))
|
||||
return false;
|
||||
}
|
||||
|
||||
ObjectOpResult result;
|
||||
return SetProperty(cx, obj, id, value, receiver, result) &&
|
||||
|
Loading…
Reference in New Issue
Block a user