Title: [156079] trunk/Source/_javascript_Core
Revision
156079
Author
wei...@apple.com
Date
2013-09-18 20:12:09 -0700 (Wed, 18 Sep 2013)

Log Message

Replace use of OwnArrayPtr<Foo> with std::unique_ptr<Foo[]> in _javascript_Core
https://bugs.webkit.org/show_bug.cgi?id=121583

Reviewed by Anders Carlsson.

* API/JSStringRefCF.cpp:
(JSStringCreateWithCFString):
* API/JSStringRefQt.cpp:
* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::BytecodeGenerator):
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::parseBlock):
* dfg/DFGDisassembler.cpp:
(JSC::DFG::Disassembler::dumpDisassembly):
* runtime/Arguments.cpp:
(JSC::Arguments::tearOff):
* runtime/Arguments.h:
(JSC::Arguments::isTornOff):
(JSC::Arguments::allocateSlowArguments):
* runtime/JSPropertyNameIterator.cpp:
(JSC::JSPropertyNameIterator::JSPropertyNameIterator):
* runtime/JSPropertyNameIterator.h:
* runtime/JSSegmentedVariableObject.h:
* runtime/JSVariableObject.h:
* runtime/PropertyNameArray.h:
* runtime/RegExp.cpp:
* runtime/StructureChain.h:
(JSC::StructureChain::finishCreation):
* runtime/SymbolTable.h:
(JSC::SharedSymbolTable::setSlowArguments):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/API/JSStringRefCF.cpp (156078 => 156079)


--- trunk/Source/_javascript_Core/API/JSStringRefCF.cpp	2013-09-19 03:03:48 UTC (rev 156078)
+++ trunk/Source/_javascript_Core/API/JSStringRefCF.cpp	2013-09-19 03:12:09 UTC (rev 156079)
@@ -31,7 +31,7 @@
 #include "JSStringRef.h"
 #include "OpaqueJSString.h"
 #include <runtime/JSCJSValue.h>
