Commit e3fdf3f4 authored by hpayer@chromium.org's avatar hpayer@chromium.org

Refactor DeoptimizeDependentCodeGroup.

BUG=
R=bmeurer@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@18639 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 97ab9bf1
...@@ -1983,14 +1983,22 @@ void Heap::ProcessAllocationSites(WeakObjectRetainer* retainer, ...@@ -1983,14 +1983,22 @@ void Heap::ProcessAllocationSites(WeakObjectRetainer* retainer,
void Heap::ResetAllAllocationSitesDependentCode(PretenureFlag flag) { void Heap::ResetAllAllocationSitesDependentCode(PretenureFlag flag) {
ASSERT(AllowCodeDependencyChange::IsAllowed());
DisallowHeapAllocation no_allocation_scope;
Object* cur = allocation_sites_list(); Object* cur = allocation_sites_list();
bool marked = false;
while (cur->IsAllocationSite()) { while (cur->IsAllocationSite()) {
AllocationSite* casted = AllocationSite::cast(cur); AllocationSite* casted = AllocationSite::cast(cur);
if (casted->GetPretenureMode() == flag) { if (casted->GetPretenureMode() == flag) {
casted->ResetPretenureDecision(); casted->ResetPretenureDecision();
bool got_marked = casted->dependent_code()->MarkCodeForDeoptimization(
isolate_,
DependentCode::kAllocationSiteTenuringChangedGroup);
if (got_marked) marked = true;
} }
cur = casted->weak_next(); cur = casted->weak_next();
} }
if (marked) Deoptimizer::DeoptimizeMarkedCode(isolate_);
} }
......
...@@ -11755,7 +11755,7 @@ bool DependentCode::Contains(DependencyGroup group, Code* code) { ...@@ -11755,7 +11755,7 @@ bool DependentCode::Contains(DependencyGroup group, Code* code) {
} }
void DependentCode::DeoptimizeDependentCodeGroup( bool DependentCode::MarkCodeForDeoptimization(
Isolate* isolate, Isolate* isolate,
DependentCode::DependencyGroup group) { DependentCode::DependencyGroup group) {
ASSERT(AllowCodeDependencyChange::IsAllowed()); ASSERT(AllowCodeDependencyChange::IsAllowed());
...@@ -11764,7 +11764,7 @@ void DependentCode::DeoptimizeDependentCodeGroup( ...@@ -11764,7 +11764,7 @@ void DependentCode::DeoptimizeDependentCodeGroup(
int start = starts.at(group); int start = starts.at(group);
int end = starts.at(group + 1); int end = starts.at(group + 1);
int code_entries = starts.number_of_entries(); 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. // Mark all the code that needs to be deoptimized.
bool marked = false; bool marked = false;
...@@ -11790,6 +11790,16 @@ void DependentCode::DeoptimizeDependentCodeGroup( ...@@ -11790,6 +11790,16 @@ void DependentCode::DeoptimizeDependentCodeGroup(
clear_at(i); clear_at(i);
} }
set_number_of_entries(group, 0); 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); if (marked) Deoptimizer::DeoptimizeMarkedCode(isolate);
} }
...@@ -12765,9 +12775,6 @@ const double AllocationSite::kPretenureRatio = 0.60; ...@@ -12765,9 +12775,6 @@ const double AllocationSite::kPretenureRatio = 0.60;
void AllocationSite::ResetPretenureDecision() { void AllocationSite::ResetPretenureDecision() {
dependent_code()->DeoptimizeDependentCodeGroup(
GetIsolate(),
DependentCode::kAllocationSiteTenuringChangedGroup);
set_pretenure_decision(kUndecided); set_pretenure_decision(kUndecided);
set_memento_found_count(0); set_memento_found_count(0);
set_memento_create_count(0); set_memento_create_count(0);
......
...@@ -5642,6 +5642,9 @@ class DependentCode: public FixedArray { ...@@ -5642,6 +5642,9 @@ class DependentCode: public FixedArray {
void DeoptimizeDependentCodeGroup(Isolate* isolate, void DeoptimizeDependentCodeGroup(Isolate* isolate,
DependentCode::DependencyGroup group); DependentCode::DependencyGroup group);
bool MarkCodeForDeoptimization(Isolate* isolate,
DependentCode::DependencyGroup group);
// The following low-level accessors should only be used by this class // The following low-level accessors should only be used by this class
// and the mark compact collector. // and the mark compact collector.
inline int number_of_entries(DependencyGroup group); inline int number_of_entries(DependencyGroup group);
......
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