Changeset 282565 in webkit for trunk/Source/JavaScriptCore/dfg/DFGArrayMode.cpp
- Timestamp:
- Sep 16, 2021, 11:14:24 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/dfg/DFGArrayMode.cpp
r282478 r282565 37 37 namespace JSC { namespace DFG { 38 38 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 39 ArrayMode ArrayMode::fromObserved(const ConcurrentJSLocker& locker, ArrayProfile* profile, Array::Action action, bool makeSafe) 40 { 48 41 Array::Class nonArray; 49 if (profile->usesOriginalArrayStructures( ))42 if (profile->usesOriginalArrayStructures(locker)) 50 43 nonArray = Array::OriginalNonArray; 51 44 else … … 71 64 converts = Array::AsIs; 72 65 73 return ArrayMode(type, isArray, converts, action).withProfile( profile, makeSafe);66 return ArrayMode(type, isArray, converts, action).withProfile(locker, profile, makeSafe); 74 67 }; 75 68 76 ArrayModes observed = profile->observedArrayModes( );69 ArrayModes observed = profile->observedArrayModes(locker); 77 70 switch (observed) { 78 71 case 0: 79 72 return ArrayMode(Array::Unprofiled); 80 73 case asArrayModesIgnoringTypedArrays(NonArray): 81 if (action == Array::Write && !profile->mayInterceptIndexedAccesses( ))74 if (action == Array::Write && !profile->mayInterceptIndexedAccesses(locker)) 82 75 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); 84 77 85 78 case asArrayModesIgnoringTypedArrays(ArrayWithUndecided): 86 79 if (action == Array::Write) 87 80 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); 89 82 90 83 case asArrayModesIgnoringTypedArrays(NonArray) | asArrayModesIgnoringTypedArrays(ArrayWithUndecided): 91 if (action == Array::Write && !profile->mayInterceptIndexedAccesses( ))84 if (action == Array::Write && !profile->mayInterceptIndexedAccesses(locker)) 92 85 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); 94 87 95 88 case asArrayModesIgnoringTypedArrays(NonArrayWithInt32): … … 121 114 122 115 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); 124 117 case asArrayModesIgnoringTypedArrays(NonArrayWithSlowPutArrayStorage): 125 118 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); 127 120 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); 129 122 case asArrayModesIgnoringTypedArrays(ArrayWithSlowPutArrayStorage): 130 123 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); 132 125 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); 134 127 case asArrayModesIgnoringTypedArrays(NonArrayWithSlowPutArrayStorage) | asArrayModesIgnoringTypedArrays(ArrayWithSlowPutArrayStorage): 135 128 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); 137 130 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); 139 132 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); 141 134 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); 143 136 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); 145 138 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); 147 140 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); 149 142 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); 151 144 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); 153 146 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); 155 148 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); 157 150 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); 159 152 160 153 default: 161 154 // 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. 162 155 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); 167 160 168 161 Array::Type type; … … 191 184 arrayClass = Array::PossiblyArray; 192 185 193 return ArrayMode(type, arrayClass, Array::Convert, action).withProfile( profile, makeSafe);186 return ArrayMode(type, arrayClass, Array::Convert, action).withProfile(locker, profile, makeSafe); 194 187 } 195 188 }
Note:
See TracChangeset
for help on using the changeset viewer.