Ignore:
Timestamp:
Sep 16, 2021, 11:14:24 AM (4 years ago)
Author:
[email protected]
Message:

Unreviewed, reverting r282478.
https://bugs.webkit.org/show_bug.cgi?id=230358

Reverted changeset:

"Move some profiling to UnlinkedCodeBlock"
https://bugs.webkit.org/show_bug.cgi?id=230078
https://commits.webkit.org/r282478

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/dfg/DFGArrayMode.cpp

    r282478 r282565  
    3737namespace JSC { namespace DFG {
    3838
    39 ArrayMode ArrayMode::fromObserved(Graph& graph, const CodeOrigin& origin, ArrayProfile* profile, Array::Action action, bool makeSafe)
    40 {
    41     if (profile->observedDifferentGlobalObject() && graph.hasAnyExitsAt(origin)) {
    42         // This could be an original array structure, but from a different
    43         // global object than the lexical global object. So we conservatively
    44         // say it is not an original array structure.
    45         profile->setDoesNotUseOriginalArrayStructures();
    46     }
    47 
     39ArrayMode ArrayMode::fromObserved(const ConcurrentJSLocker& locker, ArrayProfile* profile, Array::Action action, bool makeSafe)
     40{
    4841    Array::Class nonArray;
    49     if (profile->usesOriginalArrayStructures())
     42    if (profile->usesOriginalArrayStructures(locker))
    5043        nonArray = Array::OriginalNonArray;
    5144    else
     
    7164            converts = Array::AsIs;
    7265
    73         return ArrayMode(type, isArray, converts, action).withProfile(profile, makeSafe);
     66        return ArrayMode(type, isArray, converts, action).withProfile(locker, profile, makeSafe);
    7467    };
    7568
    76     ArrayModes observed = profile->observedArrayModes();
     69    ArrayModes observed = profile->observedArrayModes(locker);
    7770    switch (observed) {
    7871    case 0:
    7972        return ArrayMode(Array::Unprofiled);
    8073    case asArrayModesIgnoringTypedArrays(NonArray):
    81         if (action == Array::Write && !profile->mayInterceptIndexedAccesses())
     74        if (action == Array::Write && !profile->mayInterceptIndexedAccesses(locker))
    8275            return ArrayMode(Array::SelectUsingArguments, nonArray, Array::OutOfBounds, Array::Convert, action);
    83         return ArrayMode(Array::SelectUsingPredictions, nonArray, action).withSpeculationFromProfile(profile, makeSafe);
     76        return ArrayMode(Array::SelectUsingPredictions, nonArray, action).withSpeculationFromProfile(locker, profile, makeSafe);
    8477
    8578    case asArrayModesIgnoringTypedArrays(ArrayWithUndecided):
    8679        if (action == Array::Write)
    8780            return ArrayMode(Array::SelectUsingArguments, Array::Array, Array::OutOfBounds, Array::Convert, action);
    88         return ArrayMode(Array::Undecided, Array::Array, Array::OutOfBounds, Array::AsIs, action).withProfile(profile, makeSafe);
     81        return ArrayMode(Array::Undecided, Array::Array, Array::OutOfBounds, Array::AsIs, action).withProfile(locker, profile, makeSafe);
    8982       
    9083    case asArrayModesIgnoringTypedArrays(NonArray) | asArrayModesIgnoringTypedArrays(ArrayWithUndecided):
    91         if (action == Array::Write && !profile->mayInterceptIndexedAccesses())
     84        if (action == Array::Write && !profile->mayInterceptIndexedAccesses(locker))
    9285            return ArrayMode(Array::SelectUsingArguments, Array::PossiblyArray, Array::OutOfBounds, Array::Convert, action);
    93         return ArrayMode(Array::SelectUsingPredictions, action).withSpeculationFromProfile(profile, makeSafe);
     86        return ArrayMode(Array::SelectUsingPredictions, action).withSpeculationFromProfile(locker, profile, makeSafe);
    9487
    9588    case asArrayModesIgnoringTypedArrays(NonArrayWithInt32):
     
    121114
    122115    case asArrayModesIgnoringTypedArrays(NonArrayWithArrayStorage):
    123         return ArrayMode(Array::ArrayStorage, nonArray, Array::AsIs, action).withProfile(profile, makeSafe);
     116        return ArrayMode(Array::ArrayStorage, nonArray, Array::AsIs, action).withProfile(locker, profile, makeSafe);
    124117    case asArrayModesIgnoringTypedArrays(NonArrayWithSlowPutArrayStorage):
    125118    case asArrayModesIgnoringTypedArrays(NonArrayWithArrayStorage) | asArrayModesIgnoringTypedArrays(NonArrayWithSlowPutArrayStorage):
    126         return ArrayMode(Array::SlowPutArrayStorage, nonArray, Array::AsIs, action).withProfile(profile, makeSafe);
     119        return ArrayMode(Array::SlowPutArrayStorage, nonArray, Array::AsIs, action).withProfile(locker, profile, makeSafe);
    127120    case asArrayModesIgnoringTypedArrays(ArrayWithArrayStorage):
    128         return ArrayMode(Array::ArrayStorage, Array::Array, Array::AsIs, action).withProfile(profile, makeSafe);
     121        return ArrayMode(Array::ArrayStorage, Array::Array, Array::AsIs, action).withProfile(locker, profile, makeSafe);
    129122    case asArrayModesIgnoringTypedArrays(ArrayWithSlowPutArrayStorage):
    130123    case asArrayModesIgnoringTypedArrays(ArrayWithArrayStorage) | asArrayModesIgnoringTypedArrays(ArrayWithSlowPutArrayStorage):
    131         return ArrayMode(Array::SlowPutArrayStorage, Array::Array, Array::AsIs, action).withProfile(profile, makeSafe);
     124        return ArrayMode(Array::SlowPutArrayStorage, Array::Array, Array::AsIs, action).withProfile(locker, profile, makeSafe);
    132125    case asArrayModesIgnoringTypedArrays(NonArrayWithArrayStorage) | asArrayModesIgnoringTypedArrays(ArrayWithArrayStorage):
    133         return ArrayMode(Array::ArrayStorage, Array::PossiblyArray, Array::AsIs, action).withProfile(profile, makeSafe);
     126        return ArrayMode(Array::ArrayStorage, Array::PossiblyArray, Array::AsIs, action).withProfile(locker, profile, makeSafe);
    134127    case asArrayModesIgnoringTypedArrays(NonArrayWithSlowPutArrayStorage) | asArrayModesIgnoringTypedArrays(ArrayWithSlowPutArrayStorage):
    135128    case asArrayModesIgnoringTypedArrays(NonArrayWithArrayStorage) | asArrayModesIgnoringTypedArrays(ArrayWithArrayStorage) | asArrayModesIgnoringTypedArrays(NonArrayWithSlowPutArrayStorage) | asArrayModesIgnoringTypedArrays(ArrayWithSlowPutArrayStorage):
    136         return ArrayMode(Array::SlowPutArrayStorage, Array::PossiblyArray, Array::AsIs, action).withProfile(profile, makeSafe);
     129        return ArrayMode(Array::SlowPutArrayStorage, Array::PossiblyArray, Array::AsIs, action).withProfile(locker, profile, makeSafe);
    137130    case Int8ArrayMode:
    138         return ArrayMode(Array::Int8Array, nonArray, Array::AsIs, action).withProfile(profile, makeSafe);
     131        return ArrayMode(Array::Int8Array, nonArray, Array::AsIs, action).withProfile(locker, profile, makeSafe);
    139132    case Int16ArrayMode:
    140         return ArrayMode(Array::Int16Array, nonArray, Array::AsIs, action).withProfile(profile, makeSafe);
     133        return ArrayMode(Array::Int16Array, nonArray, Array::AsIs, action).withProfile(locker, profile, makeSafe);
    141134    case Int32ArrayMode:
    142         return ArrayMode(Array::Int32Array, nonArray, Array::AsIs, action).withProfile(profile, makeSafe);
     135        return ArrayMode(Array::Int32Array, nonArray, Array::AsIs, action).withProfile(locker, profile, makeSafe);
    143136    case Uint8ArrayMode:
    144         return ArrayMode(Array::Uint8Array, nonArray, Array::AsIs, action).withProfile(profile, makeSafe);
     137        return ArrayMode(Array::Uint8Array, nonArray, Array::AsIs, action).withProfile(locker, profile, makeSafe);
    145138    case Uint8ClampedArrayMode:
    146         return ArrayMode(Array::Uint8ClampedArray, nonArray, Array::AsIs, action).withProfile(profile, makeSafe);
     139        return ArrayMode(Array::Uint8ClampedArray, nonArray, Array::AsIs, action).withProfile(locker, profile, makeSafe);
    147140    case Uint16ArrayMode:
    148         return ArrayMode(Array::Uint16Array, nonArray, Array::AsIs, action).withProfile(profile, makeSafe);
     141        return ArrayMode(Array::Uint16Array, nonArray, Array::AsIs, action).withProfile(locker, profile, makeSafe);
    149142    case Uint32ArrayMode:
    150         return ArrayMode(Array::Uint32Array, nonArray, Array::AsIs, action).withProfile(profile, makeSafe);
     143        return ArrayMode(Array::Uint32Array, nonArray, Array::AsIs, action).withProfile(locker, profile, makeSafe);
    151144    case Float32ArrayMode:
    152         return ArrayMode(Array::Float32Array, nonArray, Array::AsIs, action).withProfile(profile, makeSafe);
     145        return ArrayMode(Array::Float32Array, nonArray, Array::AsIs, action).withProfile(locker, profile, makeSafe);
    153146    case Float64ArrayMode:
    154         return ArrayMode(Array::Float64Array, nonArray, Array::AsIs, action).withProfile(profile, makeSafe);
     147        return ArrayMode(Array::Float64Array, nonArray, Array::AsIs, action).withProfile(locker, profile, makeSafe);
    155148    case BigInt64ArrayMode:
    156         return ArrayMode(Array::BigInt64Array, nonArray, Array::AsIs, action).withProfile(profile, makeSafe);
     149        return ArrayMode(Array::BigInt64Array, nonArray, Array::AsIs, action).withProfile(locker, profile, makeSafe);
    157150    case BigUint64ArrayMode:
    158         return ArrayMode(Array::BigUint64Array, nonArray, Array::AsIs, action).withProfile(profile, makeSafe);
     151        return ArrayMode(Array::BigUint64Array, nonArray, Array::AsIs, action).withProfile(locker, profile, makeSafe);
    159152
    160153    default:
    161154        // If we have seen multiple TypedArray types, or a TypedArray and non-typed array, it doesn't make sense to try to convert the object since you can't convert typed arrays.
    162155        if (observed & ALL_TYPED_ARRAY_MODES)
    163             return ArrayMode(Array::Generic, nonArray, Array::AsIs, action).withProfile(profile, makeSafe);
    164 
    165         if ((observed & asArrayModesIgnoringTypedArrays(NonArray)) && profile->mayInterceptIndexedAccesses())
    166             return ArrayMode(Array::SelectUsingPredictions).withSpeculationFromProfile(profile, makeSafe);
     156            return ArrayMode(Array::Generic, nonArray, Array::AsIs, action).withProfile(locker, profile, makeSafe);
     157
     158        if ((observed & asArrayModesIgnoringTypedArrays(NonArray)) && profile->mayInterceptIndexedAccesses(locker))
     159            return ArrayMode(Array::SelectUsingPredictions).withSpeculationFromProfile(locker, profile, makeSafe);
    167160       
    168161        Array::Type type;
     
    191184            arrayClass = Array::PossiblyArray;
    192185       
    193         return ArrayMode(type, arrayClass, Array::Convert, action).withProfile(profile, makeSafe);
     186        return ArrayMode(type, arrayClass, Array::Convert, action).withProfile(locker, profile, makeSafe);
    194187    }
    195188}
Note: See TracChangeset for help on using the changeset viewer.