Revision: 17625
Author:   [email protected]
Date:     Mon Nov 11 17:46:08 2013 UTC
Log:      Move old-space allocation tracking into Heap::AllocateRaw.

[email protected]

Review URL: https://codereview.chromium.org/68663002
http://code.google.com/p/v8/source/detail?r=17625

Modified:
 /branches/bleeding_edge/src/heap-inl.h
 /branches/bleeding_edge/src/heap.cc
 /branches/bleeding_edge/src/mark-compact.cc
 /branches/bleeding_edge/src/spaces-inl.h
 /branches/bleeding_edge/src/spaces.h

=======================================
--- /branches/bleeding_edge/src/heap-inl.h      Fri Nov  8 17:23:25 2013 UTC
+++ /branches/bleeding_edge/src/heap-inl.h      Mon Nov 11 17:46:08 2013 UTC
@@ -259,6 +259,9 @@
     result = map_space_->AllocateRaw(size_in_bytes);
   }
   if (result->IsFailure()) old_gen_exhausted_ = true;
+  if (profiler->is_tracking_allocations() && result->To(&object)) {
+    profiler->NewObjectEvent(object->address(), size_in_bytes);
+  }
   return result;
 }

=======================================
--- /branches/bleeding_edge/src/heap.cc Fri Nov  8 17:09:14 2013 UTC
+++ /branches/bleeding_edge/src/heap.cc Mon Nov 11 17:46:08 2013 UTC
@@ -4197,7 +4197,7 @@
   if (force_lo_space) {
     maybe_result = lo_space_->AllocateRaw(obj_size, EXECUTABLE);
   } else {
-    maybe_result = code_space_->AllocateRaw(obj_size);
+    maybe_result = AllocateRaw(obj_size, CODE_SPACE, CODE_SPACE);
   }
   if (!maybe_result->To<HeapObject>(&result)) return maybe_result;

@@ -4268,7 +4268,7 @@
   if (obj_size > code_space()->AreaSize()) {
     maybe_result = lo_space_->AllocateRaw(obj_size, EXECUTABLE);
   } else {
-    maybe_result = code_space_->AllocateRaw(obj_size);
+    maybe_result = AllocateRaw(obj_size, CODE_SPACE, CODE_SPACE);
   }

   Object* result;
@@ -4311,7 +4311,7 @@
   if (new_obj_size > code_space()->AreaSize()) {
     maybe_result = lo_space_->AllocateRaw(new_obj_size, EXECUTABLE);
   } else {
-    maybe_result = code_space_->AllocateRaw(new_obj_size);
+    maybe_result = AllocateRaw(new_obj_size, CODE_SPACE, CODE_SPACE);
   }

   Object* result;
=======================================
--- /branches/bleeding_edge/src/mark-compact.cc Wed Nov  6 09:29:09 2013 UTC
+++ /branches/bleeding_edge/src/mark-compact.cc Mon Nov 11 17:46:08 2013 UTC
@@ -2939,9 +2939,7 @@
   ASSERT(target_space == heap()->old_pointer_space() ||
          target_space == heap()->old_data_space());
   Object* result;
-  MaybeObject* maybe_result = target_space->AllocateRaw(
-      object_size,
-      PagedSpace::MOVE_OBJECT);
+  MaybeObject* maybe_result = target_space->AllocateRaw(object_size);
   if (maybe_result->ToObject(&result)) {
     HeapObject* target = HeapObject::cast(result);
     MigrateObject(target->address(),
@@ -3014,7 +3012,7 @@

       int size = object->Size();

- MaybeObject* target = space->AllocateRaw(size, PagedSpace::MOVE_OBJECT);
+      MaybeObject* target = space->AllocateRaw(size);
       if (target->IsFailure()) {
         // OS refused to give us memory.
         V8::FatalProcessOutOfMemory("Evacuation");
=======================================
--- /branches/bleeding_edge/src/spaces-inl.h    Fri Nov  8 17:23:25 2013 UTC
+++ /branches/bleeding_edge/src/spaces-inl.h    Mon Nov 11 17:46:08 2013 UTC
@@ -274,18 +274,12 @@


 // Raw allocation.
-MaybeObject* PagedSpace::AllocateRaw(int size_in_bytes,
-                                     AllocationType event) {
-  HeapProfiler* profiler = heap()->isolate()->heap_profiler();
-
+MaybeObject* PagedSpace::AllocateRaw(int size_in_bytes) {
   HeapObject* object = AllocateLinearly(size_in_bytes);
   if (object != NULL) {
     if (identity() == CODE_SPACE) {
       SkipList::Update(object->address(), size_in_bytes);
     }
-    if (event == NEW_OBJECT && profiler->is_tracking_allocations()) {
-      profiler->NewObjectEvent(object->address(), size_in_bytes);
-    }
     return object;
   }

@@ -298,9 +292,6 @@
     if (identity() == CODE_SPACE) {
       SkipList::Update(object->address(), size_in_bytes);
     }
-    if (event == NEW_OBJECT && profiler->is_tracking_allocations()) {
-      profiler->NewObjectEvent(object->address(), size_in_bytes);
-    }
     return object;
   }

@@ -309,9 +300,6 @@
     if (identity() == CODE_SPACE) {
       SkipList::Update(object->address(), size_in_bytes);
     }
-    if (event == NEW_OBJECT && profiler->is_tracking_allocations()) {
-      profiler->NewObjectEvent(object->address(), size_in_bytes);
-    }
     return object;
   }

=======================================
--- /branches/bleeding_edge/src/spaces.h        Tue Nov  5 11:59:42 2013 UTC
+++ /branches/bleeding_edge/src/spaces.h        Mon Nov 11 17:46:08 2013 UTC
@@ -1764,16 +1764,9 @@
     return allocation_info_.limit_address();
   }

-  enum AllocationType {
-    NEW_OBJECT,
-    MOVE_OBJECT
-  };
-
// Allocate the requested number of bytes in the space if possible, return a
   // failure object if not.
-  MUST_USE_RESULT inline MaybeObject* AllocateRaw(
-      int size_in_bytes,
-      AllocationType event = NEW_OBJECT);
+  MUST_USE_RESULT inline MaybeObject* AllocateRaw(int size_in_bytes);

   virtual bool ReserveSpace(int bytes);

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to