Revision: 18149
Author:   [email protected]
Date:     Fri Nov 29 09:47:32 2013 UTC
Log:      Move heap profiler state flags to HeapProfiler

- moved is_tracking_objects_ flag to HeapProfiler and renamed it to is_tracking_objects_moves_
- Removed redundant call to UpdateHeapObjectsMap

BUG=None
LOG=N
[email protected], [email protected]

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

Modified:
 /branches/bleeding_edge/src/builtins.cc
 /branches/bleeding_edge/src/heap-profiler.cc
 /branches/bleeding_edge/src/heap-profiler.h
 /branches/bleeding_edge/src/heap-snapshot-generator.cc
 /branches/bleeding_edge/src/heap-snapshot-generator.h
 /branches/bleeding_edge/src/heap.cc
 /branches/bleeding_edge/src/mark-compact.cc

=======================================
--- /branches/bleeding_edge/src/builtins.cc     Thu Nov 28 15:32:55 2013 UTC
+++ /branches/bleeding_edge/src/builtins.cc     Fri Nov 29 09:47:32 2013 UTC
@@ -276,15 +276,15 @@
   FixedArrayBase* new_elms = FixedArrayBase::cast(HeapObject::FromAddress(
       elms->address() + size_delta));
   HeapProfiler* profiler = heap->isolate()->heap_profiler();
-  if (profiler->is_profiling()) {
+  if (profiler->is_tracking_object_moves()) {
     profiler->ObjectMoveEvent(elms->address(),
                               new_elms->address(),
                               new_elms->Size());
-    if (profiler->is_tracking_allocations()) {
-      // Report filler object as a new allocation.
-      // Otherwise it will become an untracked object.
-      profiler->NewObjectEvent(elms->address(), elms->Size());
-    }
+  }
+  if (profiler->is_tracking_allocations()) {
+    // Report filler object as a new allocation.
+    // Otherwise it will become an untracked object.
+    profiler->NewObjectEvent(elms->address(), elms->Size());
   }
   return new_elms;
 }
=======================================
--- /branches/bleeding_edge/src/heap-profiler.cc Wed Nov 20 14:57:39 2013 UTC +++ /branches/bleeding_edge/src/heap-profiler.cc Fri Nov 29 09:47:32 2013 UTC
@@ -36,7 +36,8 @@
 HeapProfiler::HeapProfiler(Heap* heap)
     : snapshots_(new HeapSnapshotsCollection(heap)),
       next_snapshot_uid_(1),
-      is_tracking_allocations_(false) {
+      is_tracking_allocations_(false),
+      is_tracking_object_moves_(false) {
 }


@@ -84,6 +85,7 @@
     }
   }
   snapshots_->SnapshotGenerationFinished(result);
+  is_tracking_object_moves_ = true;
   return result;
 }

@@ -98,6 +100,7 @@

 void HeapProfiler::StartHeapObjectsTracking() {
   snapshots_->StartHeapObjectsTracking();
+  is_tracking_object_moves_ = true;
 }


@@ -159,7 +162,6 @@
   StartHeapObjectsTracking();
   heap()->DisableInlineAllocation();
   is_tracking_allocations_ = true;
-  snapshots_->UpdateHeapObjectsMap();
 }


=======================================
--- /branches/bleeding_edge/src/heap-profiler.h Wed Nov 20 14:57:39 2013 UTC
+++ /branches/bleeding_edge/src/heap-profiler.h Fri Nov 29 09:47:32 2013 UTC
@@ -73,15 +73,10 @@

   v8::RetainedObjectInfo* ExecuteWrapperClassCallback(uint16_t class_id,
                                                       Object** wrapper);
-  INLINE(bool is_profiling()) {
-    return snapshots_->is_tracking_objects();
-  }
-
   void SetRetainedObjectInfo(UniqueId id, RetainedObjectInfo* info);

-  bool is_tracking_allocations() {
-    return is_tracking_allocations_;
-  }
+ bool is_tracking_object_moves() const { return is_tracking_object_moves_; }
+  bool is_tracking_allocations() const { return is_tracking_allocations_; }

   void StartHeapAllocationsRecording();
   void StopHeapAllocationsRecording();
