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

Unified Diff: src/spaces-inl.h

Issue 22852024: Track JS allocations as they arrive with no affection on performance when tracking is switched off (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Make separate API for JS allocations recording, add example of checking JS allocations recording in… Created 7 years, 4 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/spaces-inl.h
diff --git a/src/spaces-inl.h b/src/spaces-inl.h
index 77117b8a4e4a9d960ad605f197cd623e888c5e47..ef679cd9451d75fd6df5e2098de5c1f949bac88e 100644
--- a/src/spaces-inl.h
+++ b/src/spaces-inl.h
@@ -28,6 +28,7 @@
#ifndef V8_SPACES_INL_H_
#define V8_SPACES_INL_H_
+#include "heap-profiler.h"
#include "isolate.h"
#include "spaces.h"
#include "v8memory.h"
@@ -273,7 +274,7 @@ HeapObject* PagedSpace::AllocateLinearly(int size_in_bytes) {
// Raw allocation.
-MaybeObject* PagedSpace::AllocateRaw(int size_in_bytes) {
+HeapObject* PagedSpace::AllocateRawHelper(int size_in_bytes) {
HeapObject* object = AllocateLinearly(size_in_bytes);
if (object != NULL) {
if (identity() == CODE_SPACE) {
@@ -302,6 +303,28 @@ MaybeObject* PagedSpace::AllocateRaw(int size_in_bytes) {
return object;
}
+ return NULL;
+}
+
+
+MaybeObject* PagedSpace::AllocateRaw(int size_in_bytes) {
+ HeapObject* object = AllocateRawHelper(size_in_bytes);
+ if (object != NULL) {
+ HeapProfiler* profiler = heap()->isolate()->heap_profiler();
+ if (profiler->is_tracking_allocations()) {
+ profiler->NewObjectEvent(object->address(), size_in_bytes);
+ }
+ return object;
+ }
+ return Failure::RetryAfterGC(identity());
+}
+
+
+MaybeObject* PagedSpace::AllocateRawForMigration(int size_in_bytes) {
+ HeapObject* object = AllocateRawHelper(size_in_bytes);
+ if (object != NULL) {
+ return object;
+ }
return Failure::RetryAfterGC(identity());
}
@@ -332,10 +355,15 @@ MaybeObject* NewSpace::AllocateRaw(int size_in_bytes) {
return SlowAllocateRaw(size_in_bytes);
}
- Object* obj = HeapObject::FromAddress(old_top);
+ HeapObject* obj = HeapObject::FromAddress(old_top);
loislo 2013/08/27 09:04:57 Could this line be moved down into the if ("tracki
Alexandra Mikhaylova 2013/09/19 16:03:38 I don't think so. Could you please explain why we
allocation_info_.top += size_in_bytes;
ASSERT_SEMISPACE_ALLOCATION_INFO(allocation_info_, to_space_);
+ HeapProfiler* profiler = heap()->isolate()->heap_profiler();
+ if (profiler->is_tracking_allocations()) {
+ profiler->NewObjectEvent(obj->address(), size_in_bytes);
+ }
+
return obj;
}

Powered by Google App Engine
This is Rietveld 408576698