| Differences between
and this patch
- a/Source/JavaScriptCore/ChangeLog +37 lines
Lines 1-3 a/Source/JavaScriptCore/ChangeLog_sec1
1
2014-11-22  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 NOBODY (OOPS!).
7
8
        As a step of using std::unique_ptr<>, this patch replaces OwnPtr with
9
        std::unique_ptr<>|std::make_unique<>.
10
11
        * API/ObjCCallbackFunction.mm:
12
        * bytecode/DFGExitProfile.cpp:
13
        (JSC::DFG::ExitProfile::add):
14
        * bytecode/DFGExitProfile.h:
15
        * bytecode/LazyOperandValueProfile.cpp:
16
        (JSC::CompressedLazyOperandValueProfileHolder::add):
17
        * bytecode/LazyOperandValueProfile.h:
18
        * heap/MarkedBlock.cpp:
19
        (JSC::MarkedBlock::specializedSweep):
20
        (JSC::MarkedBlock::stopAllocating):
21
        * heap/MarkedBlock.h:
22
        (JSC::MarkedBlock::clearNewlyAllocated):
23
        * inspector/ContentSearchUtilities.cpp:
24
        (Inspector::ContentSearchUtilities::findMagicComment):
25
        * runtime/RegExp.cpp:
26
        (JSC::RegExp::invalidateCode):
27
        * runtime/RegExp.h:
28
        * yarr/RegularExpression.cpp:
29
        (JSC::Yarr::RegularExpression::Private::compile):
30
        (JSC::Yarr::RegularExpression::isValid):
31
        * yarr/YarrInterpreter.cpp:
32
        (JSC::Yarr::ByteCompiler::compile):
33
        (JSC::Yarr::ByteCompiler::regexBegin):
34
        (JSC::Yarr::byteCompile):
35
        * yarr/YarrInterpreter.h:
36
        (JSC::Yarr::BytecodePattern::BytecodePattern):
37
1
2014-11-21  Michael Saboff  <msaboff@apple.com>
38
2014-11-21  Michael Saboff  <msaboff@apple.com>
2
39
3
        r176455: ASSERT(!m_vector.isEmpty()) in IntendedStructureChain.cpp(143)
40
        r176455: ASSERT(!m_vector.isEmpty()) in IntendedStructureChain.cpp(143)
- a/Source/JavaScriptCore/API/ObjCCallbackFunction.mm -1 / +1 lines
Lines 48-54 public: a/Source/JavaScriptCore/API/ObjCCallbackFunction.mm_sec1
48
    virtual ~CallbackArgument();
48
    virtual ~CallbackArgument();
49
    virtual void set(NSInvocation *, NSInteger, JSContext *, JSValueRef, JSValueRef*) = 0;
49
    virtual void set(NSInvocation *, NSInteger, JSContext *, JSValueRef, JSValueRef*) = 0;
50
50
51
    OwnPtr<CallbackArgument> m_next;
51
    std::unique_ptr<CallbackArgument> m_next;
52
};
52
};
53
53
54
CallbackArgument::~CallbackArgument()
54
CallbackArgument::~CallbackArgument()
- a/Source/JavaScriptCore/bytecode/DFGExitProfile.cpp -1 / +1 lines
Lines 40-46 bool ExitProfile::add(const ConcurrentJITLocker&, const FrequentExitSite& site) a/Source/JavaScriptCore/bytecode/DFGExitProfile.cpp_sec1
40
    // If we've never seen any frequent exits then create the list and put this site
40
    // If we've never seen any frequent exits then create the list and put this site
41
    // into it.
41
    // into it.
42
    if (!m_frequentExitSites) {
42
    if (!m_frequentExitSites) {
43
        m_frequentExitSites = adoptPtr(new Vector<FrequentExitSite>());
43
        m_frequentExitSites = std::make_unique<Vector<FrequentExitSite>>();
44
        m_frequentExitSites->append(site);
44
        m_frequentExitSites->append(site);
45
        return true;
45
        return true;
46
    }
46
    }
