⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 236514 in webkit


Ignore:
Timestamp:
Sep 26, 2018, 11:57:32 AM (8 years ago)
Author:
keith_miller@apple.com
Message:

We should zero unused property storage when rebalancing array storage.
https://bugs.webkit.org/show_bug.cgi?id=188151

Reviewed by Michael Saboff.

JSTests:

  • stress/splice-should-zero-property-storage-when-rebalancing.js: Added.

Source/JavaScriptCore:

In unshiftCountSlowCase we sometimes will move property storage to the right even when net adding elements.
This can happen because we "balance" the pre/post-capacity in that code so we need to zero the unused
property storage.

  • runtime/JSArray.cpp:

(JSC::JSArray::unshiftCountSlowCase):

Location:
trunk
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r236496 r236514  
     12018-09-26  Keith Miller  <keith_miller@apple.com>
     2
     3        We should zero unused property storage when rebalancing array storage.
     4        https://bugs.webkit.org/show_bug.cgi?id=188151
     5
     6        Reviewed by Michael Saboff.
     7
     8        * stress/splice-should-zero-property-storage-when-rebalancing.js: Added.
     9
    1102018-09-20  Yusuke Suzuki  <yusukesuzuki@slowstart.org>
    211
  • trunk/Source/JavaScriptCore/ChangeLog

    r236505 r236514  
     12018-09-26  Keith Miller  <keith_miller@apple.com>
     2
     3        We should zero unused property storage when rebalancing array storage.
     4        https://bugs.webkit.org/show_bug.cgi?id=188151
     5
     6        Reviewed by Michael Saboff.
     7
     8        In unshiftCountSlowCase we sometimes will move property storage to the right even when net adding elements.
     9        This can happen because we "balance" the pre/post-capacity in that code so we need to zero the unused
     10        property storage.
     11
     12        * runtime/JSArray.cpp:
     13        (JSC::JSArray::unshiftCountSlowCase):
     14
    1152018-09-26  Yusuke Suzuki  <yusukesuzuki@slowstart.org>
    216
  • trunk/Source/JavaScriptCore/runtime/JSArray.cpp

    r235356 r236514  
    425425        memmove(newButterfly->propertyStorage() - propertySize, butterfly->propertyStorage() - propertySize, sizeof(JSValue) * propertySize + sizeof(IndexingHeader) + ArrayStorage::sizeFor(0));
    426426
     427        // We don't need to zero the pre-capacity for the concurrent GC because it is not available to use as property storage.
     428        memset(newButterfly->base(0, propertyCapacity), 0, (propertyCapacity - propertySize) * sizeof(JSValue));
     429
    427430        if (allocatedNewStorage) {
    428431            // We will set the vectorLength to newVectorLength. We populated requiredVectorLength
     
    430433            for (unsigned i = requiredVectorLength; i < newVectorLength; ++i)
    431434                newButterfly->arrayStorage()->m_vector[i].clear();
    432             // We don't need to zero the pre-capacity because it is not available to use as property storage.
    433             memset(newButterfly->base(0, propertyCapacity), 0, (propertyCapacity - propertySize) * sizeof(JSValue));
    434435        }
    435436    } else if ((newAllocBase != butterfly->base(structure)) || (preCapacity != storage->m_indexBias)) {
Note: See TracChangeset for help on using the changeset viewer.