diff options
Diffstat (limited to 'Source/JavaScriptCore/heap/CodeBlockSet.h')
-rw-r--r-- | Source/JavaScriptCore/heap/CodeBlockSet.h | 58 |
1 files changed, 20 insertions, 38 deletions
diff --git a/Source/JavaScriptCore/heap/CodeBlockSet.h b/Source/JavaScriptCore/heap/CodeBlockSet.h index 56507c052..791d18699 100644 --- a/Source/JavaScriptCore/heap/CodeBlockSet.h +++ b/Source/JavaScriptCore/heap/CodeBlockSet.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013, 2014 Apple Inc. All rights reserved. + * Copyright (C) 2013 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -26,20 +26,16 @@ #ifndef CodeBlockSet_h #define CodeBlockSet_h -#include "GCSegmentedArray.h" -#include "HeapOperation.h" #include <wtf/HashSet.h> -#include <wtf/Lock.h> #include <wtf/Noncopyable.h> #include <wtf/PassRefPtr.h> -#include <wtf/PrintStream.h> #include <wtf/RefPtr.h> +#include <wtf/Vector.h> namespace JSC { class CodeBlock; class Heap; -class JSCell; class SlotVisitor; // CodeBlockSet tracks all CodeBlocks. Every CodeBlock starts out with one @@ -52,61 +48,47 @@ class CodeBlockSet { public: CodeBlockSet(); ~CodeBlockSet(); - - void lastChanceToFinalize(); // Add a CodeBlock. This is only called by CodeBlock constructors. - void add(CodeBlock*); + void add(PassRefPtr<CodeBlock>); + + // Clear all mark bits associated with DFG code blocks. + void clearMarks(); - // Clear all mark bits for all CodeBlocks. - void clearMarksForFullCollection(); - // Mark a pointer that may be a CodeBlock that belongs to the set of DFG // blocks. This is defined in CodeBlock.h. -private: - void mark(const LockHolder&, CodeBlock* candidateCodeBlock); -public: - void mark(const LockHolder&, void* candidateCodeBlock); + void mark(void* candidateCodeBlock); // Delete all code blocks that are only referenced by this set (i.e. owned // by this set), and that have not been marked. - void deleteUnmarkedAndUnreferenced(HeapOperation); + void deleteUnmarkedAndUnreferenced(); + // Trace all marked code blocks. The CodeBlock is free to make use of + // mayBeExecuting. + void traceMarked(SlotVisitor&); + // Add all currently executing CodeBlocks to the remembered set to be // re-scanned during the next collection. - void writeBarrierCurrentlyExecutingCodeBlocks(Heap*); - - bool contains(const LockHolder&, void* candidateCodeBlock); - Lock& getLock() { return m_lock; } + void rememberCurrentlyExecutingCodeBlocks(Heap*); // Visits each CodeBlock in the heap until the visitor function returns true // to indicate that it is done iterating, or until every CodeBlock has been // visited. template<typename Functor> void iterate(Functor& functor) { - LockHolder locker(m_lock); - for (auto& codeBlock : m_oldCodeBlocks) { + for (auto &codeBlock : m_set) { bool done = functor(codeBlock); if (done) - return; - } - - for (auto& codeBlock : m_newCodeBlocks) { - bool done = functor(codeBlock); - if (done) - return; + break; } } - - void dump(PrintStream&) const; private: - void promoteYoungCodeBlocks(const LockHolder&); - - HashSet<CodeBlock*> m_oldCodeBlocks; - HashSet<CodeBlock*> m_newCodeBlocks; - HashSet<CodeBlock*> m_currentlyExecuting; - Lock m_lock; + // This is not a set of RefPtr<CodeBlock> because we need to be able to find + // arbitrary bogus pointers. I could have written a thingy that had peek types + // and all, but that seemed like overkill. + HashSet<CodeBlock* > m_set; + Vector<CodeBlock*> m_currentlyExecuting; }; } // namespace JSC |