From a4e969f4965059196ca948db781e52f7cfebf19e Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Tue, 24 May 2016 08:28:08 +0000 Subject: webkitgtk-2.12.3 --- Source/JavaScriptCore/heap/CodeBlockSet.h | 58 ++++++++++++++++++++----------- 1 file changed, 38 insertions(+), 20 deletions(-) (limited to 'Source/JavaScriptCore/heap/CodeBlockSet.h') diff --git a/Source/JavaScriptCore/heap/CodeBlockSet.h b/Source/JavaScriptCore/heap/CodeBlockSet.h index 791d18699..56507c052 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, 2014 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,16 +26,20 @@ #ifndef CodeBlockSet_h #define CodeBlockSet_h +#include "GCSegmentedArray.h" +#include "HeapOperation.h" #include +#include #include #include +#include #include -#include namespace JSC { class CodeBlock; class Heap; +class JSCell; class SlotVisitor; // CodeBlockSet tracks all CodeBlocks. Every CodeBlock starts out with one @@ -48,47 +52,61 @@ class CodeBlockSet { public: CodeBlockSet(); ~CodeBlockSet(); + + void lastChanceToFinalize(); // Add a CodeBlock. This is only called by CodeBlock constructors. - void add(PassRefPtr); - - // 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(HeapOperation); - // 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 rememberCurrentlyExecutingCodeBlocks(Heap*); + void writeBarrierCurrentlyExecutingCodeBlocks(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 void iterate(Functor& functor) { - for (auto &codeBlock : m_set) { + LockHolder locker(m_lock); + for (auto& codeBlock : m_oldCodeBlocks) { bool done = functor(codeBlock); if (done) - break; + return; + } + + for (auto& codeBlock : m_newCodeBlocks) { + bool done = functor(codeBlock); + if (done) + return; } } + + void dump(PrintStream&) const; private: - // This is not a set of RefPtr 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 m_set; - Vector m_currentlyExecuting; + void promoteYoungCodeBlocks(const LockHolder&); + + HashSet m_oldCodeBlocks; + HashSet m_newCodeBlocks; + HashSet m_currentlyExecuting; + Lock m_lock; }; } // namespace JSC -- cgit v1.2.1