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

Unified Diff: src/heap/spaces.cc

Issue 1625753002: Allocation sampling for paged/lo spaces (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 months 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
Index: src/heap/spaces.cc
diff --git a/src/heap/spaces.cc b/src/heap/spaces.cc
index cdf1a193b60295099d38b111f09ebba3f550a9f8..80e7851edf349d39f1e34fa891c7a4274ac85c6a 100644
--- a/src/heap/spaces.cc
+++ b/src/heap/spaces.cc
@@ -1655,7 +1655,7 @@ void NewSpace::StartNextInlineAllocationStep() {
intptr_t NewSpace::GetNextInlineAllocationStepSize() {
intptr_t next_step = 0;
for (int i = 0; i < inline_allocation_observers_.length(); ++i) {
- InlineAllocationObserver* o = inline_allocation_observers_[i];
+ AllocationObserver* o = inline_allocation_observers_[i];
next_step = next_step ? Min(next_step, o->bytes_to_next_step())
: o->bytes_to_next_step();
}
@@ -1664,14 +1664,13 @@ intptr_t NewSpace::GetNextInlineAllocationStepSize() {
}
-void NewSpace::AddInlineAllocationObserver(InlineAllocationObserver* observer) {
+void NewSpace::AddInlineAllocationObserver(AllocationObserver* observer) {
inline_allocation_observers_.Add(observer);
StartNextInlineAllocationStep();
}
-void NewSpace::RemoveInlineAllocationObserver(
- InlineAllocationObserver* observer) {
+void NewSpace::RemoveInlineAllocationObserver(AllocationObserver* observer) {
bool removed = inline_allocation_observers_.RemoveElement(observer);
// Only used in assertion. Suppress unused variable warning.
static_cast<void>(removed);
@@ -1701,8 +1700,8 @@ void NewSpace::InlineAllocationStep(Address top, Address new_top,
if (top_on_previous_step_) {
int bytes_allocated = static_cast<int>(top - top_on_previous_step_);
for (int i = 0; i < inline_allocation_observers_.length(); ++i) {
- inline_allocation_observers_[i]->InlineAllocationStep(bytes_allocated,
- soon_object, size);
+ inline_allocation_observers_[i]->AllocationStep(bytes_allocated,
+ soon_object, size);
}
top_on_previous_step_ = new_top;
}
@@ -3140,6 +3139,10 @@ AllocationResult LargeObjectSpace::AllocateRaw(int object_size,
}
heap()->incremental_marking()->OldSpaceStep(object_size);
+ for (int i = 0; i < allocation_observers_.length(); ++i) {
+ AllocationObserver* o = allocation_observers_[i];
+ o->AllocationStep(object_size, object->address(), object_size);
+ }
ofrobots 2016/01/23 16:16:31 This loop has been duplicated in a few places. It
mattloring 2016/01/26 00:42:48 Done.
return object;
}

Powered by Google App Engine
This is Rietveld 408576698