Changeset 176553 in webkit


Ignore:
Timestamp:
Nov 27, 2014 4:51:32 PM (9 years ago)
Author:
gyuyoung.kim@samsung.com
Message:

Use std::unique_ptr instead of OwnPtr in JSC classes
https://bugs.webkit.org/show_bug.cgi?id=139009

Reviewed by Filip Pizlo.

As a step of using std::unique_ptr<>, this patch replaces OwnPtr with
std::unique_ptr<>|std::make_unique<>.

  • bytecode/DFGExitProfile.cpp:

(JSC::DFG::ExitProfile::add):

  • bytecode/DFGExitProfile.h:
  • bytecode/LazyOperandValueProfile.cpp:

(JSC::CompressedLazyOperandValueProfileHolder::add):

  • bytecode/LazyOperandValueProfile.h:
  • heap/MarkedBlock.cpp:

(JSC::MarkedBlock::specializedSweep):
(JSC::MarkedBlock::stopAllocating):

  • heap/MarkedBlock.h:

(JSC::MarkedBlock::clearNewlyAllocated):

  • inspector/ContentSearchUtilities.cpp:

(Inspector::ContentSearchUtilities::findMagicComment):

  • runtime/RegExp.cpp:

(JSC::RegExp::invalidateCode):

  • runtime/RegExp.h:
  • yarr/RegularExpression.cpp:

(JSC::Yarr::RegularExpression::Private::compile):
(JSC::Yarr::RegularExpression::isValid):

  • yarr/YarrInterpreter.cpp:

(JSC::Yarr::ByteCompiler::compile):
(JSC::Yarr::ByteCompiler::regexBegin):
(JSC::Yarr::byteCompile):

  • yarr/YarrInterpreter.h:

(JSC::Yarr::BytecodePattern::BytecodePattern):

