Reviewers: Michael Starzinger,
Description:
Filter out recorded slots of deoptimized code objects directly after
deoptimization.
BUG=chromium:507211
LOG=n
Please review this at https://codereview.chromium.org/1257653011/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+7, -53 lines):
M src/heap/mark-compact.h
M src/heap/mark-compact.cc
Index: src/heap/mark-compact.cc
diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc
index
878efd639e192c04147f8c583e045c90999b4fa7..71290f192da172f1f9d948f60341c3cd56af67ed
100644
--- a/src/heap/mark-compact.cc
+++ b/src/heap/mark-compact.cc
@@ -293,8 +293,6 @@ void
MarkCompactCollector::ClearInvalidSlotsBufferEntries(PagedSpace* space) {
void MarkCompactCollector::ClearInvalidStoreAndSlotsBufferEntries() {
heap_->store_buffer()->ClearInvalidStoreBufferEntries();
- RemoveDeoptimizedCodeSlots();
-
ClearInvalidSlotsBufferEntries(heap_->old_space());
ClearInvalidSlotsBufferEntries(heap_->code_space());
ClearInvalidSlotsBufferEntries(heap_->map_space());
@@ -769,7 +767,6 @@ void MarkCompactCollector::AbortCompaction() {
}
compacting_ = false;
evacuation_candidates_.Rewind(0);
- invalidated_code_.Rewind(0);
}
DCHECK_EQ(0, evacuation_candidates_.length());
}
@@ -3593,7 +3590,11 @@ void MarkCompactCollector::InvalidateCode(Code*
code) {
MarkBit mark_bit = Marking::MarkBitFrom(code);
if (Marking::IsWhite(mark_bit)) return;
- invalidated_code_.Add(code);
+ // Ignore all slots that might have been recorded in the body of the
+ // deoptimized code object. Assumption: no slots will be recorded for
+ // this object after invalidating it.
+ RemoveObjectSlots(code->instruction_start(),
+ code->address() + code->Size());
}
}
@@ -3604,42 +3605,6 @@ bool MarkCompactCollector::WillBeDeoptimized(Code*
code) {
}
-void MarkCompactCollector::RemoveDeoptimizedCodeSlots() {
- int length = invalidated_code_.length();
- for (int i = 0; i < length; i++) {
- Code* code = invalidated_code_[i];
- Page* p = Page::FromAddress(code->address());
- if (!p->IsEvacuationCandidate() &&
- !p->IsFlagSet(Page::RESCAN_ON_EVACUATION)) {
- // Ignore all slots that might have been recorded in the body of the
- // deoptimized code object.
- RemoveObjectSlots(code->instruction_start(),
- code->address() + code->Size());
- }
- }
-}
-
-
-void MarkCompactCollector::RemoveDeadInvalidatedCode() {
- int length = invalidated_code_.length();
- for (int i = 0; i < length; i++) {
- if (!IsMarked(invalidated_code_[i])) invalidated_code_[i] = NULL;
- }
-}
-
-
-void MarkCompactCollector::ProcessInvalidatedCode(ObjectVisitor* visitor) {
- int length = invalidated_code_.length();
- for (int i = 0; i < length; i++) {
- Code* code = invalidated_code_[i];
- if (code != NULL) {
- code->Iterate(visitor);
- }
- }
- invalidated_code_.Rewind(0);
-}
-
-
void MarkCompactCollector::RemoveObjectSlots(Address start_slot,
Address end_slot) {
// Remove entries by replacing them with an old-space slot containing a
smi
@@ -3647,9 +3612,8 @@ void MarkCompactCollector::RemoveObjectSlots(Address
start_slot,
int npages = evacuation_candidates_.length();
for (int i = 0; i < npages; i++) {
Page* p = evacuation_candidates_[i];
- DCHECK(p->IsEvacuationCandidate() ||
- p->IsFlagSet(Page::RESCAN_ON_EVACUATION));
- if (p->IsEvacuationCandidate()) {
+ if (!p->IsEvacuationCandidate() &&
+ !p->IsFlagSet(Page::RESCAN_ON_EVACUATION)) {
SlotsBuffer::RemoveObjectSlots(heap_, p->slots_buffer(), start_slot,
end_slot);
}
@@ -3801,10 +3765,6 @@ void
MarkCompactCollector::EvacuateNewSpaceAndCandidates() {
EvacuationWeakObjectRetainer evacuation_object_retainer;
heap()->ProcessAllWeakReferences(&evacuation_object_retainer);
- // Visit invalidated code (we ignored all slots on it) and clear
mark-bits
- // under it.
- ProcessInvalidatedCode(&updating_visitor);
-
heap_->isolate()->inner_pointer_to_code_cache()->Flush();
slots_buffer_allocator_.DeallocateChain(&migration_slots_buffer_);
@@ -4434,8 +4394,6 @@ void MarkCompactCollector::SweepSpaces() {
}
}
- RemoveDeadInvalidatedCode();
-
EvacuateNewSpaceAndCandidates();
heap()->FreeDeadArrayBuffers(false);
Index: src/heap/mark-compact.h
diff --git a/src/heap/mark-compact.h b/src/heap/mark-compact.h
index
8f68917c319bdd3382fcf0b7a3d6adfff3e928c6..cb326fc2b815b2339c2c33d1501933b654a1f2d8
100644
--- a/src/heap/mark-compact.h
+++ b/src/heap/mark-compact.h
@@ -758,10 +758,7 @@ class MarkCompactCollector {
explicit MarkCompactCollector(Heap* heap);
~MarkCompactCollector();
- void RemoveDeoptimizedCodeSlots();
bool WillBeDeoptimized(Code* code);
- void RemoveDeadInvalidatedCode();
- void ProcessInvalidatedCode(ObjectVisitor* visitor);
void EvictPopularEvacuationCandidate(Page* page);
void ClearInvalidSlotsBufferEntries(PagedSpace* space);
void ClearInvalidStoreAndSlotsBufferEntries();
@@ -978,7 +975,6 @@ class MarkCompactCollector {
bool have_code_to_deoptimize_;
List<Page*> evacuation_candidates_;
- List<Code*> invalidated_code_;
base::SmartPointer<FreeList> free_list_old_space_;
base::SmartPointer<FreeList> free_list_code_space_;
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.