Skip to content

Commit 6c55e20

Browse files
author
Mark Lam
committed
Use const AbstractLocker& (instead of const LockHolder&) in more places.
https://bugs.webkit.org/show_bug.cgi?id=169424 Reviewed by Filip Pizlo. Source/JavaScriptCore: * heap/CodeBlockSet.cpp: (JSC::CodeBlockSet::promoteYoungCodeBlocks): * heap/CodeBlockSet.h: * heap/CodeBlockSetInlines.h: (JSC::CodeBlockSet::mark): * heap/ConservativeRoots.cpp: (JSC::CompositeMarkHook::CompositeMarkHook): * heap/MachineStackMarker.cpp: (JSC::MachineThreads::tryCopyOtherThreadStacks): * heap/MachineStackMarker.h: * profiler/ProfilerDatabase.cpp: (JSC::Profiler::Database::ensureBytecodesFor): * profiler/ProfilerDatabase.h: * runtime/SamplingProfiler.cpp: (JSC::FrameWalker::FrameWalker): (JSC::CFrameWalker::CFrameWalker): (JSC::SamplingProfiler::createThreadIfNecessary): (JSC::SamplingProfiler::takeSample): (JSC::SamplingProfiler::start): (JSC::SamplingProfiler::pause): (JSC::SamplingProfiler::noticeCurrentThreadAsJSCExecutionThread): (JSC::SamplingProfiler::clearData): (JSC::SamplingProfiler::releaseStackTraces): * runtime/SamplingProfiler.h: (JSC::SamplingProfiler::setStopWatch): * wasm/WasmMemory.cpp: (JSC::Wasm::availableFastMemories): (JSC::Wasm::activeFastMemories): (JSC::Wasm::viewActiveFastMemories): * wasm/WasmMemory.h: Source/WTF: * wtf/RunLoop.h: * wtf/generic/RunLoopGeneric.cpp: (WTF::RunLoop::wakeUp): (WTF::RunLoop::schedule): Canonical link: https://commits.webkit.org/186414@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213657 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 2eeb623 commit 6c55e20

16 files changed

Lines changed: 89 additions & 39 deletions

Source/JavaScriptCore/ChangeLog

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,41 @@
1+
2017-03-09 Mark Lam <mark.lam@apple.com>
2+
3+
Use const AbstractLocker& (instead of const LockHolder&) in more places.
4+
https://bugs.webkit.org/show_bug.cgi?id=169424
5+
6+
Reviewed by Filip Pizlo.
7+
8+
* heap/CodeBlockSet.cpp:
9+
(JSC::CodeBlockSet::promoteYoungCodeBlocks):
10+
* heap/CodeBlockSet.h:
11+
* heap/CodeBlockSetInlines.h:
12+
(JSC::CodeBlockSet::mark):
13+
* heap/ConservativeRoots.cpp:
14+
(JSC::CompositeMarkHook::CompositeMarkHook):
15+
* heap/MachineStackMarker.cpp:
16+
(JSC::MachineThreads::tryCopyOtherThreadStacks):
17+
* heap/MachineStackMarker.h:
18+
* profiler/ProfilerDatabase.cpp:
19+
(JSC::Profiler::Database::ensureBytecodesFor):
20+
* profiler/ProfilerDatabase.h:
21+
* runtime/SamplingProfiler.cpp:
22+
(JSC::FrameWalker::FrameWalker):
23+
(JSC::CFrameWalker::CFrameWalker):
24+
(JSC::SamplingProfiler::createThreadIfNecessary):
25+
(JSC::SamplingProfiler::takeSample):
26+
(JSC::SamplingProfiler::start):
27+
(JSC::SamplingProfiler::pause):
28+
(JSC::SamplingProfiler::noticeCurrentThreadAsJSCExecutionThread):
29+
(JSC::SamplingProfiler::clearData):
30+
(JSC::SamplingProfiler::releaseStackTraces):
31+
* runtime/SamplingProfiler.h:
32+
(JSC::SamplingProfiler::setStopWatch):
33+
* wasm/WasmMemory.cpp:
34+
(JSC::Wasm::availableFastMemories):
35+
(JSC::Wasm::activeFastMemories):
36+
(JSC::Wasm::viewActiveFastMemories):
37+
* wasm/WasmMemory.h:
38+
139
2017-03-09 Saam Barati <sbarati@apple.com>
240

341
WebAssembly: Make the Unity AngryBots demo run

Source/JavaScriptCore/heap/CodeBlockSet.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ void CodeBlockSet::add(CodeBlock* codeBlock)
4747
ASSERT_UNUSED(isNewEntry, isNewEntry);
4848
}
4949

