summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/heap/CodeBlockSet.h
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
commit1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch)
tree46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/JavaScriptCore/heap/CodeBlockSet.h
parent32761a6cee1d0dee366b885b7b9c777e67885688 (diff)
downloadWebKitGtk-tarball-master.tar.gz
Diffstat (limited to 'Source/JavaScriptCore/heap/CodeBlockSet.h')
-rw-r--r--Source/JavaScriptCore/heap/CodeBlockSet.h67
1 files changed, 33 insertions, 34 deletions
diff --git a/Source/JavaScriptCore/heap/CodeBlockSet.h b/Source/JavaScriptCore/heap/CodeBlockSet.h
index 791d18699..0fca79adc 100644
--- a/Source/JavaScriptCore/heap/CodeBlockSet.h
+++ b/Source/JavaScriptCore/heap/CodeBlockSet.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2017 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -23,20 +23,22 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef CodeBlockSet_h
-#define CodeBlockSet_h
+#pragma once
+#include "CollectionScope.h"
+#include "GCSegmentedArray.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 SlotVisitor;
+class JSCell;
+class VM;
// CodeBlockSet tracks all CodeBlocks. Every CodeBlock starts out with one
// reference coming in from GC. The GC is responsible for freeing CodeBlocks
@@ -48,50 +50,47 @@ class CodeBlockSet {
public:
CodeBlockSet();
~CodeBlockSet();
+
+ void lastChanceToFinalize(VM&);
// Add a CodeBlock. This is only called by CodeBlock constructors.
- void add(PassRefPtr<CodeBlock>);
-
- // Clear all mark bits associated with DFG code blocks.
- void clearMarks();
+ void add(CodeBlock*);
+ // 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.
- void mark(void* candidateCodeBlock);
+private:
+ void mark(const LockHolder&, CodeBlock* candidateCodeBlock);
+public:
+ void mark(const LockHolder&, 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();
+ void deleteUnmarkedAndUnreferenced(VM&, CollectionScope);
- // Trace all marked code blocks. The CodeBlock is free to make use of
- // mayBeExecuting.
- void traceMarked(SlotVisitor&);
+ void clearCurrentlyExecuting();
- // Add all currently executing CodeBlocks to the remembered set to be
- // re-scanned during the next collection.
- void rememberCurrentlyExecutingCodeBlocks(Heap*);
+ bool contains(const LockHolder&, void* candidateCodeBlock);
+ Lock& getLock() { return m_lock; }
// 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)
- {
- for (auto &codeBlock : m_set) {
- bool done = functor(codeBlock);
- if (done)
- break;
- }
- }
+ template<typename Functor> void iterate(const Functor&);
+
+ template<typename Functor> void iterateCurrentlyExecuting(const Functor&);
+
+ void dump(PrintStream&) const;
private:
- // 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;
+ void promoteYoungCodeBlocks(const LockHolder&);
+
+ HashSet<CodeBlock*> m_oldCodeBlocks;
+ HashSet<CodeBlock*> m_newCodeBlocks;
+ HashSet<CodeBlock*> m_currentlyExecuting;
+ Lock m_lock;
};
} // namespace JSC
-
-#endif // CodeBlockSet_h
-