- a/Source/JavaScriptCore/bytecode/DFGExitProfile.h -2 / +1 lines
Lines 32-38 a/Source/JavaScriptCore/bytecode/DFGExitProfile.h_sec1
32
#include "ExitKind.h"
32
#include "ExitKind.h"
33
#include "ExitingJITType.h"
33
#include "ExitingJITType.h"
34
#include <wtf/HashSet.h>
34
#include <wtf/HashSet.h>
35
#include <wtf/OwnPtr.h>
36
#include <wtf/Vector.h>
35
#include <wtf/Vector.h>
37
36
38
namespace JSC { namespace DFG {
37
namespace JSC { namespace DFG {
Lines 183-189 public: a/Source/JavaScriptCore/bytecode/DFGExitProfile.h_sec2
183
private:
182
private:
184
    friend class QueryableExitProfile;
183
    friend class QueryableExitProfile;
185
    
184
    
186
    OwnPtr<Vector<FrequentExitSite>> m_frequentExitSites;
185
    std::unique_ptr<Vector<FrequentExitSite>> m_frequentExitSites;
187
};
186
};
188
187
189
class QueryableExitProfile {
188
class QueryableExitProfile {
- a/Source/JavaScriptCore/bytecode/LazyOperandValueProfile.cpp -1 / +1 lines
Lines 46-52 LazyOperandValueProfile* CompressedLazyOperandValueProfileHolder::add( a/Source/JavaScriptCore/bytecode/LazyOperandValueProfile.cpp_sec1
46
    const ConcurrentJITLocker&, const LazyOperandValueProfileKey& key)
46
    const ConcurrentJITLocker&, const LazyOperandValueProfileKey& key)
47
{
47
{
48
    if (!m_data)
48
    if (!m_data)
49
        m_data = adoptPtr(new LazyOperandValueProfile::List());
49
        m_data = std::make_unique<LazyOperandValueProfile::List>();
50
    else {
50
    else {
51
        for (unsigned i = 0; i < m_data->size(); ++i) {
51
        for (unsigned i = 0; i < m_data->size(); ++i) {
52
            if (m_data->at(i).key() == key)
52
            if (m_data->at(i).key() == key)
- a/Source/JavaScriptCore/bytecode/LazyOperandValueProfile.h -2 / +1 lines
Lines 31-37 a/Source/JavaScriptCore/bytecode/LazyOperandValueProfile.h_sec1
31
#include "VirtualRegister.h"
31
#include "VirtualRegister.h"
32
#include <wtf/HashMap.h>
32
#include <wtf/HashMap.h>
33
#include <wtf/Noncopyable.h>
33
#include <wtf/Noncopyable.h>
34
#include <wtf/OwnPtr.h>
35
#include <wtf/SegmentedVector.h>
34
#include <wtf/SegmentedVector.h>
36
35
37
namespace JSC {
36
namespace JSC {
Lines 161-167 public: a/Source/JavaScriptCore/bytecode/LazyOperandValueProfile.h_sec2
161
    
160
    
162
private:
161
private:
163
    friend class LazyOperandValueProfileParser;
162
    friend class LazyOperandValueProfileParser;
164
    OwnPtr<LazyOperandValueProfile::List> m_data;
163
    std::unique_ptr<LazyOperandValueProfile::List> m_data;
165
};
164
};
166
165
167
class LazyOperandValueProfileParser {
166
class LazyOperandValueProfileParser {
- a/Source/JavaScriptCore/heap/MarkedBlock.cpp -2 / +2 lines
Lines 102-108 MarkedBlock::FreeList MarkedBlock::specializedSweep() a/Source/JavaScriptCore/heap/MarkedBlock.cpp_sec1
102
    // We only want to discard the newlyAllocated bits if we're creating a FreeList,
102
    // We only want to discard the newlyAllocated bits if we're creating a FreeList,
103
    // otherwise we would lose information on what's currently alive.
103
    // otherwise we would lose information on what's currently alive.
104
    if (sweepMode == SweepToFreeList && m_newlyAllocated)
104
    if (sweepMode == SweepToFreeList && m_newlyAllocated)
105
        m_newlyAllocated.clear();
105
        m_newlyAllocated = nullptr;
106
106
107
    m_state = ((sweepMode == SweepToFreeList) ? FreeListed : Marked);
107
    m_state = ((sweepMode == SweepToFreeList) ? FreeListed : Marked);
108
    return FreeList(head, count * cellSize());
108
    return FreeList(head, count * cellSize());
Lines 190-196 void MarkedBlock::stopAllocating(const FreeList& freeList) a/Source/JavaScriptCore/heap/MarkedBlock.cpp_sec2
190
    // way to tell what's live vs dead. 
190
    // way to tell what's live vs dead. 
191
    
191
    
192
    ASSERT(!m_newlyAllocated);
192
    ASSERT(!m_newlyAllocated);
193
    m_newlyAllocated = adoptPtr(new WTF::Bitmap<atomsPerBlock>());
193
    m_newlyAllocated = std::make_unique<WTF::Bitmap<atomsPerBlock>>();
194
194
195
    SetNewlyAllocatedFunctor functor(this);
195
    SetNewlyAllocatedFunctor functor(this);
196
    forEachCell(functor);
196
    forEachCell(functor);
- a/Source/JavaScriptCore/heap/MarkedBlock.h -2 / +2 lines
Lines 209-215 namespace JSC { a/Source/JavaScriptCore/heap/MarkedBlock.h_sec1
209
        WTF::Bitmap<atomsPerBlock, WTF::BitmapNotAtomic, uint8_t> m_marks;
209
        WTF::Bitmap<atomsPerBlock, WTF::BitmapNotAtomic, uint8_t> m_marks;
210
        WTF::Bitmap<atomsPerBlock, WTF::BitmapNotAtomic, uint8_t> m_rememberedSet;
210
        WTF::Bitmap<atomsPerBlock, WTF::BitmapNotAtomic, uint8_t> m_rememberedSet;
211
#endif
211
#endif
212
        OwnPtr<WTF::Bitmap<atomsPerBlock>> m_newlyAllocated;
212
        std::unique_ptr<WTF::Bitmap<atomsPerBlock>> m_newlyAllocated;
213
213
214
        DestructorType m_destructorType;
214
        DestructorType m_destructorType;
215
        MarkedAllocator* m_allocator;
215
        MarkedAllocator* m_allocator;
Lines 400-406 namespace JSC { a/Source/JavaScriptCore/heap/MarkedBlock.h_sec2
400
    inline bool MarkedBlock::clearNewlyAllocated()
400
    inline bool MarkedBlock::clearNewlyAllocated()
401
    {
401
    {
402
        if (m_newlyAllocated) {
402
        if (m_newlyAllocated) {
403
            m_newlyAllocated.clear();
403
            m_newlyAllocated = nullptr;
404
            return true;
404
            return true;
405
        }
405
        }
406
        return false;
406
        return false;
- a/Source/JavaScriptCore/inspector/ContentSearchUtilities.cpp -1 / +1 lines
Lines 184-190 static String findMagicComment(const String& content, const String& patternStrin a/Source/JavaScriptCore/inspector/ContentSearchUtilities.cpp_sec1
184
    JSC::Yarr::YarrPattern pattern(patternString, false, true, &error);
184
    JSC::Yarr::YarrPattern pattern(patternString, false, true, &error);
185
    ASSERT(!error);
185
    ASSERT(!error);
186
    BumpPointerAllocator regexAllocator;
186
    BumpPointerAllocator regexAllocator;
187
    OwnPtr<JSC::Yarr::BytecodePattern> bytecodePattern = JSC::Yarr::byteCompile(pattern, &regexAllocator);
187
    std::unique_ptr<JSC::Yarr::BytecodePattern> bytecodePattern = JSC::Yarr::byteCompile(pattern, &regexAllocator);
188
    ASSERT(bytecodePattern);
188
    ASSERT(bytecodePattern);
189
189
190
    ASSERT(pattern.m_numSubpatterns == 1);
190
    ASSERT(pattern.m_numSubpatterns == 1);
- a/Source/JavaScriptCore/runtime/RegExp.cpp -1 / +1 lines
Lines 502-508 void RegExp::invalidateCode() a/Source/JavaScriptCore/runtime/RegExp.cpp_sec1
502
#if ENABLE(YARR_JIT)
502
#if ENABLE(YARR_JIT)
503
    m_regExpJITCode.clear();
503
    m_regExpJITCode.clear();
504
#endif
504
#endif
505
    m_regExpBytecode.clear();
505
    m_regExpBytecode = nullptr;
506
}
506
}
507
507
508
#if ENABLE(YARR_JIT_DEBUG)
508
#if ENABLE(YARR_JIT_DEBUG)
- a/Source/JavaScriptCore/runtime/RegExp.h -1 / +1 lines
Lines 130-136 private: a/Source/JavaScriptCore/runtime/RegExp.h_sec1
130
#if ENABLE(YARR_JIT)
130
#if ENABLE(YARR_JIT)
131
    Yarr::YarrCodeBlock m_regExpJITCode;
131
    Yarr::YarrCodeBlock m_regExpJITCode;
132
#endif
132
#endif
133
    OwnPtr<Yarr::BytecodePattern> m_regExpBytecode;
133
    std::unique_ptr<Yarr::BytecodePattern> m_regExpBytecode;
134
};
134
};
135
135
136
} // namespace JSC
136
} // namespace JSC
- a/Source/JavaScriptCore/yarr/RegularExpression.cpp -3 / +4 lines
Lines 1-3 a/Source/JavaScriptCore/yarr/RegularExpression.cpp_sec1
1
1
/*
2
/*
2
 * Copyright (C) 2004, 2008, 2009 Apple Inc. All rights reserved.
3
 * Copyright (C) 2004, 2008, 2009 Apple Inc. All rights reserved.
3
 * Copyright (C) 2008 Collabora Ltd.
4
 * Copyright (C) 2008 Collabora Ltd.
Lines 44-50 public: a/Source/JavaScriptCore/yarr/RegularExpression.cpp_sec2
44
    int lastMatchLength;
45
    int lastMatchLength;
45
46
46
    unsigned m_numSubpatterns;
47
    unsigned m_numSubpatterns;
47
    OwnPtr<JSC::Yarr::BytecodePattern> m_regExpByteCode;
48
    std::unique_ptr<JSC::Yarr::BytecodePattern> m_regExpByteCode;
48
49
49
private:
50
private:
50
    Private(const String& pattern, TextCaseSensitivity caseSensitivity, MultilineMode multilineMode)
51
    Private(const String& pattern, TextCaseSensitivity caseSensitivity, MultilineMode multilineMode)
Lines 54-60 private: a/Source/JavaScriptCore/yarr/RegularExpression.cpp_sec3
54
    {
55
    {
55
    }
56
    }
56
57
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)
58
    {
59
    {
59
        JSC::Yarr::YarrPattern pattern(patternString, (caseSensitivity == TextCaseInsensitive), (multilineMode == MultilineEnabled), &m_constructionError);
60
        JSC::Yarr::YarrPattern pattern(patternString, (caseSensitivity == TextCaseInsensitive), (multilineMode == MultilineEnabled), &m_constructionError);
60
        if (m_constructionError) {
61
        if (m_constructionError) {
Lines 178-184 void replace(String& string, const RegularExpression& target, const String& repl a/Source/JavaScriptCore/yarr/RegularExpression.cpp_sec4
178
179
179
bool RegularExpression::isValid() const
180
bool RegularExpression::isValid() const
180
{
181
{
181
    return d->m_regExpByteCode;
182
    return d->m_regExpByteCode.get();
182
}
183
}
183
184
184
} } // namespace JSC::Yarr
185
} } // namespace JSC::Yarr
- a/Source/JavaScriptCore/yarr/YarrInterpreter.cpp -5 / +5 lines
Lines 1472-1484 public: a/Source/JavaScriptCore/yarr/YarrInterpreter.cpp_sec1
1472
        m_currentAlternativeIndex = 0;
1472
        m_currentAlternativeIndex = 0;
1473
    }
1473
    }
1474
1474
1475
    PassOwnPtr<BytecodePattern> compile(BumpPointerAllocator* allocator)
1475
    std::unique_ptr<BytecodePattern> compile(BumpPointerAllocator* allocator)
1476
    {
1476
    {
1477
        regexBegin(m_pattern.m_numSubpatterns, m_pattern.m_body->m_callFrameSize, m_pattern.m_body->m_alternatives[0]->onceThrough());
1477
        regexBegin(m_pattern.m_numSubpatterns, m_pattern.m_body->m_callFrameSize, m_pattern.m_body->m_alternatives[0]->onceThrough());
1478
        emitDisjunction(m_pattern.m_body);
1478
        emitDisjunction(m_pattern.m_body);
1479
        regexEnd();
1479
        regexEnd();
1480
1480
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);
1482
    }
1482
    }
1483
1483
1484
    void checkInput(unsigned count)
1484
    void checkInput(unsigned count)
Lines 1778-1784 public: a/Source/JavaScriptCore/yarr/YarrInterpreter.cpp_sec2
1778
1778
1779
    void regexBegin(unsigned numSubpatterns, unsigned callFrameSize, bool onceThrough)
1779
    void regexBegin(unsigned numSubpatterns, unsigned callFrameSize, bool onceThrough)
1780
    {
1780
    {
1781
        m_bodyDisjunction = adoptPtr(new ByteDisjunction(numSubpatterns, callFrameSize));
1781
        m_bodyDisjunction = std::make_unique<ByteDisjunction>(numSubpatterns, callFrameSize);
1782
        m_bodyDisjunction->terms.append(ByteTerm::BodyAlternativeBegin(onceThrough));
1782
        m_bodyDisjunction->terms.append(ByteTerm::BodyAlternativeBegin(onceThrough));
1783
        m_bodyDisjunction->terms[0].frameLocation = 0;
1783
        m_bodyDisjunction->terms[0].frameLocation = 0;
1784
        m_currentAlternativeIndex = 0;
1784
        m_currentAlternativeIndex = 0;
Lines 1920-1932 public: a/Source/JavaScriptCore/yarr/YarrInterpreter.cpp_sec3
1920
1920
1921
private:
1921
private:
1922
    YarrPattern& m_pattern;
1922
    YarrPattern& m_pattern;
1923
    OwnPtr<ByteDisjunction> m_bodyDisjunction;
1923
    std::unique_ptr<ByteDisjunction> m_bodyDisjunction;
1924
    unsigned m_currentAlternativeIndex;
1924
    unsigned m_currentAlternativeIndex;
1925
    Vector<ParenthesesStackEntry> m_parenthesesStack;
1925
    Vector<ParenthesesStackEntry> m_parenthesesStack;
1926
    Vector<OwnPtr<ByteDisjunction>> m_allParenthesesInfo;
1926
    Vector<OwnPtr<ByteDisjunction>> m_allParenthesesInfo;
1927
};
1927
};
1928
1928
1929
PassOwnPtr<BytecodePattern> byteCompile(YarrPattern& pattern, BumpPointerAllocator* allocator)
1929
std::unique_ptr<BytecodePattern> byteCompile(YarrPattern& pattern, BumpPointerAllocator* allocator)
1930
{
1930
{
1931
    return ByteCompiler(pattern).compile(allocator);
1931
    return ByteCompiler(pattern).compile(allocator);
1932
}
1932
}
- a/Source/JavaScriptCore/yarr/YarrInterpreter.h -4 / +4 lines
Lines 336-343 public: a/Source/JavaScriptCore/yarr/YarrInterpreter.h_sec1
336
struct BytecodePattern {
336
struct BytecodePattern {
337
    WTF_MAKE_FAST_ALLOCATED;
337
    WTF_MAKE_FAST_ALLOCATED;
338
public:
338
public:
339
    BytecodePattern(PassOwnPtr<ByteDisjunction> body, Vector<OwnPtr<ByteDisjunction>>& parenthesesInfoToAdopt, YarrPattern& pattern, BumpPointerAllocator* allocator)
339
    BytecodePattern(std::unique_ptr<ByteDisjunction> body, Vector<OwnPtr<ByteDisjunction>>& parenthesesInfoToAdopt, YarrPattern& pattern, BumpPointerAllocator* allocator)
340
        : m_body(body)
340
        : m_body(WTF::move(body))
341
        , m_ignoreCase(pattern.m_ignoreCase)
341
        , m_ignoreCase(pattern.m_ignoreCase)
342
        , m_multiline(pattern.m_multiline)
342
        , m_multiline(pattern.m_multiline)
343
        , m_allocator(allocator)
343
        , m_allocator(allocator)
Lines 354-360 public: a/Source/JavaScriptCore/yarr/YarrInterpreter.h_sec2
354
        m_userCharacterClasses.shrinkToFit();
354
        m_userCharacterClasses.shrinkToFit();
355
    }
355
    }
356
356
357
    OwnPtr<ByteDisjunction> m_body;
357
    std::unique_ptr<ByteDisjunction> m_body;
358
    bool m_ignoreCase;
358
    bool m_ignoreCase;
359
    bool m_multiline;
359
    bool m_multiline;
360
    // Each BytecodePattern is associated with a RegExp, each RegExp is associated
360
    // Each BytecodePattern is associated with a RegExp, each RegExp is associated
Lines 369-375 private: a/Source/JavaScriptCore/yarr/YarrInterpreter.h_sec3
369
    Vector<OwnPtr<CharacterClass>> m_userCharacterClasses;
369
    Vector<OwnPtr<CharacterClass>> m_userCharacterClasses;
370
};
370
};
371
371
372
JS_EXPORT_PRIVATE PassOwnPtr<BytecodePattern> byteCompile(YarrPattern&, BumpPointerAllocator*);
372
JS_EXPORT_PRIVATE std::unique_ptr<BytecodePattern> byteCompile(YarrPattern&, BumpPointerAllocator*);
373
JS_EXPORT_PRIVATE unsigned interpret(BytecodePattern*, const String& input, unsigned start, unsigned* output);
373
JS_EXPORT_PRIVATE unsigned interpret(BytecodePattern*, const String& input, unsigned start, unsigned* output);
374
unsigned interpret(BytecodePattern*, const LChar* input, unsigned length, unsigned start, unsigned* output);
374
unsigned interpret(BytecodePattern*, const LChar* input, unsigned length, unsigned start, unsigned* output);
375
unsigned interpret(BytecodePattern*, const UChar* input, unsigned length, unsigned start, unsigned* output);
375
unsigned interpret(BytecodePattern*, const UChar* input, unsigned length, unsigned start, unsigned* output);

Return to Bug 139009