Bug 1339535 - Set the hadElementsAccess flag less eagerly to avoid unnecessary Shape changes. r=evilpie

This commit is contained in:
Jan de Mooij 2017-02-27 18:56:58 +01:00
Родитель d80b2440cc
Коммит 5e3013cebd
1 изменённых файлов: 13 добавлений и 2 удалений

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

@ -1500,8 +1500,19 @@ SetObjectElementOperation(JSContext* cx, HandleObject obj, HandleId id, HandleVa
} }
} }
if (obj->isNative() && !JSID_IS_INT(id) && !JSObject::setHadElementsAccess(cx, obj)) // 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; return false;
}
ObjectOpResult result; ObjectOpResult result;
return SetProperty(cx, obj, id, value, receiver, result) && return SetProperty(cx, obj, id, value, receiver, result) &&