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

Unified Diff: src/heap/spaces-inl.h

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-inl.h
diff --git a/src/heap/spaces-inl.h b/src/heap/spaces-inl.h
index 3023fbf51ead410fba6a14aaab99dff05e5acf61..55eed7dbb9eadaba463c27ed5bdb45fe6cb1c3ae 100644
--- a/src/heap/spaces-inl.h
+++ b/src/heap/spaces-inl.h
@@ -425,12 +425,24 @@ AllocationResult PagedSpace::AllocateRawAligned(int size_in_bytes,
AllocationResult PagedSpace::AllocateRaw(int size_in_bytes,
AllocationAlignment alignment) {
#ifdef V8_HOST_ARCH_32_BIT
- return alignment == kDoubleAligned
- ? AllocateRawAligned(size_in_bytes, kDoubleAligned)
- : AllocateRawUnaligned(size_in_bytes);
+ AllocationResult result =
+ alignment == kDoubleAligned
+ ? AllocateRawAligned(size_in_bytes, kDoubleAligned)
+ : AllocateRawUnaligned(size_in_bytes);
#else
- return AllocateRawUnaligned(size_in_bytes);
+ AllocationResult result = AllocateRawUnaligned(size_in_bytes);
#endif
+ if (!result.IsRetry()) {
+ Object* obj = result.ToObjectChecked();
+ if (obj->IsHeapObject()) {
ofrobots 2016/01/23 16:16:31 Why is this check necessary here?
ofrobots 2016/01/26 00:38:25 *bump*
mattloring 2016/01/26 00:42:48 An Object can be an Smi or a HeapObject so I check
ofrobots 2016/01/26 15:47:15 We just allocated an object on the heap; so this c
+ HeapObject* heap_obj = static_cast<HeapObject*>(obj);
+ for (int i = 0; i < allocation_observers_.length(); ++i) {
+ AllocationObserver* o = allocation_observers_[i];
+ o->AllocationStep(size_in_bytes, heap_obj->address(), size_in_bytes);
+ }
+ }
+ }
+ return result;
}

Powered by Google App Engine
This is Rietveld 408576698