Clean up some possible RefPtr to PassRefPtr churn
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 May 2015 01:34:08 +0000 (01:34 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 May 2015 01:34:08 +0000 (01:34 +0000)
https://bugs.webkit.org/show_bug.cgi?id=144779

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2015-05-13
Reviewed by Darin Adler.

* runtime/GenericTypedArrayViewInlines.h:
(JSC::GenericTypedArrayView<Adaptor>::create):
(JSC::GenericTypedArrayView<Adaptor>::createUninitialized):
* runtime/JSArrayBufferConstructor.cpp:
(JSC::constructArrayBuffer):
* runtime/Structure.cpp:
(JSC::Structure::toStructureShape):
* runtime/TypedArrayBase.h:
(JSC::TypedArrayBase::create):
(JSC::TypedArrayBase::createUninitialized):
* tools/FunctionOverrides.cpp:
(JSC::initializeOverrideInfo):
Release the last use of a RefPtr as it is passed on.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@184325 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/GenericTypedArrayViewInlines.h
Source/JavaScriptCore/runtime/JSArrayBufferConstructor.cpp
Source/JavaScriptCore/runtime/Structure.cpp
Source/JavaScriptCore/runtime/TypedArrayBase.h
Source/JavaScriptCore/tools/FunctionOverrides.cpp
Source/WebCore/platform/graphics/ISOVTTCue.cpp

index d3ec7af..f83089c 100644 (file)
@@ -1,5 +1,26 @@
 2015-05-13  Joseph Pecoraro  <pecoraro@apple.com>
 
+        Clean up some possible RefPtr to PassRefPtr churn
+        https://bugs.webkit.org/show_bug.cgi?id=144779
+
+        Reviewed by Darin Adler.
+
+        * runtime/GenericTypedArrayViewInlines.h:
+        (JSC::GenericTypedArrayView<Adaptor>::create):
+        (JSC::GenericTypedArrayView<Adaptor>::createUninitialized):
+        * runtime/JSArrayBufferConstructor.cpp:
+        (JSC::constructArrayBuffer):
+        * runtime/Structure.cpp:
+        (JSC::Structure::toStructureShape):
+        * runtime/TypedArrayBase.h:
+        (JSC::TypedArrayBase::create):
+        (JSC::TypedArrayBase::createUninitialized):
+        * tools/FunctionOverrides.cpp:
+        (JSC::initializeOverrideInfo):
+        Release the last use of a RefPtr as it is passed on.
+
+2015-05-13  Joseph Pecoraro  <pecoraro@apple.com>
+
         ES6: Allow duplicate property names
         https://bugs.webkit.org/show_bug.cgi?id=142895
 
index ab69be5..e323ab2 100644 (file)
@@ -45,7 +45,7 @@ PassRefPtr<GenericTypedArrayView<Adaptor>> GenericTypedArrayView<Adaptor>::creat
     RefPtr<ArrayBuffer> buffer = ArrayBuffer::create(length, sizeof(typename Adaptor::Type));
     if (!buffer)
         return 0;
-    return create(buffer, 0, length);
+    return create(buffer.release(), 0, length);
 }
 
 template<typename Adaptor>
@@ -54,7 +54,7 @@ PassRefPtr<GenericTypedArrayView<Adaptor>> GenericTypedArrayView<Adaptor>::creat
 {
     RefPtr<GenericTypedArrayView> result = create(length);
     memcpy(result->data(), array, length * sizeof(typename Adaptor::Type));
-    return result;
+    return result.release();
 }
 
 template<typename Adaptor>
@@ -67,7 +67,7 @@ PassRefPtr<GenericTypedArrayView<Adaptor>> GenericTypedArrayView<Adaptor>::creat
         return nullptr;
     }
     
-    return adoptRef(new GenericTypedArrayView(buffer, byteOffset, length));
+    return adoptRef(new GenericTypedArrayView(buffer.release(), byteOffset, length));
 }
 
 template<typename Adaptor>