-#include <wtf/OwnArrayPtr.h>
+#include <wtf/StdLibExtras.h>
 
 JSStringRef JSStringCreateWithCFString(CFStringRef string)
 {
@@ -47,7 +47,7 @@
         if (static_cast<size_t>(convertedSize) == length && static_cast<size_t>(usedBufferLength) == length)
             return OpaqueJSString::create(lcharBuffer.data(), length).leakRef();
 
-        OwnArrayPtr<UniChar> buffer = adoptArrayPtr(new UniChar[length]);
+        auto buffer = std::make_unique<UniChar[]>(length);
         CFStringGetCharacters(string, CFRangeMake(0, length), buffer.get());
         COMPILE_ASSERT(sizeof(UniChar) == sizeof(UChar), unichar_and_uchar_must_be_same_size);
         return OpaqueJSString::create(reinterpret_cast<UChar*>(buffer.get()), length).leakRef();

Modified: trunk/Source/_javascript_Core/API/JSStringRefQt.cpp (156078 => 156079)


--- trunk/Source/_javascript_Core/API/JSStringRefQt.cpp	2013-09-19 03:03:48 UTC (rev 156078)
+++ trunk/Source/_javascript_Core/API/JSStringRefQt.cpp	2013-09-19 03:12:09 UTC (rev 156079)
@@ -32,7 +32,6 @@
 #include "JSStringRef.h"
 #include "OpaqueJSString.h"
 #include <runtime/JSCJSValue.h>
-#include <wtf/OwnArrayPtr.h>
 
 QString JSStringCopyQString(JSStringRef string)
 {

Modified: trunk/Source/_javascript_Core/ChangeLog (156078 => 156079)


--- trunk/Source/_javascript_Core/ChangeLog	2013-09-19 03:03:48 UTC (rev 156078)
+++ trunk/Source/_javascript_Core/ChangeLog	2013-09-19 03:12:09 UTC (rev 156079)
@@ -1,3 +1,36 @@
+2013-09-18  Sam Weinig  <s...@webkit.org>
+
+        Replace use of OwnArrayPtr<Foo> with std::unique_ptr<Foo[]> in _javascript_Core
+        https://bugs.webkit.org/show_bug.cgi?id=121583
+
+        Reviewed by Anders Carlsson.
+
+        * API/JSStringRefCF.cpp:
+        (JSStringCreateWithCFString):
+        * API/JSStringRefQt.cpp:
+        * bytecompiler/BytecodeGenerator.cpp:
+        (JSC::BytecodeGenerator::BytecodeGenerator):
+        * dfg/DFGByteCodeParser.cpp:
+        (JSC::DFG::ByteCodeParser::parseBlock):
+        * dfg/DFGDisassembler.cpp:
+        (JSC::DFG::Disassembler::dumpDisassembly):
+        * runtime/Arguments.cpp:
+        (JSC::Arguments::tearOff):
+        * runtime/Arguments.h:
+        (JSC::Arguments::isTornOff):
+        (JSC::Arguments::allocateSlowArguments):
+        * runtime/JSPropertyNameIterator.cpp:
+        (JSC::JSPropertyNameIterator::JSPropertyNameIterator):
+        * runtime/JSPropertyNameIterator.h:
+        * runtime/JSSegmentedVariableObject.h:
+        * runtime/JSVariableObject.h:
+        * runtime/PropertyNameArray.h:
+        * runtime/RegExp.cpp:
+        * runtime/StructureChain.h:
+        (JSC::StructureChain::finishCreation):
+        * runtime/SymbolTable.h:
+        (JSC::SharedSymbolTable::setSlowArguments):
+
 2013-09-18  Brent Fulgham  <bfulg...@apple.com>
 
         [Windows] Unreviewed build fix after r156064.

Modified: trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp (156078 => 156079)


--- trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp	2013-09-19 03:03:48 UTC (rev 156078)
+++ trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp	2013-09-19 03:12:09 UTC (rev 156079)
@@ -40,6 +40,7 @@
 #include "Options.h"
 #include "StrongInlines.h"
 #include "UnlinkedCodeBlock.h"
+#include <wtf/StdLibExtras.h>
 #include <wtf/text/WTFString.h>
 
 using namespace std;
@@ -262,7 +263,7 @@
 
     if (capturesAnyArgumentByName && !shouldTearOffArgumentsEagerly()) {
         size_t parameterCount = m_symbolTable->parameterCount();
-        OwnArrayPtr<SlowArgument> slowArguments = adoptArrayPtr(new SlowArgument[parameterCount]);
+        auto slowArguments = std::make_unique<SlowArgument[]>(parameterCount);
         for (size_t i = 0; i < parameterCount; ++i) {
             if (!capturedArguments[i]) {
                 ASSERT(slowArguments[i].status == SlowArgument::Normal);

Modified: trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp (156078 => 156079)


--- trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp	2013-09-19 03:03:48 UTC (rev 156078)
+++ trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp	2013-09-19 03:12:09 UTC (rev 156079)
@@ -42,6 +42,7 @@
 #include <wtf/CommaPrinter.h>
 #include <wtf/HashMap.h>
 #include <wtf/MathExtras.h>
+#include <wtf/StdLibExtras.h>
 
 namespace JSC { namespace DFG {
 
@@ -2242,7 +2243,7 @@
 #else
             const unsigned maxRopeArguments = 3;
 #endif
-            OwnArrayPtr<Node*> toStringNodes = adoptArrayPtr(new Node*[numOperands]);
+            auto toStringNodes = std::make_unique<Node*[]>(numOperands);
             for (int i = 0; i < numOperands; i++)
                 toStringNodes[i] = addToGraph(ToString, get(startOperand - i));
 

Modified: trunk/Source/_javascript_Core/dfg/DFGDisassembler.cpp (156078 => 156079)


--- trunk/Source/_javascript_Core/dfg/DFGDisassembler.cpp	2013-09-19 03:03:48 UTC (rev 156078)
+++ trunk/Source/_javascript_Core/dfg/DFGDisassembler.cpp	2013-09-19 03:12:09 UTC (rev 156079)
@@ -30,6 +30,7 @@
 
 #include "CodeBlockWithJITType.h"
 #include "DFGGraph.h"
+#include <wtf/StdLibExtras.h>
 
 namespace JSC { namespace DFG {
 
@@ -154,7 +155,7 @@
         amountOfNodeWhiteSpace = 0;
     else
         amountOfNodeWhiteSpace = Graph::amountOfNodeWhiteSpace(context);
-    OwnArrayPtr<char> prefixBuffer = adoptArrayPtr(new char[prefixLength + amountOfNodeWhiteSpace + 1]);
+    auto prefixBuffer = std::make_unique<char[]>(prefixLength + amountOfNodeWhiteSpace + 1);
     strcpy(prefixBuffer.get(), prefix);
     for (int i = 0; i < amountOfNodeWhiteSpace; ++i)
         prefixBuffer[i + prefixLength] = ' ';

Modified: trunk/Source/_javascript_Core/runtime/Arguments.cpp (156078 => 156079)


--- trunk/Source/_javascript_Core/runtime/Arguments.cpp	2013-09-19 03:03:48 UTC (rev 156078)
+++ trunk/Source/_javascript_Core/runtime/Arguments.cpp	2013-09-19 03:12:09 UTC (rev 156079)
@@ -311,7 +311,7 @@
     // Must be called for the same call frame from which it was created.
     ASSERT(bitwise_cast<WriteBarrier<Unknown>*>(callFrame) == m_registers);
     
-    m_registerArray = adoptArrayPtr(new WriteBarrier<Unknown>[m_numArguments]);
+    m_registerArray = std::make_unique<WriteBarrier<Unknown>[]>(m_numArguments);
     m_registers = m_registerArray.get() - CallFrame::offsetFor(1) - 1;
 
     // If we have a captured argument that logically aliases activation storage,
@@ -357,7 +357,7 @@
     if (!m_numArguments)
         return;
     
-    m_registerArray = adoptArrayPtr(new WriteBarrier<Unknown>[m_numArguments]);
+    m_registerArray = std::make_unique<WriteBarrier<Unknown>[]>(m_numArguments);
     m_registers = m_registerArray.get() - CallFrame::offsetFor(1) - 1;
 
     tearOffForInlineCallFrame(

Modified: trunk/Source/_javascript_Core/runtime/Arguments.h (156078 => 156079)


--- trunk/Source/_javascript_Core/runtime/Arguments.h	2013-09-19 03:03:48 UTC (rev 156078)
+++ trunk/Source/_javascript_Core/runtime/Arguments.h	2013-09-19 03:12:09 UTC (rev 156079)
@@ -31,6 +31,7 @@
 #include "JSGlobalObject.h"
 #include "Interpreter.h"
 #include "ObjectConstructor.h"
+#include <wtf/StdLibExtras.h>
 
 namespace JSC {
 
@@ -81,7 +82,7 @@
     void copyToArguments(ExecState*, CallFrame*, uint32_t length);
     void tearOff(CallFrame*);
     void tearOff(CallFrame*, InlineCallFrame*);
-    bool isTornOff() const { return m_registerArray; }
+    bool isTornOff() const { return m_registerArray.get(); }
     void didTearOffActivation(ExecState*, JSActivation*);
 
     static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype) 
@@ -131,9 +132,9 @@
     bool m_isStrictMode;
 
     WriteBarrierBase<Unknown>* m_registers;
-    OwnArrayPtr<WriteBarrier<Unknown> > m_registerArray;
+    std::unique_ptr<WriteBarrier<Unknown>[]> m_registerArray;
 
-    OwnArrayPtr<SlowArgument> m_slowArguments;
+    std::unique_ptr<SlowArgument[]> m_slowArguments;
 
     WriteBarrier<JSFunction> m_callee;
 };
@@ -160,7 +161,7 @@
 {
     if (m_slowArguments)
         return;
-    m_slowArguments = adoptArrayPtr(new SlowArgument[m_numArguments]);
+    m_slowArguments = std::make_unique<SlowArgument[]>(m_numArguments);
     for (size_t i = 0; i < m_numArguments; ++i) {
         ASSERT(m_slowArguments[i].status == SlowArgument::Normal);
         m_slowArguments[i].index = CallFrame::argumentOffset(i);

Modified: trunk/Source/_javascript_Core/runtime/JSPropertyNameIterator.cpp (156078 => 156079)


--- trunk/Source/_javascript_Core/runtime/JSPropertyNameIterator.cpp	2013-09-19 03:03:48 UTC (rev 156078)
+++ trunk/Source/_javascript_Core/runtime/JSPropertyNameIterator.cpp	2013-09-19 03:12:09 UTC (rev 156079)
@@ -30,6 +30,7 @@
 #include "JSPropertyNameIterator.h"
 
 #include "JSGlobalObject.h"
+#include <wtf/StdLibExtras.h>
 
 namespace JSC {
 
@@ -39,7 +40,7 @@
     : JSCell(exec->vm(), exec->vm().propertyNameIteratorStructure.get())
     , m_numCacheableSlots(numCacheableSlots)
     , m_jsStringsSize(propertyNameArrayData->propertyNameVector().size())
-    , m_jsStrings(m_jsStringsSize ? adoptArrayPtr(new WriteBarrier<Unknown>[m_jsStringsSize]) : nullptr)
+    , m_jsStrings(m_jsStringsSize ? std::make_unique<WriteBarrier<Unknown>[]>(m_jsStringsSize) : nullptr)
 {
 }
 

Modified: trunk/Source/_javascript_Core/runtime/JSPropertyNameIterator.h (156078 => 156079)


--- trunk/Source/_javascript_Core/runtime/JSPropertyNameIterator.h	2013-09-19 03:03:48 UTC (rev 156078)
+++ trunk/Source/_javascript_Core/runtime/JSPropertyNameIterator.h	2013-09-19 03:12:09 UTC (rev 156079)
@@ -33,6 +33,7 @@
 #include "JSString.h"
 #include "Operations.h"
 #include "PropertyNameArray.h"
+#include <memory>
 
 namespace JSC {
 
@@ -95,7 +96,7 @@
         uint32_t m_numCacheableSlots;
         uint32_t m_jsStringsSize;
         unsigned m_cachedStructureInlineCapacity;
-        OwnArrayPtr<WriteBarrier<Unknown> > m_jsStrings;
+        std::unique_ptr<WriteBarrier<Unknown>[]> m_jsStrings;
     };
 
     ALWAYS_INLINE JSPropertyNameIterator* Register::propertyNameIterator() const

Modified: trunk/Source/_javascript_Core/runtime/JSSegmentedVariableObject.h (156078 => 156079)


--- trunk/Source/_javascript_Core/runtime/JSSegmentedVariableObject.h	2013-09-19 03:03:48 UTC (rev 156078)
+++ trunk/Source/_javascript_Core/runtime/JSSegmentedVariableObject.h	2013-09-19 03:12:09 UTC (rev 156079)
@@ -34,7 +34,6 @@
 #include "JSSymbolTableObject.h"
 #include "Register.h"
 #include "SymbolTable.h"
-#include <wtf/OwnArrayPtr.h>
 #include <wtf/SegmentedVector.h>
 
 namespace JSC {

Modified: trunk/Source/_javascript_Core/runtime/JSVariableObject.h (156078 => 156079)


--- trunk/Source/_javascript_Core/runtime/JSVariableObject.h	2013-09-19 03:03:48 UTC (rev 156078)
+++ trunk/Source/_javascript_Core/runtime/JSVariableObject.h	2013-09-19 03:12:09 UTC (rev 156079)
@@ -33,7 +33,6 @@
 #include "JSSymbolTableObject.h"
 #include "Register.h"
 #include "SymbolTable.h"
-#include <wtf/OwnArrayPtr.h>
 
 namespace JSC {
 

Modified: trunk/Source/_javascript_Core/runtime/PropertyNameArray.h (156078 => 156079)


--- trunk/Source/_javascript_Core/runtime/PropertyNameArray.h	2013-09-19 03:03:48 UTC (rev 156078)
+++ trunk/Source/_javascript_Core/runtime/PropertyNameArray.h	2013-09-19 03:12:09 UTC (rev 156079)
@@ -24,7 +24,6 @@
 #include "CallFrame.h"
 #include "Identifier.h"
 #include <wtf/HashSet.h>
-#include <wtf/OwnArrayPtr.h>
 #include <wtf/Vector.h>
 
 namespace JSC {

Modified: trunk/Source/_javascript_Core/runtime/RegExp.cpp (156078 => 156079)


--- trunk/Source/_javascript_Core/runtime/RegExp.cpp	2013-09-19 03:03:48 UTC (rev 156078)
+++ trunk/Source/_javascript_Core/runtime/RegExp.cpp	2013-09-19 03:12:09 UTC (rev 156079)
@@ -32,7 +32,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <wtf/Assertions.h>
-#include <wtf/OwnArrayPtr.h>
 
 #define REGEXP_FUNC_TEST_DATA_GEN 0
 

Modified: trunk/Source/_javascript_Core/runtime/StructureChain.h (156078 => 156079)


--- trunk/Source/_javascript_Core/runtime/StructureChain.h	2013-09-19 03:03:48 UTC (rev 156078)
+++ trunk/Source/_javascript_Core/runtime/StructureChain.h	2013-09-19 03:12:09 UTC (rev 156079)
@@ -30,10 +30,10 @@
 #include "JSObject.h"
 #include "Structure.h"
 
-#include <wtf/OwnArrayPtr.h>
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 #include <wtf/RefPtr.h>
+#include <wtf/StdLibExtras.h>
 
 namespace JSC {
 
@@ -71,7 +71,7 @@
             for (Structure* current = head; current; current = current->storedPrototype().isNull() ? 0 : asObject(current->storedPrototype())->structure())
                 ++size;
     
-            m_vector = adoptArrayPtr(new WriteBarrier<Structure>[size + 1]);
+            m_vector = std::make_unique<WriteBarrier<Structure>[]>(size + 1);
 
             size_t i = 0;
             for (Structure* current = head; current; current = current->storedPrototype().isNull() ? 0 : asObject(current->storedPrototype())->structure())
@@ -82,7 +82,7 @@
         friend class LLIntOffsetsExtractor;
         
         StructureChain(VM&, Structure*);
-        OwnArrayPtr<WriteBarrier<Structure> > m_vector;
+        std::unique_ptr<WriteBarrier<Structure>[]> m_vector;
     };
 
 } // namespace JSC

Modified: trunk/Source/_javascript_Core/runtime/SymbolTable.h (156078 => 156079)


--- trunk/Source/_javascript_Core/runtime/SymbolTable.h	2013-09-19 03:03:48 UTC (rev 156078)
+++ trunk/Source/_javascript_Core/runtime/SymbolTable.h	2013-09-19 03:12:09 UTC (rev 156079)
@@ -32,6 +32,7 @@
 #include "ConcurrentJITLock.h"
 #include "JSObject.h"
 #include "Watchpoint.h"
+#include <memory>
 #include <wtf/HashTraits.h>
 #include <wtf/text/StringImpl.h>
 
@@ -472,7 +473,7 @@
 
     // 0 if we don't capture any arguments; parameterCount() in length if we do.
     const SlowArgument* slowArguments() { return m_slowArguments.get(); }
-    void setSlowArguments(OwnArrayPtr<SlowArgument> slowArguments) { m_slowArguments = std::move(slowArguments); }
+    void setSlowArguments(std::unique_ptr<SlowArgument[]> slowArguments) { m_slowArguments = std::move(slowArguments); }
 
     DECLARE_EXPORT_INFO;
 
@@ -492,7 +493,7 @@
     int m_captureStart;
     int m_captureEnd;
 
-    OwnArrayPtr<SlowArgument> m_slowArguments;
+    std::unique_ptr<SlowArgument[]> m_slowArguments;
 };
 
 } // namespace JSC
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to