Skip to content

Commit b6737f7

Browse files
author
Gyuyoung Kim
committed
Use std::unique_ptr instead of OwnPtr in JSC - heap, jit, runtime, and parser directories
https://bugs.webkit.org/show_bug.cgi?id=139351 Reviewed by Filip Pizlo. As a step to use std::unique_ptr<>, this cleans up OwnPtr and PassOwnPtr. * bytecode/SamplingTool.h: (JSC::SamplingTool::SamplingTool): * heap/CopiedBlock.h: (JSC::CopiedBlock::didSurviveGC): (JSC::CopiedBlock::pin): * heap/CopiedBlockInlines.h: (JSC::CopiedBlock::reportLiveBytes): * heap/GCActivityCallback.h: * heap/GCThread.cpp: * heap/Heap.h: * heap/HeapInlines.h: (JSC::Heap::markListSet): * jit/ExecutableAllocator.cpp: * jit/JIT.cpp: (JSC::JIT::privateCompile): * jit/JIT.h: * jit/JITThunks.cpp: (JSC::JITThunks::JITThunks): (JSC::JITThunks::clearHostFunctionStubs): * jit/JITThunks.h: * parser/Parser.cpp: (JSC::Parser<LexerType>::Parser): * parser/Parser.h: (JSC::Scope::Scope): (JSC::Scope::pushLabel): * parser/ParserArena.cpp: * parser/ParserArena.h: (JSC::ParserArena::identifierArena): * parser/SourceProviderCache.h: * runtime/CodeCache.h: * runtime/Executable.h: * runtime/JSArray.cpp: (JSC::JSArray::sortVector): * runtime/JSGlobalObject.h: Canonical link: https://commits.webkit.org/157383@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@177130 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 9270b61 commit b6737f7

22 files changed

Lines changed: 68 additions & 41 deletions

Source/JavaScriptCore/ChangeLog

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,47 @@
1+
2014-12-10 Gyuyoung Kim <[email protected]>
2+
3+
Use std::unique_ptr instead of OwnPtr in JSC - heap, jit, runtime, and parser directories
4+
https://bugs.webkit.org/show_bug.cgi?id=139351
5+
6+
Reviewed by Filip Pizlo.
7+
8+
As a step to use std::unique_ptr<>, this cleans up OwnPtr and PassOwnPtr.
9+
10+
* bytecode/SamplingTool.h:
11+
(JSC::SamplingTool::SamplingTool):
12+
* heap/CopiedBlock.h:
13+
(JSC::CopiedBlock::didSurviveGC):
14+
(JSC::CopiedBlock::pin):
15+
* heap/CopiedBlockInlines.h:
16+
(JSC::CopiedBlock::reportLiveBytes):
17+
* heap/GCActivityCallback.h:
18+
* heap/GCThread.cpp:
19+
* heap/Heap.h:
20+
* heap/HeapInlines.h:
21+
(JSC::Heap::markListSet):
22+
* jit/ExecutableAllocator.cpp:
23+
* jit/JIT.cpp:
24+
(JSC::JIT::privateCompile):
25+
* jit/JIT.h:
26+
* jit/JITThunks.cpp:
27+
(JSC::JITThunks::JITThunks):
28+
(JSC::JITThunks::clearHostFunctionStubs):
29+
* jit/JITThunks.h:
30+
* parser/Parser.cpp:
31+
(JSC::Parser<LexerType>::Parser):
32+
* parser/Parser.h:
33+
(JSC::Scope::Scope):
34+
(JSC::Scope::pushLabel):
35+
* parser/ParserArena.cpp:
36+
* parser/ParserArena.h:
37+
(JSC::ParserArena::identifierArena):
38+
* parser/SourceProviderCache.h:
39+
* runtime/CodeCache.h:
40+
* runtime/Executable.h:
41+
* runtime/JSArray.cpp:
42+
(JSC::JSArray::sortVector):
43+
* runtime/JSGlobalObject.h:
44+
145
2014-12-10 Geoffrey Garen <[email protected]>
246

347
Please disable the webkitFirstVersionWithInitConstructorSupport check on Apple TV

