void Heap::ResetAllAllocationSitesDependentCode(PretenureFlag flag) {
+ ASSERT(AllowCodeDependencyChange::IsAllowed());
+ DisallowHeapAllocation no_allocation_scope;
Object* cur = allocation_sites_list();
+ bool marked = false;
while (cur->IsAllocationSite()) {
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;
}
cur = casted->weak_next();
}
+ if (marked) Deoptimizer::DeoptimizeMarkedCode(isolate_);
}
}
-void DependentCode::DeoptimizeDependentCodeGroup(
+bool DependentCode::MarkCodeForDeoptimization(
Isolate* isolate,
DependentCode::DependencyGroup group) {
ASSERT(AllowCodeDependencyChange::IsAllowed());
int start = starts.at(group);
int end = starts.at(group + 1);
int code_entries = starts.number_of_entries();
- if (start == end) return;
+ if (start == end) return false;
// Mark all the code that needs to be deoptimized.
bool marked = false;
clear_at(i);
}
set_number_of_entries(group, 0);
+ return marked;
+}
+
+
+void DependentCode::DeoptimizeDependentCodeGroup(
+ Isolate* isolate,
+ DependentCode::DependencyGroup group) {
+ ASSERT(AllowCodeDependencyChange::IsAllowed());
+ DisallowHeapAllocation no_allocation_scope;
+ bool marked = MarkCodeForDeoptimization(isolate, group);
if (marked) Deoptimizer::DeoptimizeMarkedCode(isolate);
}
void AllocationSite::ResetPretenureDecision() {
- dependent_code()->DeoptimizeDependentCodeGroup(
- GetIsolate(),
- DependentCode::kAllocationSiteTenuringChangedGroup);
set_pretenure_decision(kUndecided);
set_memento_found_count(0);
set_memento_create_count(0);
void DeoptimizeDependentCodeGroup(Isolate* isolate,
DependentCode::DependencyGroup group);
+ bool MarkCodeForDeoptimization(Isolate* isolate,
+ DependentCode::DependencyGroup group);
+
// The following low-level accessors should only be used by this class
// and the mark compact collector.
inline int number_of_entries(DependencyGroup group);