Changeset 222384 in webkit for trunk/Source/JavaScriptCore/runtime/JSArray.h
- Timestamp:
- Sep 22, 2017, 5:19:54 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/runtime/JSArray.h
r222382 r222384 55 55 public: 56 56 static JSArray* tryCreate(VM&, Structure*, unsigned initialLength = 0); 57 static JSArray* tryCreate(VM&, Structure*, unsigned initialLength, unsigned vectorLengthHint); 57 58 static JSArray* create(VM&, Structure*, unsigned initialLength = 0); 58 59 static JSArray* createWithButterfly(VM&, GCDeferralContext*, Structure*, Butterfly*); … … 216 217 VM&, JSCell* intendedOwner, unsigned initialLength); 217 218 218 inline JSArray* JSArray::tryCreate(VM& vm, Structure* structure, unsigned initialLength) 219 { 219 inline JSArray* JSArray::tryCreate(VM& vm, Structure* structure, unsigned initialLength, unsigned vectorLengthHint) 220 { 221 ASSERT(vectorLengthHint >= initialLength); 220 222 unsigned outOfLineStorage = structure->outOfLineCapacity(); 221 223 … … 229 231 || hasContiguous(indexingType)); 230 232 231 if (UNLIKELY( initialLength> MAX_STORAGE_VECTOR_LENGTH))233 if (UNLIKELY(vectorLengthHint > MAX_STORAGE_VECTOR_LENGTH)) 232 234 return nullptr; 233 235 234 unsigned vectorLength = Butterfly::optimalContiguousVectorLength(structure, initialLength);236 unsigned vectorLength = Butterfly::optimalContiguousVectorLength(structure, vectorLengthHint); 235 237 void* temp = vm.jsValueGigacageAuxiliarySpace.tryAllocate(nullptr, Butterfly::totalSize(0, outOfLineStorage, true, vectorLength * sizeof(EncodedJSValue))); 236 238 if (!temp) … … 257 259 } 258 260 261 inline JSArray* JSArray::tryCreate(VM& vm, Structure* structure, unsigned initialLength) 262 { 263 return tryCreate(vm, structure, initialLength, initialLength); 264 } 265 259 266 inline JSArray* JSArray::create(VM& vm, Structure* structure, unsigned initialLength) 260 267 {
Note:
See TracChangeset
for help on using the changeset viewer.