summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/heap/ConservativeRoots.cpp
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2016-04-10 09:28:39 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2016-04-10 09:28:39 +0000
commit32761a6cee1d0dee366b885b7b9c777e67885688 (patch)
treed6bec92bebfb216f4126356e55518842c2f476a1 /Source/JavaScriptCore/heap/ConservativeRoots.cpp
parenta4e969f4965059196ca948db781e52f7cfebf19e (diff)
downloadWebKitGtk-tarball-32761a6cee1d0dee366b885b7b9c777e67885688.tar.gz
webkitgtk-2.4.11webkitgtk-2.4.11
Diffstat (limited to 'Source/JavaScriptCore/heap/ConservativeRoots.cpp')
-rw-r--r--Source/JavaScriptCore/heap/ConservativeRoots.cpp45
1 files changed, 26 insertions, 19 deletions
diff --git a/Source/JavaScriptCore/heap/ConservativeRoots.cpp b/Source/JavaScriptCore/heap/ConservativeRoots.cpp
index e1e12002e..7fc8eee3f 100644
--- a/Source/JavaScriptCore/heap/ConservativeRoots.cpp
+++ b/Source/JavaScriptCore/heap/ConservativeRoots.cpp
@@ -30,16 +30,13 @@
#include "CodeBlockSet.h"
#include "CopiedSpace.h"
#include "CopiedSpaceInlines.h"
-#include "HeapInlines.h"
#include "JSCell.h"
#include "JSObject.h"
-#include "JSCInlines.h"
#include "Structure.h"
-#include <wtf/OSAllocator.h>
namespace JSC {
-ConservativeRoots::ConservativeRoots(MarkedBlockSet* blocks, CopiedSpace* copiedSpace)
+ConservativeRoots::ConservativeRoots(const MarkedBlockSet* blocks, CopiedSpace* copiedSpace)
: m_roots(m_inlineRoots)
, m_size(0)
, m_capacity(inlineCapacity)
@@ -71,8 +68,20 @@ inline void ConservativeRoots::genericAddPointer(void* p, TinyBloomFilter filter
markHook.mark(p);
m_copiedSpace->pinIfNecessary(p);
+
+ MarkedBlock* candidate = MarkedBlock::blockFor(p);
+ if (filter.ruleOut(reinterpret_cast<Bits>(candidate))) {
+ ASSERT(!candidate || !m_blocks->set().contains(candidate));
+ return;
+ }
+
+ if (!MarkedBlock::isAtomAligned(p))
+ return;
+
+ if (!m_blocks->set().contains(candidate))
+ return;
- if (!Heap::isPointerGCObject(filter, *m_blocks, p))
+ if (!candidate->isLiveCell(p))
return;
if (m_size == m_capacity)
@@ -82,7 +91,6 @@ inline void ConservativeRoots::genericAddPointer(void* p, TinyBloomFilter filter
}
template<typename MarkHook>
-SUPPRESS_ASAN
void ConservativeRoots::genericAddSpan(void* begin, void* end, MarkHook& markHook)
{
if (begin > end) {
@@ -91,8 +99,9 @@ void ConservativeRoots::genericAddSpan(void* begin, void* end, MarkHook& markHoo
end = swapTemp;
}
- RELEASE_ASSERT(isPointerAligned(begin));
- RELEASE_ASSERT(isPointerAligned(end));
+ ASSERT((static_cast<char*>(end) - static_cast<char*>(begin)) < 0x1000000);
+ ASSERT(isPointerAligned(begin));
+ ASSERT(isPointerAligned(end));
TinyBloomFilter filter = m_blocks->filter(); // Make a local copy of filter to show the compiler it won't alias, and can be register-allocated.
for (char** it = static_cast<char**>(begin); it != static_cast<char**>(end); ++it)
@@ -115,32 +124,30 @@ void ConservativeRoots::add(void* begin, void* end, JITStubRoutineSet& jitStubRo
genericAddSpan(begin, end, jitStubRoutines);
}
+template<typename T, typename U>
class CompositeMarkHook {
public:
- CompositeMarkHook(JITStubRoutineSet& stubRoutines, CodeBlockSet& codeBlocks, const LockHolder& locker)
- : m_stubRoutines(stubRoutines)
- , m_codeBlocks(codeBlocks)
- , m_codeBlocksLocker(locker)
+ CompositeMarkHook(T& first, U& second)
+ : m_first(first)
+ , m_second(second)
{
}
void mark(void* address)
{
- m_stubRoutines.mark(address);
- m_codeBlocks.mark(m_codeBlocksLocker, address);
+ m_first.mark(address);
+ m_second.mark(address);
}
private:
- JITStubRoutineSet& m_stubRoutines;
- CodeBlockSet& m_codeBlocks;
- const LockHolder& m_codeBlocksLocker;
+ T& m_first;
+ U& m_second;
};
void ConservativeRoots::add(
void* begin, void* end, JITStubRoutineSet& jitStubRoutines, CodeBlockSet& codeBlocks)
{
- LockHolder locker(codeBlocks.getLock());
- CompositeMarkHook markHook(jitStubRoutines, codeBlocks, locker);
+ CompositeMarkHook<JITStubRoutineSet, CodeBlockSet> markHook(jitStubRoutines, codeBlocks);
genericAddSpan(begin, end, markHook);
}