Title: [203320] trunk/Source/_javascript_Core
Revision
203320
Author
[email protected]
Date
2016-07-15 21:16:30 -0700 (Fri, 15 Jul 2016)

Log Message

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

Patch by Benjamin Poulain <[email protected]> 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):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/API/JSTypedArray.cpp (203319 => 203320)


--- trunk/Source/_javascript_Core/API/JSTypedArray.cpp	2016-07-16 02:50:12 UTC (rev 203319)
+++ trunk/Source/_javascript_Core/API/JSTypedArray.cpp	2016-07-16 04:16:30 UTC (rev 203320)
@@ -103,7 +103,7 @@
 {
     JSGlobalObject* globalObject = exec->lexicalGlobalObject();
     if (!buffer) {
-        exec->vm().throwException(exec, createOutOfMemoryError(exec));
+        throwOutOfMemoryError(exec);
         return nullptr;
     }
     switch (type) {

Modified: trunk/Source/_javascript_Core/ChangeLog (203319 => 203320)


--- trunk/Source/_javascript_Core/ChangeLog	2016-07-16 02:50:12 UTC (rev 203319)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-07-16 04:16:30 UTC (rev 203320)
@@ -1,5 +1,27 @@
 2016-07-15  Benjamin Poulain  <[email protected]>
 
+        [JSC] Convert the remaining createOutOfMemoryError()+throwException() into throwOutOfMemoryError()
+        https://bugs.webkit.org/show_bug.cgi?id=159665
+
+        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):
+
+2016-07-15  Benjamin Poulain  <[email protected]>
+
         [JSC] Change some parameters based on a random search
         https://bugs.webkit.org/show_bug.cgi?id=158514
 

Modified: trunk/Source/_javascript_Core/runtime/Error.cpp (203319 => 203320)


--- trunk/Source/_javascript_Core/runtime/Error.cpp	2016-07-16 02:50:12 UTC (rev 203319)
+++ trunk/Source/_javascript_Core/runtime/Error.cpp	2016-07-16 04:16:30 UTC (rev 203320)
@@ -98,12 +98,6 @@
     return ErrorInstance::create(exec, globalObject->vm(), globalObject->URIErrorConstructor()->errorStructure(), message, appender, TypeNothing, true);
 }
 
-JSObject* createOutOfMemoryError(ExecState* exec, ErrorInstance::SourceAppender appender) 
-{
-    return createError(exec, ASCIILiteral("Out of memory"), appender);
-}
-
-
 class FindFirstCallerFrameWithCodeblockFunctor {
 public:
     FindFirstCallerFrameWithCodeblockFunctor(CallFrame* startCallFrame)
@@ -283,7 +277,7 @@
 
 JSObject* createOutOfMemoryError(ExecState* exec)
 {
-    return createOutOfMemoryError(exec, nullptr);
+    return createError(exec, ASCIILiteral("Out of memory"), nullptr);
 }
 
 

Modified: trunk/Source/_javascript_Core/runtime/Error.h (203319 => 203320)


--- trunk/Source/_javascript_Core/runtime/Error.h	2016-07-16 02:50:12 UTC (rev 203319)
+++ trunk/Source/_javascript_Core/runtime/Error.h	2016-07-16 04:16:30 UTC (rev 203320)
@@ -48,7 +48,6 @@
 JSObject* createTypeError(ExecState*, const String&, ErrorInstance::SourceAppender, RuntimeType);
 JSObject* createNotEnoughArgumentsError(ExecState*, ErrorInstance::SourceAppender);
 JSObject* createURIError(ExecState*, const String&, ErrorInstance::SourceAppender);
-JSObject* createOutOfMemoryError(ExecState*, ErrorInstance::SourceAppender);
 
 
 JS_EXPORT_PRIVATE JSObject* createError(ExecState*, const String&);

Modified: trunk/Source/_javascript_Core/runtime/JSArrayBufferConstructor.cpp (203319 => 203320)


--- trunk/Source/_javascript_Core/runtime/JSArrayBufferConstructor.cpp	2016-07-16 02:50:12 UTC (rev 203319)
+++ trunk/Source/_javascript_Core/runtime/JSArrayBufferConstructor.cpp	2016-07-16 04:16:30 UTC (rev 203320)
@@ -94,7 +94,7 @@
     
     auto buffer = ArrayBuffer::tryCreate(length, 1);
     if (!buffer)
-        return throwVMError(exec, createOutOfMemoryError(exec));
+        return JSValue::encode(throwOutOfMemoryError(exec));
 
     Structure* arrayBufferStructure = InternalFunction::createSubclassStructure(exec, exec->newTarget(), constructor->globalObject()->arrayBufferStructure());
     if (exec->hadException())

Modified: trunk/Source/_javascript_Core/runtime/JSArrayBufferPrototype.cpp (203319 => 203320)


--- trunk/Source/_javascript_Core/runtime/JSArrayBufferPrototype.cpp	2016-07-16 02:50:12 UTC (rev 203319)
+++ trunk/Source/_javascript_Core/runtime/JSArrayBufferPrototype.cpp	2016-07-16 04:16:30 UTC (rev 203320)
@@ -60,7 +60,7 @@
     
     RefPtr<ArrayBuffer> newBuffer = thisObject->impl()->slice(begin, end);
     if (!newBuffer)
-        return throwVMError(exec, createOutOfMemoryError(exec));
+        return JSValue::encode(throwOutOfMemoryError(exec));
     
     Structure* structure = callee->globalObject()->arrayBufferStructure();
     

Modified: trunk/Source/_javascript_Core/runtime/JSGenericTypedArrayViewInlines.h (203319 => 203320)


--- trunk/Source/_javascript_Core/runtime/JSGenericTypedArrayViewInlines.h	2016-07-16 02:50:12 UTC (rev 203319)
+++ trunk/Source/_javascript_Core/runtime/JSGenericTypedArrayViewInlines.h	2016-07-16 04:16:30 UTC (rev 203320)
@@ -50,8 +50,8 @@
 {
     ConstructionContext context(exec->vm(), structure, length, sizeof(typename Adaptor::Type));
     if (!context) {
-        exec->vm().throwException(exec, createOutOfMemoryError(exec));
-        return 0;
+        throwOutOfMemoryError(exec);
+        return nullptr;
     }
     JSGenericTypedArrayView* result =
         new (NotNull, allocateCell<JSGenericTypedArrayView>(exec->vm().heap))
@@ -68,8 +68,8 @@
         exec->vm(), structure, length, sizeof(typename Adaptor::Type),
         ConstructionContext::DontInitialize);
     if (!context) {
-        exec->vm().throwException(exec, createOutOfMemoryError(exec));
-        return 0;
+        throwOutOfMemoryError(exec);
+        return nullptr;
     }
     JSGenericTypedArrayView* result =
         new (NotNull, allocateCell<JSGenericTypedArrayView>(exec->vm().heap))
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to