• benjamin@webkit.org's avatar
    Do not abuse ArrayStorage's m_length for testing array consistency · 83c15267
    benjamin@webkit.org authored
    Patch by Benjamin Poulain <bpoulain@apple.com> on 2012-04-06
    Reviewed by Geoffrey Garen.
    Array creation from a list of values is a 3 steps process:
    -JSArray::initializeIndex() for each values
    Previously, the attribute m_length was not set to the final size
    JSArray::tryCreateUninitialized() because it was used to test the array
    consistency JSArray::initializeIndex().
    This caused the initialization loop using JSArray::initializeIndex() maintain
    two counters:
    -index of the loop
    This patch fixes this by using the index of the initialization loop for the indinces of
    JSArray::initializeIndex(). For testing consistency, the variable m_initializationIndex
    is introduced if CHECK_ARRAY_CONSISTENCY is defined.
    The patch also fixes minor unrelated build issue when CHECK_ARRAY_CONSISTENCY is defined.
    This improves the performance of JSArray creation from literals by 8%.
    * runtime/JSArray.cpp:
    * runtime/JSArray.h:
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@113530 268f45cc-cd09-0410-ab3c-d52691b4dbfc
JSArray.cpp 73.4 KB