Changeset 262353 in webkit for trunk/Source/JavaScriptCore/runtime/JSBigInt.cpp
- Timestamp:
- May 30, 2020, 8:01:08 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/runtime/JSBigInt.cpp
r262342 r262353 100 100 inline JSBigInt* JSBigInt::createWithLength(JSGlobalObject* nullOrGlobalObjectForOOM, VM& vm, unsigned length) 101 101 { 102 auto scope = DECLARE_THROW_SCOPE(vm);103 102 if (UNLIKELY(length > maxLength)) { 104 if (nullOrGlobalObjectForOOM) 103 if (nullOrGlobalObjectForOOM) { 104 auto scope = DECLARE_THROW_SCOPE(vm); 105 105 throwOutOfMemoryError(nullOrGlobalObjectForOOM, scope, "BigInt generated from this operation is too big"_s); 106 } 106 107 return nullptr; 107 108 } … … 110 111 void* data = Gigacage::tryMalloc(Gigacage::Primitive, length * sizeof(Digit)); 111 112 if (UNLIKELY(!data)) { 112 if (nullOrGlobalObjectForOOM) 113 if (nullOrGlobalObjectForOOM) { 114 auto scope = DECLARE_THROW_SCOPE(vm); 113 115 throwOutOfMemoryError(nullOrGlobalObjectForOOM, scope); 116 } 114 117 return nullptr; 115 118 } … … 2333 2336 JSBigInt* JSBigInt::allocateFor(JSGlobalObject* nullOrGlobalObjectForOOM, VM& vm, unsigned radix, unsigned charcount) 2334 2337 { 2335 auto scope = DECLARE_THROW_SCOPE(vm);2336 2337 2338 ASSERT(2 <= radix && radix <= 36); 2338 2339 … … 2349 2350 unsigned length = (bitsMin + digitBits - 1) / digitBits; 2350 2351 if (length <= maxLength) 2351 RELEASE_AND_RETURN(scope, createWithLength(nullOrGlobalObjectForOOM, vm, length));2352 return createWithLength(nullOrGlobalObjectForOOM, vm, length); 2352 2353 } 2353 2354 } 2354 2355 2355 if (nullOrGlobalObjectForOOM) 2356 if (nullOrGlobalObjectForOOM) { 2357 auto scope = DECLARE_THROW_SCOPE(vm); 2356 2358 throwOutOfMemoryError(nullOrGlobalObjectForOOM, scope, "BigInt generated from this operation is too big"_s); 2359 } 2357 2360 2358 2361 return nullptr; … … 2562 2565 } 2563 2566 heapResult = allocateFor(nullOrGlobalObjectForOOM, vm, radix, initialLength); 2564 if ( !heapResult)2567 if (UNLIKELY(!heapResult)) 2565 2568 return JSValue(); 2566 2569 heapResult->initialize(InitializationType::WithZero);
Note:
See TracChangeset
for help on using the changeset viewer.