Commit 54469cbb authored by mstarzinger's avatar mstarzinger Committed by Commit bot

[heap] Remove ability to turn off code flushing on demand.

This moves the decision whether code flushing is active into the setup
phase of the GC. Components are no longer allowed to dynamically switch
the code flushing mode on demand.

R=hpayer@chromium.org

Review URL: https://codereview.chromium.org/1487743002

Cr-Commit-Position: refs/heads/master@{#32446}
parent e68dda83
......@@ -426,10 +426,6 @@ void Heap::GarbageCollectionPrologue() {
AllowHeapAllocation for_the_first_part_of_prologue;
gc_count_++;
if (FLAG_flush_code) {
mark_compact_collector()->EnableCodeFlushing(true);
}
#ifdef VERIFY_HEAP
if (FLAG_verify_heap) {
Verify();
......
......@@ -59,7 +59,7 @@ MarkCompactCollector::MarkCompactCollector(Heap* heap)
heap_(heap),
marking_deque_memory_(NULL),
marking_deque_memory_committed_(0),
code_flusher_(NULL),
code_flusher_(nullptr),
have_code_to_deoptimize_(false),
compacting_(false),
sweeping_in_progress_(false),
......@@ -247,6 +247,13 @@ void MarkCompactCollector::SetUp() {
EnsureMarkingDequeIsReserved();
EnsureMarkingDequeIsCommitted(kMinMarkingDequeSize);
slots_buffer_allocator_ = new SlotsBufferAllocator();
if (FLAG_flush_code) {
code_flusher_ = new CodeFlusher(isolate());
if (FLAG_trace_code_flushing) {
PrintF("[code-flushing is now on]\n");
}
}
}
......@@ -254,6 +261,7 @@ void MarkCompactCollector::TearDown() {
AbortCompaction();
delete marking_deque_memory_;
delete slots_buffer_allocator_;
delete code_flusher_;
}
......@@ -1060,30 +1068,6 @@ void CodeFlusher::EvictCandidate(JSFunction* function) {
}
void CodeFlusher::EvictJSFunctionCandidates() {
JSFunction* candidate = jsfunction_candidates_head_;
JSFunction* next_candidate;
while (candidate != NULL) {
next_candidate = GetNextCandidate(candidate);
EvictCandidate(candidate);
candidate = next_candidate;
}
DCHECK(jsfunction_candidates_head_ == NULL);
}
void CodeFlusher::EvictSharedFunctionInfoCandidates() {
SharedFunctionInfo* candidate = shared_function_info_candidates_head_;
SharedFunctionInfo* next_candidate;
while (candidate != NULL) {
next_candidate = GetNextCandidate(candidate);
EvictCandidate(candidate);
candidate = next_candidate;
}
DCHECK(shared_function_info_candidates_head_ == NULL);
}
void CodeFlusher::IteratePointersToFromSpace(ObjectVisitor* v) {
Heap* heap = isolate_->heap();
......@@ -1099,14 +1083,6 @@ void CodeFlusher::IteratePointersToFromSpace(ObjectVisitor* v) {
}
MarkCompactCollector::~MarkCompactCollector() {
if (code_flusher_ != NULL) {
delete code_flusher_;
code_flusher_ = NULL;
}
}
class MarkCompactMarkingVisitor
: public StaticMarkingVisitor<MarkCompactMarkingVisitor> {
public:
......@@ -4082,25 +4058,6 @@ void MarkCompactCollector::ParallelSweepSpacesComplete() {
}
void MarkCompactCollector::EnableCodeFlushing(bool enable) {
if (isolate()->debug()->is_active()) enable = false;
if (enable) {
if (code_flusher_ != NULL) return;
code_flusher_ = new CodeFlusher(isolate());
} else {
if (code_flusher_ == NULL) return;
code_flusher_->EvictAllCandidates();
delete code_flusher_;
code_flusher_ = NULL;
}
if (FLAG_trace_code_flushing) {
PrintF("[code-flushing is now %s]\n", enable ? "on" : "off");
}
}
// TODO(1466) ReportDeleteIfNeeded is not called currently.
// Our profiling tools do not expect intersections between
// code objects. We should either reenable it or change our tools.
......
......@@ -279,18 +279,11 @@ class CodeFlusher {
ProcessJSFunctionCandidates();
}
void EvictAllCandidates() {
EvictJSFunctionCandidates();
EvictSharedFunctionInfoCandidates();
}
void IteratePointersToFromSpace(ObjectVisitor* v);
private:
void ProcessJSFunctionCandidates();
void ProcessSharedFunctionInfoCandidates();
void EvictJSFunctionCandidates();
void EvictSharedFunctionInfoCandidates();
static inline JSFunction** GetNextCandidateSlot(JSFunction* candidate);
static inline JSFunction* GetNextCandidate(JSFunction* candidate);
......@@ -371,7 +364,6 @@ class MarkCompactCollector {
CodeFlusher* code_flusher() { return code_flusher_; }
inline bool is_code_flushing_enabled() const { return code_flusher_ != NULL; }
void EnableCodeFlushing(bool enable);
enum SweeperType {
CONCURRENT_SWEEPING,
......@@ -517,7 +509,6 @@ class MarkCompactCollector {
class SweeperTask;
explicit MarkCompactCollector(Heap* heap);
~MarkCompactCollector();
bool WillBeDeoptimized(Code* code);
void EvictPopularEvacuationCandidate(Page* page);
......
......@@ -684,6 +684,11 @@ bool StaticMarkingVisitor<StaticVisitor>::IsFlushable(
return false;
}
// Maintain debug break slots in the code.
if (shared_info->HasDebugCode()) {
return false;
}
// If this is a function initialized with %SetCode then the one-to-one
// relation between SharedFunctionInfo and Code is broken.
if (shared_info->dont_flush()) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment