Bug 936966 - Fix computation deciding whether to allocate in MNewArray, r=jandem.

This commit is contained in:
Brian Hackett 2013-11-17 15:44:14 -07:00
parent 0ef197fc0a
commit 55412888c2

View File

@ -2509,13 +2509,13 @@ MNewArray::shouldUseVM() const
{
JS_ASSERT(count() < JSObject::NELEMENTS_LIMIT);
size_t maxArraySlots =
gc::GetGCKindSlots(gc::FINALIZE_OBJECT_LAST) - ObjectElements::VALUES_PER_HEADER;
size_t arraySlots =
gc::GetGCKindSlots(templateObject()->tenuredGetAllocKind()) - ObjectElements::VALUES_PER_HEADER;
// Allocate space using the VMCall
// when mir hints it needs to get allocated immediatly,
// when mir hints it needs to get allocated immediately,
// but only when data doesn't fit the available array slots.
bool allocating = isAllocating() && count() > maxArraySlots;
bool allocating = isAllocating() && count() > arraySlots;
return templateObject()->hasSingletonType() || allocating;
}