Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(583)

Unified Diff: src/heap/spaces.cc

Issue 1427973006: [heap] make inline allocation step size dynamic (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap/spaces.h ('k') | test/cctest/test-spaces.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/spaces.cc
diff --git a/src/heap/spaces.cc b/src/heap/spaces.cc
index a5e2760bb09d0004cfc8dec007121f946fda583c..2d3a3bf219c6bb9a4cf64644240c90d56ee3347b 100644
--- a/src/heap/spaces.cc
+++ b/src/heap/spaces.cc
@@ -1516,7 +1516,7 @@ void NewSpace::UpdateInlineAllocationLimit(int size_in_bytes) {
// Lower limit during incremental marking.
Address high = to_space_.page_high();
Address new_top = allocation_info_.top() + size_in_bytes;
- Address new_limit = new_top + inline_allocation_limit_step_;
+ Address new_limit = new_top + GetNextInlineAllocationStepSize();
allocation_info_.set_limit(Min(new_limit, high));
}
DCHECK_SEMISPACE_ALLOCATION_INFO(allocation_info_, to_space_);
@@ -1601,21 +1601,28 @@ bool NewSpace::EnsureAllocation(int size_in_bytes,
}
-void NewSpace::UpdateInlineAllocationLimitStep() {
- intptr_t step = 0;
+void NewSpace::StartNextInlineAllocationStep() {
+ top_on_previous_step_ =
+ inline_allocation_observers_.length() ? allocation_info_.top() : 0;
+ UpdateInlineAllocationLimit(0);
+}
+
+
+intptr_t NewSpace::GetNextInlineAllocationStepSize() {
+ intptr_t next_step = 0;
for (int i = 0; i < inline_allocation_observers_.length(); ++i) {
- InlineAllocationObserver* observer = inline_allocation_observers_[i];
- step = step ? Min(step, observer->step_size()) : observer->step_size();
+ InlineAllocationObserver* o = inline_allocation_observers_[i];
+ next_step = next_step ? Min(next_step, o->bytes_to_next_step())
+ : o->bytes_to_next_step();
}
- inline_allocation_limit_step_ = step;
- top_on_previous_step_ = step ? allocation_info_.top() : 0;
- UpdateInlineAllocationLimit(0);
+ DCHECK(inline_allocation_observers_.length() == 0 || next_step != 0);
+ return next_step;
}
void NewSpace::AddInlineAllocationObserver(InlineAllocationObserver* observer) {
inline_allocation_observers_.Add(observer);
- UpdateInlineAllocationLimitStep();
+ StartNextInlineAllocationStep();
}
@@ -1625,7 +1632,7 @@ void NewSpace::RemoveInlineAllocationObserver(
// Only used in assertion. Suppress unused variable warning.
static_cast<void>(removed);
DCHECK(removed);
- UpdateInlineAllocationLimitStep();
+ StartNextInlineAllocationStep();
}
« no previous file with comments | « src/heap/spaces.h ('k') | test/cctest/test-spaces.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698