@@ -78,7 +78,7 @@ GenericTypedArrayView<Adaptor>::createUninitialized(unsigned length)
         ArrayBuffer::createUninitialized(length, sizeof(typename Adaptor::Type));
     if (!buffer)
         return 0;
-    return create(buffer, 0, length);
+    return create(buffer.release(), 0, length);
 }
 
 template<typename Adaptor>
index 41afbe1..3d14a9e 100644 (file)
@@ -95,7 +95,7 @@ static EncodedJSValue JSC_HOST_CALL constructArrayBuffer(ExecState* exec)
         return throwVMError(exec, createOutOfMemoryError(exec));
     
     JSArrayBuffer* result = JSArrayBuffer::create(
-        exec->vm(), constructor->globalObject()->arrayBufferStructure(), buffer);
+        exec->vm(), constructor->globalObject()->arrayBufferStructure(), buffer.release());
     
     return JSValue::encode(result);
 }
index 9998578..c1f714d 100644 (file)
@@ -1052,7 +1052,6 @@ PassRefPtr<StructureShape> Structure::toStructureShape(JSValue value)
                 curShape->addProperty(structure->m_nameInPrevious.get());
         }
 
-        
         if (JSObject* curObject = curValue.getObject())
             curShape->setConstructorName(JSObject::calculatedClassName(curObject));
         else
@@ -1066,7 +1065,7 @@ PassRefPtr<StructureShape> Structure::toStructureShape(JSValue value)
         if (curStructure->storedPrototypeStructure()) {
             RefPtr<StructureShape> newShape = StructureShape::create();
             curShape->setProto(newShape);
-            curShape = newShape;
+            curShape = newShape.release();
             curValue = curStructure->storedPrototype();
         }
 
index 8694b55..d648fcd 100644 (file)
@@ -94,7 +94,7 @@ protected:
         RefPtr<ArrayBuffer> buffer = ArrayBuffer::create(length, sizeof(T));
         if (!buffer.get())
             return 0;
-        return create<Subclass>(buffer, 0, length);
+        return create<Subclass>(buffer.release(), 0, length);
     }
 
     template <class Subclass>
@@ -104,7 +104,7 @@ protected:
         if (a)
             for (unsigned i = 0; i < length; ++i)
                 a->set(i, array[i]);
-        return a;
+        return a.release();
     }
 
     template <class Subclass>
@@ -114,7 +114,7 @@ protected:
         if (!verifySubRange<T>(buf, byteOffset, length))
             return 0;
 
-        return adoptRef(new Subclass(buf, byteOffset, length));
+        return adoptRef(new Subclass(buf.release(), byteOffset, length));
     }
 
     template <class Subclass>
@@ -123,7 +123,7 @@ protected:
         RefPtr<ArrayBuffer> buffer = ArrayBuffer::createUninitialized(length, sizeof(T));
         if (!buffer.get())
             return 0;
-        return create<Subclass>(buffer, 0, length);
+        return create<Subclass>(buffer.release(), 0, length);
     }
 
     template <class Subclass>
index 23531bb..2034d60 100644 (file)
@@ -127,7 +127,7 @@ static void initializeOverrideInfo(const SourceCode& origCode, const String& new
     info.typeProfilingEndOffset = newProviderStr.length() - 1;
 
     info.sourceCode =
-        SourceCode(newProvider, info.typeProfilingStartOffset, info.typeProfilingEndOffset + 1, 1, 1);
+        SourceCode(newProvider.release(), info.typeProfilingStartOffset, info.typeProfilingEndOffset + 1, 1, 1);
 }
     
 bool FunctionOverrides::initializeOverrideFor(const SourceCode& origCode, FunctionOverrides::OverrideInfo& result)
index 8a96d8b..f231948 100644 (file)
@@ -30,6 +30,8 @@
 #include <runtime/ArrayBuffer.h>
 #include <runtime/DataView.h>
 #include <runtime/Int8Array.h>
+#include <runtime/JSCInlines.h>
+#include <runtime/TypedArrayInlines.h>
 #include <wtf/NeverDestroyed.h>
 #include <wtf/text/CString.h>
 #include <wtf/text/StringBuilder.h>