@@ -97,6 +92,7 @@
   unsigned next_snapshot_uid_;
   List<v8::HeapProfiler::WrapperInfoCallback> wrapper_callbacks_;
   bool is_tracking_allocations_;
+  bool is_tracking_object_moves_;
 };

 } }  // namespace v8::internal
=======================================
--- /branches/bleeding_edge/src/heap-snapshot-generator.cc Fri Nov 22 07:34:21 2013 UTC +++ /branches/bleeding_edge/src/heap-snapshot-generator.cc Fri Nov 29 09:47:32 2013 UTC
@@ -747,8 +747,7 @@


 HeapSnapshotsCollection::HeapSnapshotsCollection(Heap* heap)
-    : is_tracking_objects_(false),
-      names_(heap),
+    : names_(heap),
       ids_(heap),
       allocation_tracker_(NULL) {
 }
@@ -770,7 +769,6 @@
   if (allocation_tracker_ == NULL) {
     allocation_tracker_ = new AllocationTracker(&ids_, names());
   }
-  is_tracking_objects_ = true;
 }


@@ -785,7 +783,6 @@

 HeapSnapshot* HeapSnapshotsCollection::NewSnapshot(const char* name,
                                                    unsigned uid) {
-  is_tracking_objects_ = true;  // Start watching for heap objects moves.
   return new HeapSnapshot(this, name, uid);
 }

=======================================
--- /branches/bleeding_edge/src/heap-snapshot-generator.h Fri Nov 22 13:50:39 2013 UTC +++ /branches/bleeding_edge/src/heap-snapshot-generator.h Fri Nov 29 09:47:32 2013 UTC
@@ -294,7 +294,6 @@

   Heap* heap() const { return ids_.heap(); }

-  bool is_tracking_objects() { return is_tracking_objects_; }
   SnapshotObjectId PushHeapObjectsStats(OutputStream* stream) {
     return ids_.PushHeapObjectsStats(stream);
   }
@@ -329,11 +328,8 @@
   size_t GetUsedMemorySize() const;

   int FindUntrackedObjects() { return ids_.FindUntrackedObjects(); }
-
-  void UpdateHeapObjectsMap() { ids_.UpdateHeapObjectsMap(); }

  private:
-  bool is_tracking_objects_;  // Whether tracking object moves is needed.
   List<HeapSnapshot*> snapshots_;
   StringsStorage names_;
   // Mapping from HeapObject addresses to objects' uids.
=======================================
--- /branches/bleeding_edge/src/heap.cc Wed Nov 27 14:03:40 2013 UTC
+++ /branches/bleeding_edge/src/heap.cc Fri Nov 29 09:47:32 2013 UTC
@@ -2196,7 +2196,7 @@
       RecordCopiedObject(heap, target);
       Isolate* isolate = heap->isolate();
       HeapProfiler* heap_profiler = isolate->heap_profiler();
-      if (heap_profiler->is_profiling()) {
+      if (heap_profiler->is_tracking_object_moves()) {
heap_profiler->ObjectMoveEvent(source->address(), target->address(),
                                        size);
       }
@@ -2447,7 +2447,7 @@
       isolate()->logger()->is_logging() ||
       isolate()->cpu_profiler()->is_profiling() ||
       (isolate()->heap_profiler() != NULL &&
-       isolate()->heap_profiler()->is_profiling());
+       isolate()->heap_profiler()->is_tracking_object_moves());

   if (!incremental_marking()->IsMarking()) {
     if (!logging_and_profiling) {
=======================================
--- /branches/bleeding_edge/src/mark-compact.cc Wed Nov 27 14:03:40 2013 UTC
+++ /branches/bleeding_edge/src/mark-compact.cc Fri Nov 29 09:47:32 2013 UTC
@@ -2768,7 +2768,7 @@
                                          int size,
                                          AllocationSpace dest) {
   HeapProfiler* heap_profiler = heap()->isolate()->heap_profiler();
-  if (heap_profiler->is_profiling()) {
+  if (heap_profiler->is_tracking_object_moves()) {
     heap_profiler->ObjectMoveEvent(src, dst, size);
   }
   ASSERT(heap()->AllowedToBeMigrated(HeapObject::FromAddress(src), dest));

--
--
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