50-
void CodeBlockSet::promoteYoungCodeBlocks(const LockHolder&)
50+
void CodeBlockSet::promoteYoungCodeBlocks(const AbstractLocker&)
5151
{
5252
ASSERT(m_lock.isLocked());
5353
m_oldCodeBlocks.add(m_newCodeBlocks.begin(), m_newCodeBlocks.end());

Source/JavaScriptCore/heap/CodeBlockSet.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ class CodeBlockSet {
6262
// Mark a pointer that may be a CodeBlock that belongs to the set of DFG
6363
// blocks. This is defined in CodeBlock.h.
6464
private:
65-
void mark(const LockHolder&, CodeBlock* candidateCodeBlock);
65+
void mark(const AbstractLocker&, CodeBlock* candidateCodeBlock);
6666
public:
67-
void mark(const LockHolder&, void* candidateCodeBlock);
67+
void mark(const AbstractLocker&, void* candidateCodeBlock);
6868

6969
// Delete all code blocks that are only referenced by this set (i.e. owned
7070
// by this set), and that have not been marked.
@@ -86,7 +86,7 @@ class CodeBlockSet {
8686
void dump(PrintStream&) const;
8787

8888
private:
89-
void promoteYoungCodeBlocks(const LockHolder&);
89+
void promoteYoungCodeBlocks(const AbstractLocker&);
9090

9191
HashSet<CodeBlock*> m_oldCodeBlocks;
9292
HashSet<CodeBlock*> m_newCodeBlocks;

Source/JavaScriptCore/heap/CodeBlockSetInlines.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
namespace JSC {
3535

36-
inline void CodeBlockSet::mark(const LockHolder& locker, void* candidateCodeBlock)
36+
inline void CodeBlockSet::mark(const AbstractLocker& locker, void* candidateCodeBlock)
3737
{
3838
ASSERT(m_lock.isLocked());
3939
// We have to check for 0 and -1 because those are used by the HashMap as markers.
@@ -52,7 +52,7 @@ inline void CodeBlockSet::mark(const LockHolder& locker, void* candidateCodeBloc
5252
mark(locker, codeBlock);
5353
}
5454

55-
inline void CodeBlockSet::mark(const LockHolder&, CodeBlock* codeBlock)
55+
inline void CodeBlockSet::mark(const AbstractLocker&, CodeBlock* codeBlock)
5656
{
5757
if (!codeBlock)
5858
return;

Source/JavaScriptCore/heap/ConservativeRoots.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ void ConservativeRoots::add(void* begin, void* end, JITStubRoutineSet& jitStubRo
117117

118118
class CompositeMarkHook {
119119
public:
120-
CompositeMarkHook(JITStubRoutineSet& stubRoutines, CodeBlockSet& codeBlocks, const LockHolder& locker)
120+
CompositeMarkHook(JITStubRoutineSet& stubRoutines, CodeBlockSet& codeBlocks, const AbstractLocker& locker)
121121
: m_stubRoutines(stubRoutines)
122122
, m_codeBlocks(codeBlocks)
123123
, m_codeBlocksLocker(locker)
@@ -133,7 +133,7 @@ class CompositeMarkHook {
133133
private:
134134
JITStubRoutineSet& m_stubRoutines;
135135
CodeBlockSet& m_codeBlocks;
136-
const LockHolder& m_codeBlocksLocker;
136+
const AbstractLocker& m_codeBlocksLocker;
137137
};
138138

139139
void ConservativeRoots::add(

Source/JavaScriptCore/heap/MachineStackMarker.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,7 @@ void MachineThreads::tryCopyOtherThreadStack(Thread* thread, void* buffer, size_
928928
thread->freeRegisters(registers);
929929
}
930930

931-
bool MachineThreads::tryCopyOtherThreadStacks(LockHolder&, void* buffer, size_t capacity, size_t* size)
931+
bool MachineThreads::tryCopyOtherThreadStacks(const AbstractLocker&, void* buffer, size_t capacity, size_t* size)
932932
{
933933
// Prevent two VMs from suspending each other's threads at the same time,
934934
// which can cause deadlock: <rdar://problem/20300842>.

Source/JavaScriptCore/heap/MachineStackMarker.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ class MachineThreads {
142142
void gatherFromCurrentThread(ConservativeRoots&, JITStubRoutineSet&, CodeBlockSet&, CurrentThreadState&);
143143

144144
void tryCopyOtherThreadStack(Thread*, void*, size_t capacity, size_t*);
145-
bool tryCopyOtherThreadStacks(LockHolder&, void*, size_t capacity, size_t*);
145+
bool tryCopyOtherThreadStacks(const AbstractLocker&, void*, size_t capacity, size_t*);
146146

147147
static void THREAD_SPECIFIC_CALL removeThread(void*);
148148

Source/JavaScriptCore/profiler/ProfilerDatabase.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ Bytecodes* Database::ensureBytecodesFor(CodeBlock* codeBlock)
6262
return ensureBytecodesFor(locker, codeBlock);
6363
}
6464

65-
Bytecodes* Database::ensureBytecodesFor(const LockHolder&, CodeBlock* codeBlock)
65+
Bytecodes* Database::ensureBytecodesFor(const AbstractLocker&, CodeBlock* codeBlock)
6666
{
6767
codeBlock = codeBlock->baselineAlternative();
6868

Source/JavaScriptCore/profiler/ProfilerDatabase.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class Database {
7272
JS_EXPORT_PRIVATE void logEvent(CodeBlock* codeBlock, const char* summary, const CString& detail);
7373

7474
private:
75-
Bytecodes* ensureBytecodesFor(const LockHolder&, CodeBlock*);
75+
Bytecodes* ensureBytecodesFor(const AbstractLocker&, CodeBlock*);
7676

7777
void addDatabaseToAtExit();
7878
void removeDatabaseFromAtExit();

Source/JavaScriptCore/runtime/SamplingProfiler.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ ALWAYS_INLINE static void reportStats()
8181

8282
class FrameWalker {
8383
public:
84-
FrameWalker(VM& vm, ExecState* callFrame, const LockHolder& codeBlockSetLocker, const LockHolder& machineThreadsLocker)
84+
FrameWalker(VM& vm, ExecState* callFrame, const AbstractLocker& codeBlockSetLocker, const AbstractLocker& machineThreadsLocker)
8585
: m_vm(vm)
8686
, m_callFrame(callFrame)
8787
, m_vmEntryFrame(vm.topVMEntryFrame)
@@ -190,8 +190,8 @@ class FrameWalker {
190190
VM& m_vm;
191191
ExecState* m_callFrame;
192192
VMEntryFrame* m_vmEntryFrame;
193-
const LockHolder& m_codeBlockSetLocker;
194-
const LockHolder& m_machineThreadsLocker;
193+
const AbstractLocker& m_codeBlockSetLocker;
194+
const AbstractLocker& m_machineThreadsLocker;
195195
bool m_bailingOut { false };
196196
size_t m_depth { 0 };
197197
};
@@ -200,7 +200,7 @@ class CFrameWalker : public FrameWalker {
200200
public:
201201
typedef FrameWalker Base;
202202

203-
CFrameWalker(VM& vm, void* machineFrame, ExecState* callFrame, const LockHolder& codeBlockSetLocker, const LockHolder& machineThreadsLocker)
203+
CFrameWalker(VM& vm, void* machineFrame, ExecState* callFrame, const AbstractLocker& codeBlockSetLocker, const AbstractLocker& machineThreadsLocker)
204204
: Base(vm, callFrame, codeBlockSetLocker, machineThreadsLocker)
205205
, m_machineFrame(machineFrame)
206206
{
@@ -296,7 +296,7 @@ SamplingProfiler::~SamplingProfiler()
296296
{
297297
}
298298

299-
void SamplingProfiler::createThreadIfNecessary(const LockHolder&)
299+
void SamplingProfiler::createThreadIfNecessary(const AbstractLocker&)
300300
{
301301
ASSERT(m_lock.isLocked());
302302

@@ -334,7 +334,7 @@ void SamplingProfiler::timerLoop()
334334
}
335335
}
336336

337-
void SamplingProfiler::takeSample(const LockHolder&, std::chrono::microseconds& stackTraceProcessingTime)
337+
void SamplingProfiler::takeSample(const AbstractLocker&, std::chrono::microseconds& stackTraceProcessingTime)
338338
{
339339
ASSERT(m_lock.isLocked());
340340
if (m_vm.entryScope) {
@@ -659,21 +659,21 @@ void SamplingProfiler::start()
659659
start(locker);
660660
}
661661

662-
void SamplingProfiler::start(const LockHolder& locker)
662+
void SamplingProfiler::start(const AbstractLocker& locker)
663663
{
664664
ASSERT(m_lock.isLocked());
665665
m_isPaused = false;
666666
createThreadIfNecessary(locker);
667667
}
668668

669-
void SamplingProfiler::pause(const LockHolder&)
669+
void SamplingProfiler::pause(const AbstractLocker&)
670670
{
671671
ASSERT(m_lock.isLocked());
672672
m_isPaused = true;
673673
reportStats();
674674
}
675675

676-
void SamplingProfiler::noticeCurrentThreadAsJSCExecutionThread(const LockHolder&)
676+
void SamplingProfiler::noticeCurrentThreadAsJSCExecutionThread(const AbstractLocker&)
677677
{
678678
ASSERT(m_lock.isLocked());
679679
m_jscExecutionThread = m_vm.heap.machineThreads().machineThreadForCurrentThread();
@@ -700,7 +700,7 @@ void SamplingProfiler::noticeVMEntry()
700700
createThreadIfNecessary(locker);
701701
}
702702

703-
void SamplingProfiler::clearData(const LockHolder&)
703+
void SamplingProfiler::clearData(const AbstractLocker&)
704704
{
705705
ASSERT(m_lock.isLocked());
706706
m_stackTraces.clear();
@@ -858,7 +858,7 @@ String SamplingProfiler::StackFrame::url()
858858
return url;
859859
}
860860

861-
Vector<SamplingProfiler::StackTrace> SamplingProfiler::releaseStackTraces(const LockHolder& locker)
861+
Vector<SamplingProfiler::StackTrace> SamplingProfiler::releaseStackTraces(const AbstractLocker& locker)
862862
{
863863
ASSERT(m_lock.isLocked());
864864
{

0 commit comments

Comments
 (0)