Changeset 282478 in webkit for trunk/Source/JavaScriptCore/dfg/DFGArrayMode.cpp
- Timestamp:
- Sep 15, 2021, 3:18:52 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/dfg/DFGArrayMode.cpp
r272170 r282478 37 37 namespace JSC { namespace DFG { 38 38 39 ArrayMode ArrayMode::fromObserved(const ConcurrentJSLocker& locker, ArrayProfile* profile, Array::Action action, bool makeSafe) 40 { 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 41 48 Array::Class nonArray; 42 if (profile->usesOriginalArrayStructures( locker))49 if (profile->usesOriginalArrayStructures()) 43 50 nonArray = Array::OriginalNonArray; 44 51 else … … 64 71 converts = Array::AsIs; 65 72 66 return ArrayMode(type, isArray, converts, action).withProfile( locker,profile, makeSafe);73 return ArrayMode(type, isArray, converts, action).withProfile(profile, makeSafe); 67 74 }; 68 75 69 ArrayModes observed = profile->observedArrayModes( locker);76 ArrayModes observed = profile->observedArrayModes(); 70 77 switch (observed) { 71 78 case 0: 72 79 return ArrayMode(Array::Unprofiled); 73 80 case asArrayModesIgnoringTypedArrays(NonArray): 74 if (action == Array::Write && !profile->mayInterceptIndexedAccesses( locker))81 if (action == Array::Write && !profile->mayInterceptIndexedAccesses()) 75 82 return ArrayMode(Array::SelectUsingArguments, nonArray, Array::OutOfBounds, Array::Convert, action); 76 return ArrayMode(Array::SelectUsingPredictions, nonArray, action).withSpeculationFromProfile( locker,profile, makeSafe);83 return ArrayMode(Array::SelectUsingPredictions, nonArray, action).withSpeculationFromProfile(profile, makeSafe); 77 84 78 85 case asArrayModesIgnoringTypedArrays(ArrayWithUndecided): 79 86 if (action == Array::Write) 80 87 return ArrayMode(Array::SelectUsingArguments, Array::Array, Array::OutOfBounds, Array::Convert, action); 81 return ArrayMode(Array::Undecided, Array::Array, Array::OutOfBounds, Array::AsIs, action).withProfile( locker,profile, makeSafe);88 return ArrayMode(Array::Undecided, Array::Array, Array::OutOfBounds, Array::AsIs, action).withProfile(profile, makeSafe); 82 89 83 90 case asArrayModesIgnoringTypedArrays(NonArray) | asArrayModesIgnoringTypedArrays(ArrayWithUndecided): 84 if (action == Array::Write && !profile->mayInterceptIndexedAccesses( locker))91 if (action == Array::Write && !profile->mayInterceptIndexedAccesses()) 85 92 return ArrayMode(Array::SelectUsingArguments, Array::PossiblyArray, Array::OutOfBounds, Array::Convert, action); 86 return ArrayMode(Array::SelectUsingPredictions, action).withSpeculationFromProfile( locker,profile, makeSafe);93 return ArrayMode(Array::SelectUsingPredictions, action).withSpeculationFromProfile(profile, makeSafe); 87 94 88 95 case asArrayModesIgnoringTypedArrays(NonArrayWithInt32): … … 114 121 115 122 case asArrayModesIgnoringTypedArrays(NonArrayWithArrayStorage): 116 return ArrayMode(Array::ArrayStorage, nonArray, Array::AsIs, action).withProfile( locker,profile, makeSafe);123 return ArrayMode(Array::ArrayStorage, nonArray, Array::AsIs, action).withProfile(profile, makeSafe); 117 124 case asArrayModesIgnoringTypedArrays(NonArrayWithSlowPutArrayStorage): 118 125 case asArrayModesIgnoringTypedArrays(NonArrayWithArrayStorage) | asArrayModesIgnoringTypedArrays(NonArrayWithSlowPutArrayStorage): 119 return ArrayMode(Array::SlowPutArrayStorage, nonArray, Array::AsIs, action).withProfile( locker,profile, makeSafe);126 return ArrayMode(Array::SlowPutArrayStorage, nonArray, Array::AsIs, action).withProfile(profile, makeSafe); 120 127 case asArrayModesIgnoringTypedArrays(ArrayWithArrayStorage): 121 return ArrayMode(Array::ArrayStorage, Array::Array, Array::AsIs, action).withProfile( locker,profile, makeSafe);128 return ArrayMode(Array::ArrayStorage, Array::Array, Array::AsIs, action).withProfile(profile, makeSafe); 122 129 case asArrayModesIgnoringTypedArrays(ArrayWithSlowPutArrayStorage): 123 130 case asArrayModesIgnoringTypedArrays(ArrayWithArrayStorage) | asArrayModesIgnoringTypedArrays(ArrayWithSlowPutArrayStorage): 124 return ArrayMode(Array::SlowPutArrayStorage, Array::Array, Array::AsIs, action).withProfile( locker,profile, makeSafe);131 return ArrayMode(Array::SlowPutArrayStorage, Array::Array, Array::AsIs, action).withProfile(profile, makeSafe); 125 132 case asArrayModesIgnoringTypedArrays(NonArrayWithArrayStorage) | asArrayModesIgnoringTypedArrays(ArrayWithArrayStorage): 126 return ArrayMode(Array::ArrayStorage, Array::PossiblyArray, Array::AsIs, action).withProfile( locker,profile, makeSafe);133 return ArrayMode(Array::ArrayStorage, Array::PossiblyArray, Array::AsIs, action).withProfile(profile, makeSafe); 127 134 case asArrayModesIgnoringTypedArrays(NonArrayWithSlowPutArrayStorage) | asArrayModesIgnoringTypedArrays(ArrayWithSlowPutArrayStorage): 128 135 case asArrayModesIgnoringTypedArrays(NonArrayWithArrayStorage) | asArrayModesIgnoringTypedArrays(ArrayWithArrayStorage) | asArrayModesIgnoringTypedArrays(NonArrayWithSlowPutArrayStorage) | asArrayModesIgnoringTypedArrays(ArrayWithSlowPutArrayStorage): 129 return ArrayMode(Array::SlowPutArrayStorage, Array::PossiblyArray, Array::AsIs, action).withProfile( locker,profile, makeSafe);136 return ArrayMode(Array::SlowPutArrayStorage, Array::PossiblyArray, Array::AsIs, action).withProfile(profile, makeSafe); 130 137 case Int8ArrayMode: 131 return ArrayMode(Array::Int8Array, nonArray, Array::AsIs, action).withProfile( locker,profile, makeSafe);138 return ArrayMode(Array::Int8Array, nonArray, Array::AsIs, action).withProfile(profile, makeSafe); 132 139 case Int16ArrayMode: 133 return ArrayMode(Array::Int16Array, nonArray, Array::AsIs, action).withProfile( locker,profile, makeSafe);140 return ArrayMode(Array::Int16Array, nonArray, Array::AsIs, action).withProfile(profile, makeSafe); 134 141 case Int32ArrayMode: 135 return ArrayMode(Array::Int32Array, nonArray, Array::AsIs, action).withProfile( locker,profile, makeSafe);142 return ArrayMode(Array::Int32Array, nonArray, Array::AsIs, action).withProfile(profile, makeSafe); 136 143 case Uint8ArrayMode: 137 return ArrayMode(Array::Uint8Array, nonArray, Array::AsIs, action).withProfile( locker,profile, makeSafe);144 return ArrayMode(Array::Uint8Array, nonArray, Array::AsIs, action).withProfile(profile, makeSafe); 138 145 case Uint8ClampedArrayMode: 139 return ArrayMode(Array::Uint8ClampedArray, nonArray, Array::AsIs, action).withProfile( locker,profile, makeSafe);146 return ArrayMode(Array::Uint8ClampedArray, nonArray, Array::AsIs, action).withProfile(profile, makeSafe); 140 147 case Uint16ArrayMode: 141 return ArrayMode(Array::Uint16Array, nonArray, Array::AsIs, action).withProfile( locker,profile, makeSafe);148 return ArrayMode(Array::Uint16Array, nonArray, Array::AsIs, action).withProfile(profile, makeSafe); 142 149 case Uint32ArrayMode: 143 return ArrayMode(Array::Uint32Array, nonArray, Array::AsIs, action).withProfile( locker,profile, makeSafe);150 return ArrayMode(Array::Uint32Array, nonArray, Array::AsIs, action).withProfile(profile, makeSafe); 144 151 case Float32ArrayMode: 145 return ArrayMode(Array::Float32Array, nonArray, Array::AsIs, action).withProfile( locker,profile, makeSafe);152 return ArrayMode(Array::Float32Array, nonArray, Array::AsIs, action).withProfile(profile, makeSafe); 146 153 case Float64ArrayMode: 147 return ArrayMode(Array::Float64Array, nonArray, Array::AsIs, action).withProfile( locker,profile, makeSafe);154 return ArrayMode(Array::Float64Array, nonArray, Array::AsIs, action).withProfile(profile, makeSafe); 148 155 case BigInt64ArrayMode: 149 return ArrayMode(Array::BigInt64Array, nonArray, Array::AsIs, action).withProfile( locker,profile, makeSafe);156 return ArrayMode(Array::BigInt64Array, nonArray, Array::AsIs, action).withProfile(profile, makeSafe); 150 157 case BigUint64ArrayMode: 151 return ArrayMode(Array::BigUint64Array, nonArray, Array::AsIs, action).withProfile( locker,profile, makeSafe);158 return ArrayMode(Array::BigUint64Array, nonArray, Array::AsIs, action).withProfile(profile, makeSafe); 152 159 153 160 default: 154 161 // 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. 155 162 if (observed & ALL_TYPED_ARRAY_MODES) 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);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); 160 167 161 168 Array::Type type; … … 184 191 arrayClass = Array::PossiblyArray; 185 192 186 return ArrayMode(type, arrayClass, Array::Convert, action).withProfile( locker,profile, makeSafe);193 return ArrayMode(type, arrayClass, Array::Convert, action).withProfile(profile, makeSafe); 187 194 } 188 195 }
Note:
See TracChangeset
for help on using the changeset viewer.