Changeset 156079 in webkit


Ignore:
Timestamp:
Sep 18, 2013 8:12:09 PM (11 years ago)
Author:
weinig@apple.com
Message:

Replace use of OwnArrayPtr<Foo> with std::unique_ptr<Foo[]> in JavaScriptCore
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):

Location:
trunk/Source/JavaScriptCore
Files:
16 edited

Legend:

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

    r155734 r156079  
    3232#include "OpaqueJSString.h"
    3333#include <runtime/JSCJSValue.h>
    34 #include <wtf/OwnArrayPtr.h>
     34#include <wtf/StdLibExtras.h>
    3535
    3636JSStringRef JSStringCreateWithCFString(CFStringRef string)
     
    4848            return OpaqueJSString::create(lcharBuffer.data(), length).leakRef();
    4949
    50         OwnArrayPtr<UniChar> buffer = adoptArrayPtr(new UniChar[length]);
     50        auto buffer = std::make_unique<UniChar[]>(length);
    5151        CFStringGetCharacters(string, CFRangeMake(0, length), buffer.get());
    5252        COMPILE_ASSERT(sizeof(UniChar) == sizeof(UChar), unichar_and_uchar_must_be_same_size);
  • trunk/Source/JavaScriptCore/API/JSStringRefQt.cpp

    r146976 r156079  
    3333#include "OpaqueJSString.h"
    3434#include <runtime/JSCJSValue.h>
    35 #include <wtf/OwnArrayPtr.h>
    3635
    3736QString JSStringCopyQString(JSStringRef string)
  • trunk/Source/JavaScriptCore/ChangeLog

    r156067 r156079  
     12013-09-18  Sam Weinig  <sam@webkit.org>
     2
     3        Replace use of OwnArrayPtr<Foo> with std::unique_ptr<Foo[]> in JavaScriptCore
     4        https://bugs.webkit.org/show_bug.cgi?id=121583
     5
     6        Reviewed by Anders Carlsson.
     7
     8        * API/JSStringRefCF.cpp:
     9        (JSStringCreateWithCFString):
     10        * API/JSStringRefQt.cpp:
     11        * bytecompiler/BytecodeGenerator.cpp:
     12        (JSC::BytecodeGenerator::BytecodeGenerator):
     13        * dfg/DFGByteCodeParser.cpp:
     14        (JSC::DFG::ByteCodeParser::parseBlock):
     15        * dfg/DFGDisassembler.cpp:
     16        (JSC::DFG::Disassembler::dumpDisassembly):
     17        * runtime/Arguments.cpp:
     18        (JSC::Arguments::tearOff):
     19        * runtime/Arguments.h:
     20        (JSC::Arguments::isTornOff):
     21        (JSC::Arguments::allocateSlowArguments):
     22        * runtime/JSPropertyNameIterator.cpp:
     23        (JSC::JSPropertyNameIterator::JSPropertyNameIterator):
     24        * runtime/JSPropertyNameIterator.h:
     25        * runtime/JSSegmentedVariableObject.h:
     26        * runtime/JSVariableObject.h:
     27        * runtime/PropertyNameArray.h:
     28        * runtime/RegExp.cpp:
     29        * runtime/StructureChain.h:
     30        (JSC::StructureChain::finishCreation):
     31        * runtime/SymbolTable.h:
     32        (JSC::SharedSymbolTable::setSlowArguments):
     33
    1342013-09-18  Brent Fulgham  <bfulgham@apple.com>
    235
  • trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp

    r155729 r156079  
    4141#include "StrongInlines.h"
    4242#include "UnlinkedCodeBlock.h"
     43#include <wtf/StdLibExtras.h>
    4344#include <wtf/text/WTFString.h>
    4445
     
    263264    if (capturesAnyArgumentByName && !shouldTearOffArgumentsEagerly()) {
    264265        size_t parameterCount = m_symbolTable->parameterCount();
    265         OwnArrayPtr<SlowArgument> slowArguments = adoptArrayPtr(new SlowArgument[parameterCount]);
     266        auto slowArguments = std::make_unique<SlowArgument[]>(parameterCount);
    266267        for (size_t i = 0; i < parameterCount; ++i) {
    267268            if (!capturedArguments[i]) {
  • trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp

    r156047 r156079  
    4343#include <wtf/HashMap.h>
    4444#include <wtf/MathExtras.h>
     45#include <wtf/StdLibExtras.h>
    4546
    4647namespace JSC { namespace DFG {
     
    22432244            const unsigned maxRopeArguments = 3;
    22442245#endif
    2245             OwnArrayPtr<Node*> toStringNodes = adoptArrayPtr(new Node*[numOperands]);
     2246            auto toStringNodes = std::make_unique<Node*[]>(numOperands);
    22462247            for (int i = 0; i < numOperands; i++)
    22472248                toStringNodes[i] = addToGraph(ToString, get(startOperand - i));
  • trunk/Source/JavaScriptCore/dfg/DFGDisassembler.cpp

    r153296 r156079  
    3131#include "CodeBlockWithJITType.h"
    3232#include "DFGGraph.h"
     33#include <wtf/StdLibExtras.h>
    3334
    3435namespace JSC { namespace DFG {
     
    155156    else
    156157        amountOfNodeWhiteSpace = Graph::amountOfNodeWhiteSpace(context);
    157     OwnArrayPtr<char> prefixBuffer = adoptArrayPtr(new char[prefixLength + amountOfNodeWhiteSpace + 1]);
     158    auto prefixBuffer = std::make_unique<char[]>(prefixLength + amountOfNodeWhiteSpace + 1);
    158159    strcpy(prefixBuffer.get(), prefix);
    159160    for (int i = 0; i < amountOfNodeWhiteSpace; ++i)
  • trunk/Source/JavaScriptCore/runtime/Arguments.cpp

    r156047 r156079  
    312312    ASSERT(bitwise_cast<WriteBarrier<Unknown>*>(callFrame) == m_registers);
    313313   
    314     m_registerArray = adoptArrayPtr(new WriteBarrier<Unknown>[m_numArguments]);
     314    m_registerArray = std::make_unique<WriteBarrier<Unknown>[]>(m_numArguments);
    315315    m_registers = m_registerArray.get() - CallFrame::offsetFor(1) - 1;
    316316
     
    358358        return;
    359359   
    360     m_registerArray = adoptArrayPtr(new WriteBarrier<Unknown>[m_numArguments]);
     360    m_registerArray = std::make_unique<WriteBarrier<Unknown>[]>(m_numArguments);
    361361    m_registers = m_registerArray.get() - CallFrame::offsetFor(1) - 1;
    362362
  • trunk/Source/JavaScriptCore/runtime/Arguments.h

    r154422 r156079  
    3232#include "Interpreter.h"
    3333#include "ObjectConstructor.h"
     34#include <wtf/StdLibExtras.h>
    3435
    3536namespace JSC {
     
    8283    void tearOff(CallFrame*);
    8384    void tearOff(CallFrame*, InlineCallFrame*);
    84     bool isTornOff() const { return m_registerArray; }
     85    bool isTornOff() const { return m_registerArray.get(); }
    8586    void didTearOffActivation(ExecState*, JSActivation*);
    8687
     
    132133
    133134    WriteBarrierBase<Unknown>* m_registers;
    134     OwnArrayPtr<WriteBarrier<Unknown> > m_registerArray;
    135 
    136     OwnArrayPtr<SlowArgument> m_slowArguments;
     135    std::unique_ptr<WriteBarrier<Unknown>[]> m_registerArray;
     136
     137    std::unique_ptr<SlowArgument[]> m_slowArguments;
    137138
    138139    WriteBarrier<JSFunction> m_callee;
     
    161162    if (m_slowArguments)
    162163        return;
    163     m_slowArguments = adoptArrayPtr(new SlowArgument[m_numArguments]);
     164    m_slowArguments = std::make_unique<SlowArgument[]>(m_numArguments);
    164165    for (size_t i = 0; i < m_numArguments; ++i) {
    165166        ASSERT(m_slowArguments[i].status == SlowArgument::Normal);
  • trunk/Source/JavaScriptCore/runtime/JSPropertyNameIterator.cpp

    r155734 r156079  
    3131
    3232#include "JSGlobalObject.h"
     33#include <wtf/StdLibExtras.h>
    3334
    3435namespace JSC {
     
    4041    , m_numCacheableSlots(numCacheableSlots)
    4142    , m_jsStringsSize(propertyNameArrayData->propertyNameVector().size())
    42     , m_jsStrings(m_jsStringsSize ? adoptArrayPtr(new WriteBarrier<Unknown>[m_jsStringsSize]) : nullptr)
     43    , m_jsStrings(m_jsStringsSize ? std::make_unique<WriteBarrier<Unknown>[]>(m_jsStringsSize) : nullptr)
    4344{
    4445}
  • trunk/Source/JavaScriptCore/runtime/JSPropertyNameIterator.h

    r154038 r156079  
    3434#include "Operations.h"
    3535#include "PropertyNameArray.h"
     36#include <memory>
    3637
    3738namespace JSC {
     
    9697        uint32_t m_jsStringsSize;
    9798        unsigned m_cachedStructureInlineCapacity;
    98         OwnArrayPtr<WriteBarrier<Unknown> > m_jsStrings;
     99        std::unique_ptr<WriteBarrier<Unknown>[]> m_jsStrings;
    99100    };
    100101
  • trunk/Source/JavaScriptCore/runtime/JSSegmentedVariableObject.h

    r153170 r156079  
    3535#include "Register.h"
    3636#include "SymbolTable.h"
    37 #include <wtf/OwnArrayPtr.h>
    3837#include <wtf/SegmentedVector.h>
    3938
  • trunk/Source/JavaScriptCore/runtime/JSVariableObject.h

    r154038 r156079  
    3434#include "Register.h"
    3535#include "SymbolTable.h"
    36 #include <wtf/OwnArrayPtr.h>
    3736
    3837namespace JSC {
  • trunk/Source/JavaScriptCore/runtime/PropertyNameArray.h

    r148696 r156079  
    2525#include "Identifier.h"
    2626#include <wtf/HashSet.h>
    27 #include <wtf/OwnArrayPtr.h>
    2827#include <wtf/Vector.h>
    2928
  • trunk/Source/JavaScriptCore/runtime/RegExp.cpp

    r148696 r156079  
    3333#include <string.h>
    3434#include <wtf/Assertions.h>
    35 #include <wtf/OwnArrayPtr.h>
    3635
    3736#define REGEXP_FUNC_TEST_DATA_GEN 0
  • trunk/Source/JavaScriptCore/runtime/StructureChain.h

    r154038 r156079  
    3131#include "Structure.h"
    3232
    33 #include <wtf/OwnArrayPtr.h>
    3433#include <wtf/PassRefPtr.h>
    3534#include <wtf/RefCounted.h>
    3635#include <wtf/RefPtr.h>
     36#include <wtf/StdLibExtras.h>
    3737
    3838namespace JSC {
     
    7272                ++size;
    7373   
    74             m_vector = adoptArrayPtr(new WriteBarrier<Structure>[size + 1]);
     74            m_vector = std::make_unique<WriteBarrier<Structure>[]>(size + 1);
    7575
    7676            size_t i = 0;
     
    8383       
    8484        StructureChain(VM&, Structure*);
    85         OwnArrayPtr<WriteBarrier<Structure> > m_vector;
     85        std::unique_ptr<WriteBarrier<Structure>[]> m_vector;
    8686    };
    8787
  • trunk/Source/JavaScriptCore/runtime/SymbolTable.h

    r155711 r156079  
    3333#include "JSObject.h"
    3434#include "Watchpoint.h"
     35#include <memory>
    3536#include <wtf/HashTraits.h>
    3637#include <wtf/text/StringImpl.h>
     
    473474    // 0 if we don't capture any arguments; parameterCount() in length if we do.
    474475    const SlowArgument* slowArguments() { return m_slowArguments.get(); }
    475     void setSlowArguments(OwnArrayPtr<SlowArgument> slowArguments) { m_slowArguments = std::move(slowArguments); }
     476    void setSlowArguments(std::unique_ptr<SlowArgument[]> slowArguments) { m_slowArguments = std::move(slowArguments); }
    476477
    477478    DECLARE_EXPORT_INFO;
     
    493494    int m_captureEnd;
    494495
    495     OwnArrayPtr<SlowArgument> m_slowArguments;
     496    std::unique_ptr<SlowArgument[]> m_slowArguments;
    496497};
    497498
Note: See TracChangeset for help on using the changeset viewer.