Location:
trunk/Source/JavaScriptCore
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r176533 r176553  
     12014-11-27  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
     2
     3        Use std::unique_ptr instead of OwnPtr in JSC classes
     4        https://bugs.webkit.org/show_bug.cgi?id=139009
     5
     6        Reviewed by Filip Pizlo.
     7
     8        As a step of using std::unique_ptr<>, this patch replaces OwnPtr with
     9        std::unique_ptr<>|std::make_unique<>.
     10
     11        * bytecode/DFGExitProfile.cpp:
     12        (JSC::DFG::ExitProfile::add):
     13        * bytecode/DFGExitProfile.h:
     14        * bytecode/LazyOperandValueProfile.cpp:
     15        (JSC::CompressedLazyOperandValueProfileHolder::add):
     16        * bytecode/LazyOperandValueProfile.h:
     17        * heap/MarkedBlock.cpp:
     18        (JSC::MarkedBlock::specializedSweep):
     19        (JSC::MarkedBlock::stopAllocating):
     20        * heap/MarkedBlock.h:
     21        (JSC::MarkedBlock::clearNewlyAllocated):
     22        * inspector/ContentSearchUtilities.cpp:
     23        (Inspector::ContentSearchUtilities::findMagicComment):
     24        * runtime/RegExp.cpp:
     25        (JSC::RegExp::invalidateCode):
     26        * runtime/RegExp.h:
     27        * yarr/RegularExpression.cpp:
     28        (JSC::Yarr::RegularExpression::Private::compile):
     29        (JSC::Yarr::RegularExpression::isValid):
     30        * yarr/YarrInterpreter.cpp:
     31        (JSC::Yarr::ByteCompiler::compile):
     32        (JSC::Yarr::ByteCompiler::regexBegin):
     33        (JSC::Yarr::byteCompile):
     34        * yarr/YarrInterpreter.h:
     35        (JSC::Yarr::BytecodePattern::BytecodePattern):
     36
    1372014-11-24  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
    238
  • trunk/Source/JavaScriptCore/bytecode/DFGExitProfile.h

    r176533 r176553  
    3333#include "ExitingJITType.h"
    3434#include <wtf/HashSet.h>
    35 #include <wtf/OwnPtr.h>
    3635#include <wtf/Vector.h>
    3736
  • trunk/Source/JavaScriptCore/bytecode/LazyOperandValueProfile.cpp

    r163844 r176553  
    4747{
    4848    if (!m_data)
    49         m_data = adoptPtr(new LazyOperandValueProfile::List());
     49        m_data = std::make_unique<LazyOperandValueProfile::List>();
    5050    else {
    5151        for (unsigned i = 0; i < m_data->size(); ++i) {
  • trunk/Source/JavaScriptCore/bytecode/LazyOperandValueProfile.h

    r161364 r176553  
    3232#include <wtf/HashMap.h>
    3333#include <wtf/Noncopyable.h>
    34 #include <wtf/OwnPtr.h>
    3534#include <wtf/SegmentedVector.h>
    3635
     
    162161private:
    163162    friend class LazyOperandValueProfileParser;
    164     OwnPtr<LazyOperandValueProfile::List> m_data;
     163    std::unique_ptr<LazyOperandValueProfile::List> m_data;
    165164};
    166165
  • trunk/Source/JavaScriptCore/heap/MarkedBlock.cpp

    r171953 r176553  
    103103    // otherwise we would lose information on what's currently alive.
    104104    if (sweepMode == SweepToFreeList && m_newlyAllocated)
    105         m_newlyAllocated.clear();
     105        m_newlyAllocated = nullptr;
    106106
    107107    m_state = ((sweepMode == SweepToFreeList) ? FreeListed : Marked);
     
    191191   
    192192    ASSERT(!m_newlyAllocated);
    193     m_newlyAllocated = adoptPtr(new WTF::Bitmap<atomsPerBlock>());
     193    m_newlyAllocated = std::make_unique<WTF::Bitmap<atomsPerBlock>>();
    194194
    195195    SetNewlyAllocatedFunctor functor(this);
  • trunk/Source/JavaScriptCore/heap/MarkedBlock.h

    r169284 r176553  
    210210        WTF::Bitmap<atomsPerBlock, WTF::BitmapNotAtomic, uint8_t> m_rememberedSet;
    211211#endif
    212         OwnPtr<WTF::Bitmap<atomsPerBlock>> m_newlyAllocated;
     212        std::unique_ptr<WTF::Bitmap<atomsPerBlock>> m_newlyAllocated;
    213213
    214214        DestructorType m_destructorType;
     
    401401    {
    402402        if (m_newlyAllocated) {
    403             m_newlyAllocated.clear();
     403            m_newlyAllocated = nullptr;
    404404            return true;
    405405        }
  • trunk/Source/JavaScriptCore/runtime/RegExp.cpp

    r173370 r176553  
    503503    m_regExpJITCode.clear();
    504504#endif
    505     m_regExpBytecode.clear();
     505    m_regExpBytecode = nullptr;
    506506}
    507507
  • trunk/Source/JavaScriptCore/runtime/RegExp.h

    r173269 r176553  
    131131    Yarr::YarrCodeBlock m_regExpJITCode;
    132132#endif
    133     OwnPtr<Yarr::BytecodePattern> m_regExpBytecode;
     133    std::unique_ptr<Yarr::BytecodePattern> m_regExpBytecode;
    134134};
    135135
  • trunk/Source/JavaScriptCore/yarr/RegularExpression.cpp

    r165676 r176553  
     1
    12/*
    23 * Copyright (C) 2004, 2008, 2009 Apple Inc. All rights reserved.
     
    4546
    4647    unsigned m_numSubpatterns;
    47     OwnPtr<JSC::Yarr::BytecodePattern> m_regExpByteCode;
     48    std::unique_ptr<JSC::Yarr::BytecodePattern> m_regExpByteCode;
    4849
    4950private:
     
    5556    }
    5657
    57     PassOwnPtr<JSC::Yarr::BytecodePattern> compile(const String& patternString, TextCaseSensitivity caseSensitivity, MultilineMode multilineMode)
     58    std::unique_ptr<JSC::Yarr::BytecodePattern> compile(const String& patternString, TextCaseSensitivity caseSensitivity, MultilineMode multilineMode)
    5859    {
    5960        JSC::Yarr::YarrPattern pattern(patternString, (caseSensitivity == TextCaseInsensitive), (multilineMode == MultilineEnabled), &m_constructionError);
     
    179180bool RegularExpression::isValid() const
    180181{
    181     return d->m_regExpByteCode;
     182    return d->m_regExpByteCode.get();
    182183}
    183184
  • trunk/Source/JavaScriptCore/yarr/YarrInterpreter.cpp

    r174455 r176553  
    14731473    }
    14741474
    1475     PassOwnPtr<BytecodePattern> compile(BumpPointerAllocator* allocator)
     1475    std::unique_ptr<BytecodePattern> compile(BumpPointerAllocator* allocator)
    14761476    {
    14771477        regexBegin(m_pattern.m_numSubpatterns, m_pattern.m_body->m_callFrameSize, m_pattern.m_body->m_alternatives[0]->onceThrough());
     
    14791479        regexEnd();
    14801480
    1481         return adoptPtr(new BytecodePattern(m_bodyDisjunction.release(), m_allParenthesesInfo, m_pattern, allocator));
     1481        return std::make_unique<BytecodePattern>(WTF::move(m_bodyDisjunction), m_allParenthesesInfo, m_pattern, allocator);
    14821482    }
    14831483
     
    17791779    void regexBegin(unsigned numSubpatterns, unsigned callFrameSize, bool onceThrough)
    17801780    {
    1781         m_bodyDisjunction = adoptPtr(new ByteDisjunction(numSubpatterns, callFrameSize));
     1781        m_bodyDisjunction = std::make_unique<ByteDisjunction>(numSubpatterns, callFrameSize);
    17821782        m_bodyDisjunction->terms.append(ByteTerm::BodyAlternativeBegin(onceThrough));
    17831783        m_bodyDisjunction->terms[0].frameLocation = 0;
     
    19211921private:
    19221922    YarrPattern& m_pattern;
    1923     OwnPtr<ByteDisjunction> m_bodyDisjunction;
     1923    std::unique_ptr<ByteDisjunction> m_bodyDisjunction;
    19241924    unsigned m_currentAlternativeIndex;
    19251925    Vector<ParenthesesStackEntry> m_parenthesesStack;
     
    19271927};
    19281928
    1929 PassOwnPtr<BytecodePattern> byteCompile(YarrPattern& pattern, BumpPointerAllocator* allocator)
     1929std::unique_ptr<BytecodePattern> byteCompile(YarrPattern& pattern, BumpPointerAllocator* allocator)
    19301930{
    19311931    return ByteCompiler(pattern).compile(allocator);
  • trunk/Source/JavaScriptCore/yarr/YarrInterpreter.h

    r163310 r176553  
    337337    WTF_MAKE_FAST_ALLOCATED;
    338338public:
    339     BytecodePattern(PassOwnPtr<ByteDisjunction> body, Vector<OwnPtr<ByteDisjunction>>& parenthesesInfoToAdopt, YarrPattern& pattern, BumpPointerAllocator* allocator)
    340         : m_body(body)
     339    BytecodePattern(std::unique_ptr<ByteDisjunction> body, Vector<OwnPtr<ByteDisjunction>>& parenthesesInfoToAdopt, YarrPattern& pattern, BumpPointerAllocator* allocator)
     340        : m_body(WTF::move(body))
    341341        , m_ignoreCase(pattern.m_ignoreCase)
    342342        , m_multiline(pattern.m_multiline)
     
    355355    }
    356356
    357     OwnPtr<ByteDisjunction> m_body;
     357    std::unique_ptr<ByteDisjunction> m_body;
    358358    bool m_ignoreCase;
    359359    bool m_multiline;
     
    370370};
    371371
    372 JS_EXPORT_PRIVATE PassOwnPtr<BytecodePattern> byteCompile(YarrPattern&, BumpPointerAllocator*);
     372JS_EXPORT_PRIVATE std::unique_ptr<BytecodePattern> byteCompile(YarrPattern&, BumpPointerAllocator*);
    373373JS_EXPORT_PRIVATE unsigned interpret(BytecodePattern*, const String& input, unsigned start, unsigned* output);
    374374unsigned interpret(BytecodePattern*, const LChar* input, unsigned length, unsigned start, unsigned* output);
Note: See TracChangeset for help on using the changeset viewer.