Changeset 203320 in webkit


Ignore:
Timestamp:
Jul 15, 2016, 9:16:30 PM (9 years ago)
Author:
commit-queue@webkit.org
Message:

[JSC] Convert the remaining createOutOfMemoryError()+throwException() into throwOutOfMemoryError()
https://bugs.webkit.org/show_bug.cgi?id=159665

Patch by Benjamin Poulain <bpoulain@apple.com> on 2016-07-15
Reviewed by Saam Barati.

  • API/JSTypedArray.cpp:

(createTypedArray):

  • runtime/Error.cpp:

(JSC::createOutOfMemoryError):

  • runtime/Error.h:
  • runtime/ExceptionHelpers.cpp:

(JSC::throwOutOfMemoryError):

  • runtime/JSArrayBufferConstructor.cpp:

(JSC::constructArrayBuffer):

  • runtime/JSArrayBufferPrototype.cpp:

(JSC::arrayBufferProtoFuncSlice):

  • runtime/JSGenericTypedArrayViewInlines.h:

(JSC::JSGenericTypedArrayView<Adaptor>::create):
(JSC::JSGenericTypedArrayView<Adaptor>::createUninitialized):

Location:
trunk/Source/JavaScriptCore
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/API/JSTypedArray.cpp

    r198488 r203320  
    104104    JSGlobalObject* globalObject = exec->lexicalGlobalObject();
    105105    if (!buffer) {
    106         exec->vm().throwException(exec, createOutOfMemoryError(exec));
     106        throwOutOfMemoryError(exec);
    107107        return nullptr;
    108108    }
  • trunk/Source/JavaScriptCore/ChangeLog

    r203318 r203320  
     12016-07-15  Benjamin Poulain  <bpoulain@apple.com>
     2
     3        [JSC] Convert the remaining createOutOfMemoryError()+throwException() into throwOutOfMemoryError()
     4        https://bugs.webkit.org/show_bug.cgi?id=159665
     5
     6        Reviewed by Saam Barati.
     7
     8        * API/JSTypedArray.cpp:
     9        (createTypedArray):
     10        * runtime/Error.cpp:
     11        (JSC::createOutOfMemoryError):
     12        * runtime/Error.h:
     13        * runtime/ExceptionHelpers.cpp:
     14        (JSC::throwOutOfMemoryError):
     15        * runtime/JSArrayBufferConstructor.cpp:
     16        (JSC::constructArrayBuffer):
     17        * runtime/JSArrayBufferPrototype.cpp:
     18        (JSC::arrayBufferProtoFuncSlice):
     19        * runtime/JSGenericTypedArrayViewInlines.h:
     20        (JSC::JSGenericTypedArrayView<Adaptor>::create):
     21        (JSC::JSGenericTypedArrayView<Adaptor>::createUninitialized):
     22
    1232016-07-15  Benjamin Poulain  <bpoulain@apple.com>
    224
  • trunk/Source/JavaScriptCore/runtime/Error.cpp

    r202890 r203320  
    9898    return ErrorInstance::create(exec, globalObject->vm(), globalObject->URIErrorConstructor()->errorStructure(), message, appender, TypeNothing, true);
    9999}
    100 
    101 JSObject* createOutOfMemoryError(ExecState* exec, ErrorInstance::SourceAppender appender)
    102 {
    103     return createError(exec, ASCIILiteral("Out of memory"), appender);
    104 }
    105 
    106100
    107101class FindFirstCallerFrameWithCodeblockFunctor {
     
    284278JSObject* createOutOfMemoryError(ExecState* exec)
    285279{
    286     return createOutOfMemoryError(exec, nullptr);
     280    return createError(exec, ASCIILiteral("Out of memory"), nullptr);
    287281}
    288282
  • trunk/Source/JavaScriptCore/runtime/Error.h

    r202890 r203320  
    4949JSObject* createNotEnoughArgumentsError(ExecState*, ErrorInstance::SourceAppender);
    5050JSObject* createURIError(ExecState*, const String&, ErrorInstance::SourceAppender);
    51 JSObject* createOutOfMemoryError(ExecState*, ErrorInstance::SourceAppender);
    5251
    5352
  • trunk/Source/JavaScriptCore/runtime/JSArrayBufferConstructor.cpp

    r202242 r203320  
    9595    auto buffer = ArrayBuffer::tryCreate(length, 1);
    9696    if (!buffer)
    97         return throwVMError(exec, createOutOfMemoryError(exec));
     97        return JSValue::encode(throwOutOfMemoryError(exec));
    9898
    9999    Structure* arrayBufferStructure = InternalFunction::createSubclassStructure(exec, exec->newTarget(), constructor->globalObject()->arrayBufferStructure());
  • trunk/Source/JavaScriptCore/runtime/JSArrayBufferPrototype.cpp

    r202890 r203320  
    6161    RefPtr<ArrayBuffer> newBuffer = thisObject->impl()->slice(begin, end);
    6262    if (!newBuffer)
    63         return throwVMError(exec, createOutOfMemoryError(exec));
     63        return JSValue::encode(throwOutOfMemoryError(exec));
    6464   
    6565    Structure* structure = callee->globalObject()->arrayBufferStructure();
  • trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewInlines.h

    r203204 r203320  
    5151    ConstructionContext context(exec->vm(), structure, length, sizeof(typename Adaptor::Type));
    5252    if (!context) {
    53         exec->vm().throwException(exec, createOutOfMemoryError(exec));
    54         return 0;
     53        throwOutOfMemoryError(exec);
     54        return nullptr;
    5555    }
    5656    JSGenericTypedArrayView* result =
     
    6969        ConstructionContext::DontInitialize);
    7070    if (!context) {
    71         exec->vm().throwException(exec, createOutOfMemoryError(exec));
    72         return 0;
     71        throwOutOfMemoryError(exec);
     72        return nullptr;
    7373    }
    7474    JSGenericTypedArrayView* result =
Note: See TracChangeset for help on using the changeset viewer.