Source/JavaScriptCore/bytecode/SamplingTool.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ namespace JSC {
271271
, m_sampleCount(0)
272272
, m_opcodeSampleCount(0)
273273
#if ENABLE(CODEBLOCK_SAMPLING)
274-
, m_scopeSampleMap(adoptPtr(new ScriptSampleRecordMap))
274+
, m_scopeSampleMap(std::make_unique<ScriptSampleRecordMap>)
275275
#endif
276276
{
277277
memset(m_opcodeSamples, 0, sizeof(m_opcodeSamples));
@@ -338,7 +338,7 @@ namespace JSC {
338338

339339
#if ENABLE(CODEBLOCK_SAMPLING)
340340
Mutex m_scriptSampleMapMutex;
341-
OwnPtr<ScriptSampleRecordMap> m_scopeSampleMap;
341+
std::unique_ptr<ScriptSampleRecordMap> m_scopeSampleMap;
342342
#endif
343343
};
344344

Source/JavaScriptCore/heap/CopiedBlock.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@
3232
#include "JSCJSValue.h"
3333
#include "Options.h"
3434
#include <wtf/Atomics.h>
35-
#include <wtf/OwnPtr.h>
36-
#include <wtf/PassOwnPtr.h>
3735

3836
namespace JSC {
3937

@@ -94,7 +92,7 @@ class CopiedBlock : public HeapBlock<CopiedBlock> {
9492
void checkConsistency();
9593

9694
SpinLock m_workListLock;
97-
OwnPtr<CopyWorkList> m_workList;
95+
std::unique_ptr<CopyWorkList> m_workList;
9896

9997
size_t m_remaining;
10098
bool m_isPinned : 1;
@@ -154,7 +152,7 @@ inline void CopiedBlock::didSurviveGC()
154152
#endif
155153
m_isPinned = false;
156154
if (m_workList)
157-
m_workList.clear();
155+
m_workList = nullptr;
158156
}
159157

160158
inline void CopiedBlock::didEvacuateBytes(unsigned bytes)
@@ -185,7 +183,7 @@ inline void CopiedBlock::pin()
185183
{
186184
m_isPinned = true;
187185
if (m_workList)
188-
m_workList.clear();
186+
m_workList = nullptr;
189187
}
190188

191189
inline bool CopiedBlock::isPinned()

Source/JavaScriptCore/heap/CopiedBlockInlines.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ inline void CopiedBlock::reportLiveBytes(SpinLockHolder&, JSCell* owner, CopyTok
6262
}
6363

6464
if (!m_workList)
65-
m_workList = adoptPtr(new CopyWorkList(Heap::heap(owner)->blockAllocator()));
65+
m_workList = std::make_unique<CopyWorkList>(Heap::heap(owner)->blockAllocator());
6666

6767
m_workList->append(CopyWorklistItem(owner, token));
6868
}

Source/JavaScriptCore/heap/GCActivityCallback.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
#define GCActivityCallback_h
3131

3232
#include "HeapTimer.h"
33-
#include <wtf/OwnPtr.h>
3433
#include <wtf/PassRefPtr.h>
3534

3635
#if USE(CF)

Source/JavaScriptCore/heap/GCThread.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
#include "JSCInlines.h"
3333
#include "SlotVisitor.h"
3434
#include <wtf/MainThread.h>
35-
#include <wtf/PassOwnPtr.h>
3635

3736
namespace JSC {
3837

Source/JavaScriptCore/heap/Heap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ class Heap {
353353

354354
ProtectCountSet m_protectedValues;
355355
Vector<Vector<ValueStringPair, 0, UnsafeVectorOverflow>*> m_tempSortingVectors;
356-
OwnPtr<HashSet<MarkedArgumentBuffer*>> m_markListSet;
356+
std::unique_ptr<HashSet<MarkedArgumentBuffer*>> m_markListSet;
357357

358358
MachineThreads m_machineThreads;
359359

Source/JavaScriptCore/heap/HeapInlines.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ inline void Heap::decrementDeferralDepthAndGCIfNeeded()
286286
inline HashSet<MarkedArgumentBuffer*>& Heap::markListSet()
287287
{
288288
if (!m_markListSet)
289-
m_markListSet = adoptPtr(new HashSet<MarkedArgumentBuffer*>);
289+
m_markListSet = std::make_unique<HashSet<MarkedArgumentBuffer*>>();
290290
return *m_markListSet;
291291
}
292292

Source/JavaScriptCore/jit/ExecutableAllocator.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@
3434
#include <wtf/MetaAllocator.h>
3535
#include <wtf/NeverDestroyed.h>
3636
#include <wtf/PageReservation.h>
37-
#if ENABLE(ASSEMBLER_WX_EXCLUSIVE)
38-
#include <wtf/PassOwnPtr.h>
39-
#endif
4037
#include <wtf/ThreadingPrimitives.h>
4138
#include <wtf/VMTags.h>
4239
#endif

Source/JavaScriptCore/jit/JIT.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ CompilationResult JIT::privateCompile(JITCompilationEffort effort)
498498
m_vm->typeProfilerLog()->processLogEntries(ASCIILiteral("Preparing for JIT compilation."));
499499

500500
if (Options::showDisassembly() || m_vm->m_perBytecodeProfiler)
501-
m_disassembler = adoptPtr(new JITDisassembler(m_codeBlock));
501+
m_disassembler = std::make_unique<JITDisassembler>(m_codeBlock);
502502
if (m_vm->m_perBytecodeProfiler) {
503503
m_compilation = adoptRef(
504504
new Profiler::Compilation(

0 commit comments

Comments
 (0)