Changeset 176553 in webkit for trunk/Source/JavaScriptCore/yarr


Ignore:
Timestamp:
Nov 27, 2014, 4:51:32 PM (10 years ago)
Author:
[email protected]
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/yarr
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • 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.