Index: src/heap.cc |
diff --git a/src/heap.cc b/src/heap.cc |
index c17794f99b394456583b5bf9d9241777f1bc0d63..cd202e390e5a9aa1bd3d52b15c8637b4520fddfe 100644 |
--- a/src/heap.cc |
+++ b/src/heap.cc |
@@ -545,7 +545,9 @@ void Heap::ProcessPretenuringFeedback() { |
} |
} |
- if (trigger_deoptimization) isolate_->stack_guard()->DeoptMarkedCode(); |
+ if (trigger_deoptimization) { |
+ isolate_->stack_guard()->DeoptMarkedAllocationSites(); |
+ } |
FlushAllocationSitesScratchpad(); |
@@ -567,6 +569,25 @@ void Heap::ProcessPretenuringFeedback() { |
} |
+void Heap::DeoptMarkedAllocationSites() { |
+ // TODO(hpayer): If iterating over the allocation sites list becomes a |
+ // performance issue, use a cache heap data structure instead (similar to the |
+ // allocation sites scratchpad). |
+ Object* list_element = allocation_sites_list(); |
+ while (list_element->IsAllocationSite()) { |
+ AllocationSite* site = AllocationSite::cast(list_element); |
+ if (site->deopt_dependent_code()) { |
+ site->dependent_code()->MarkCodeForDeoptimization( |
+ isolate_, |
+ DependentCode::kAllocationSiteTenuringChangedGroup); |
+ site->set_deopt_dependent_code(false); |
+ } |
+ list_element = site->weak_next(); |
+ } |
+ Deoptimizer::DeoptimizeMarkedCode(isolate_); |
+} |
+ |
+ |
void Heap::GarbageCollectionEpilogue() { |
store_buffer()->GCEpilogue(); |
@@ -2000,14 +2021,12 @@ void Heap::ResetAllAllocationSitesDependentCode(PretenureFlag flag) { |
AllocationSite* casted = AllocationSite::cast(cur); |
if (casted->GetPretenureMode() == flag) { |
casted->ResetPretenureDecision(); |
- bool got_marked = casted->dependent_code()->MarkCodeForDeoptimization( |
- isolate_, |
- DependentCode::kAllocationSiteTenuringChangedGroup); |
- if (got_marked) marked = true; |
+ casted->set_deopt_dependent_code(true); |
+ marked = true; |
} |
cur = casted->weak_next(); |
} |
- if (marked) isolate_->stack_guard()->DeoptMarkedCode(); |
+ if (marked) isolate_->stack_guard()->DeoptMarkedAllocationSites(); |
} |