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

Changeset 243299 in webkit


Ignore:
Timestamp:
Mar 21, 2019, 10:42:41 AM (7 years ago)
Author:
Tadeu Zagallo
Message:

JSObject::putDirectIndexSlowOrBeyondVectorLength should check if indexIsSufficientlyBeyondLengthForSparseMap
https://bugs.webkit.org/show_bug.cgi?id=196078
<rdar://problem/35925380>

Reviewed by Mark Lam.

JSTests:

Add a new benchmark that allocates several objects and invokes put_by_val_direct
with a large index. run-jsc-benchmarks says "definitely 1.6178x faster".

  • microbenchmarks/put-by-val-direct-large-index.js: Added.

Source/JavaScriptCore:

Unlike the other variations of putByIndex, it only checked if the index
was larger than MIN_SPARSE_ARRAY_INDEX when the indexingType was
ALL_BLANK_INDEXING_TYPES. This resulted in a huge butterfly being
allocated for object literals (e.g. {[9e4]: ...}) and objects parsed
from JSON.

  • runtime/JSObject.cpp:

(JSC::JSObject::putDirectIndexSlowOrBeyondVectorLength):

Location:
trunk
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r243294 r243299  
     12019-03-21  Tadeu Zagallo  <tzagallo@apple.com>
     2
     3        JSObject::putDirectIndexSlowOrBeyondVectorLength should check if indexIsSufficientlyBeyondLengthForSparseMap
     4        https://bugs.webkit.org/show_bug.cgi?id=196078
     5        <rdar://problem/35925380>
     6
     7        Reviewed by Mark Lam.
     8
     9        Add a new benchmark that allocates several objects and invokes put_by_val_direct
     10        with a large index. run-jsc-benchmarks says "definitely 1.6178x faster".
     11
     12        * microbenchmarks/put-by-val-direct-large-index.js: Added.
     13
    1142019-03-21  Mark Lam  <mark.lam@apple.com>
    215
  • trunk/Source/JavaScriptCore/ChangeLog

    r243295 r243299  
     12019-03-21  Tadeu Zagallo  <tzagallo@apple.com>
     2
     3        JSObject::putDirectIndexSlowOrBeyondVectorLength should check if indexIsSufficientlyBeyondLengthForSparseMap
     4        https://bugs.webkit.org/show_bug.cgi?id=196078
     5        <rdar://problem/35925380>
     6
     7        Reviewed by Mark Lam.
     8
     9        Unlike the other variations of putByIndex, it only checked if the index
     10        was larger than MIN_SPARSE_ARRAY_INDEX when the indexingType was
     11        ALL_BLANK_INDEXING_TYPES. This resulted in a huge butterfly being
     12        allocated for object literals (e.g. `{[9e4]: ...}`) and objects parsed
     13        from JSON.
     14
     15        * runtime/JSObject.cpp:
     16        (JSC::JSObject::putDirectIndexSlowOrBeyondVectorLength):
     17
    1182019-03-21  Tadeu Zagallo  <tzagallo@apple.com>
    219
  • trunk/Source/JavaScriptCore/runtime/JSObject.cpp

    r243079 r243299  
    30563056                ensureArrayStorageExistsAndEnterDictionaryIndexingMode(vm));
    30573057        }
    3058         if (i >= MIN_SPARSE_ARRAY_INDEX) {
     3058        if (indexIsSufficientlyBeyondLengthForSparseMap(i, 0) || i >= MIN_SPARSE_ARRAY_INDEX) {
    30593059            return putDirectIndexBeyondVectorLengthWithArrayStorage(
    30603060                exec, i, value, attributes, mode, createArrayStorage(vm, 0, 0));
Note: See TracChangeset for help on using the changeset viewer.