Changeset 67494 in webkit for trunk/JavaScriptCore/runtime


Ignore:
Timestamp:
Sep 14, 2010, 2:06:01 PM (15 years ago)
Author:
Darin Adler
Message:

2010-09-14 Darin Adler <Darin Adler>

Reviewed by Geoffrey Garen.

Sort with non-numeric custom sort function fails on array with length but no values
https://bugs.webkit.org/show_bug.cgi?id=45781

  • runtime/JSArray.cpp: (JSC::JSArray::sort): Replaced early exit for an array of length zero to instead exit for any array without values, even if it has a non-0 length.

2010-09-14 Darin Adler <Darin Adler>

Reviewed by Geoffrey Garen.

Sort with non-numeric custom sort function fails on array with length but no values
https://bugs.webkit.org/show_bug.cgi?id=45781

  • fast/js/script-tests/sort-large-array.js: Added test cases.
  • fast/js/sort-large-array-expected.txt: Updated.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/JSArray.cpp

    r66004 r67494  
    10611061        return;
    10621062
    1063     if (!storage->m_length)
    1064         return;
    1065 
    10661063    unsigned usedVectorLength = min(storage->m_length, m_vectorLength);
     1064    unsigned nodeCount = usedVectorLength + (storage->m_sparseValueMap ? storage->m_sparseValueMap->size() : 0);
     1065
     1066    if (!nodeCount)
     1067        return;
    10671068
    10681069    AVLTree<AVLTreeAbstractorForArrayCompare, 44> tree; // Depth 44 is enough for 2^31 items
     
    10721073    tree.abstractor().m_compareCallData = &callData;
    10731074    tree.abstractor().m_globalThisValue = exec->globalThisValue();
    1074     tree.abstractor().m_nodes.resize(usedVectorLength + (storage->m_sparseValueMap ? storage->m_sparseValueMap->size() : 0));
     1075    tree.abstractor().m_nodes.grow(nodeCount);
    10751076
    10761077    if (callType == CallTypeJS)
Note: See TracChangeset for help on using the changeset viewer.