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() { ...@@ -426,10 +426,6 @@ void Heap::GarbageCollectionPrologue() {
AllowHeapAllocation for_the_first_part_of_prologue; AllowHeapAllocation for_the_first_part_of_prologue;
gc_count_++; gc_count_++;
if (FLAG_flush_code) {
mark_compact_collector()->EnableCodeFlushing(true);
}
#ifdef VERIFY_HEAP #ifdef VERIFY_HEAP
if (FLAG_verify_heap) { if (FLAG_verify_heap) {
Verify(); Verify();
......
...@@ -59,7 +59,7 @@ MarkCompactCollector::MarkCompactCollector(Heap* heap) ...@@ -59,7 +59,7 @@ MarkCompactCollector::MarkCompactCollector(Heap* heap)
heap_(heap), heap_(heap),
marking_deque_memory_(NULL), marking_deque_memory_(NULL),
marking_deque_memory_committed_(0), marking_deque_memory_committed_(0),
code_flusher_(NULL), code_flusher_(nullptr),
have_code_to_deoptimize_(false), have_code_to_deoptimize_(false),
compacting_(false), compacting_(false),
sweeping_in_progress_(false), sweeping_in_progress_(false),
...@@ -247,6 +247,13 @@ void MarkCompactCollector::SetUp() { ...@@ -247,6 +247,13 @@ void MarkCompactCollector::SetUp() {
EnsureMarkingDequeIsReserved(); EnsureMarkingDequeIsReserved();
EnsureMarkingDequeIsCommitted(kMinMarkingDequeSize); EnsureMarkingDequeIsCommitted(kMinMarkingDequeSize);
slots_buffer_allocator_ = new SlotsBufferAllocator(); 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() { ...@@ -254,6 +261,7 @@ void MarkCompactCollector::TearDown() {
AbortCompaction(); AbortCompaction();
delete marking_deque_memory_; delete marking_deque_memory_;
delete slots_buffer_allocator_; delete slots_buffer_allocator_;
delete code_flusher_;
} }
...@@ -1060,30 +1068,6 @@ void CodeFlusher::EvictCandidate(JSFunction* function) { ...@@ -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) { void CodeFlusher::IteratePointersToFromSpace(ObjectVisitor* v) {
Heap* heap = isolate_->heap(); Heap* heap = isolate_->heap();
...@@ -1099,14 +1083,6 @@ void CodeFlusher::IteratePointersToFromSpace(ObjectVisitor* v) { ...@@ -1099,14 +1083,6 @@ void CodeFlusher::IteratePointersToFromSpace(ObjectVisitor* v) {
} }
MarkCompactCollector::~MarkCompactCollector() {
if (code_flusher_ != NULL) {
delete code_flusher_;
code_flusher_ = NULL;
}
}
class MarkCompactMarkingVisitor class MarkCompactMarkingVisitor
: public StaticMarkingVisitor<MarkCompactMarkingVisitor> { : public StaticMarkingVisitor<MarkCompactMarkingVisitor> {
public: public:
...@@ -4082,25 +4058,6 @@ void MarkCompactCollector::ParallelSweepSpacesComplete() { ...@@ -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. // TODO(1466) ReportDeleteIfNeeded is not called currently.
// Our profiling tools do not expect intersections between // Our profiling tools do not expect intersections between
// code objects. We should either reenable it or change our tools. // code objects. We should either reenable it or change our tools.
......
...@@ -279,18 +279,11 @@ class CodeFlusher { ...@@ -279,18 +279,11 @@ class CodeFlusher {
ProcessJSFunctionCandidates(); ProcessJSFunctionCandidates();
} }
void EvictAllCandidates() {
EvictJSFunctionCandidates();
EvictSharedFunctionInfoCandidates();
}
void IteratePointersToFromSpace(ObjectVisitor* v); void IteratePointersToFromSpace(ObjectVisitor* v);
private: private:
void ProcessJSFunctionCandidates(); void ProcessJSFunctionCandidates();
void ProcessSharedFunctionInfoCandidates(); void ProcessSharedFunctionInfoCandidates();
void EvictJSFunctionCandidates();
void EvictSharedFunctionInfoCandidates();
static inline JSFunction** GetNextCandidateSlot(JSFunction* candidate); static inline JSFunction** GetNextCandidateSlot(JSFunction* candidate);
static inline JSFunction* GetNextCandidate(JSFunction* candidate); static inline JSFunction* GetNextCandidate(JSFunction* candidate);
...@@ -371,7 +364,6 @@ class MarkCompactCollector { ...@@ -371,7 +364,6 @@ class MarkCompactCollector {
CodeFlusher* code_flusher() { return code_flusher_; } CodeFlusher* code_flusher() { return code_flusher_; }
inline bool is_code_flushing_enabled() const { return code_flusher_ != NULL; } inline bool is_code_flushing_enabled() const { return code_flusher_ != NULL; }
void EnableCodeFlushing(bool enable);
enum SweeperType { enum SweeperType {
CONCURRENT_SWEEPING, CONCURRENT_SWEEPING,
...@@ -517,7 +509,6 @@ class MarkCompactCollector { ...@@ -517,7 +509,6 @@ class MarkCompactCollector {
class SweeperTask; class SweeperTask;
explicit MarkCompactCollector(Heap* heap); explicit MarkCompactCollector(Heap* heap);
~MarkCompactCollector();
bool WillBeDeoptimized(Code* code); bool WillBeDeoptimized(Code* code);
void EvictPopularEvacuationCandidate(Page* page); void EvictPopularEvacuationCandidate(Page* page);
......
...@@ -684,6 +684,11 @@ bool StaticMarkingVisitor<StaticVisitor>::IsFlushable( ...@@ -684,6 +684,11 @@ bool StaticMarkingVisitor<StaticVisitor>::IsFlushable(
return false; 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 // If this is a function initialized with %SetCode then the one-to-one
// relation between SharedFunctionInfo and Code is broken. // relation between SharedFunctionInfo and Code is broken.
if (shared_info->dont_flush()) { 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