Reviewers: alph, loislo, Yang,

Description:
Get rid of HEAP_PROFILE macro

All usages of the macro were replaced with direct calls to the heap profiler.
The macro does null check for HeapProfiler which is always true.

BUG=None

Please review this at https://codereview.chromium.org/26166004/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+15, -14 lines):
  M src/builtins.cc
  M src/heap-profiler.h
  M src/heap.cc
  M src/mark-compact.cc


Index: src/builtins.cc
diff --git a/src/builtins.cc b/src/builtins.cc
index aaa8bc4d0cf2af17292b562712514dd143139f47..03fac2d1092ca7ce25af4ac8376696b53fa9dbd8 100644
--- a/src/builtins.cc
+++ b/src/builtins.cc
@@ -273,9 +273,12 @@ static FixedArrayBase* LeftTrimFixedArray(Heap* heap,
MemoryChunk::IncrementLiveBytesFromMutator(elms->address(), -size_delta);
   }

-  HEAP_PROFILE(heap, ObjectMoveEvent(elms->address(),
-                                     elms->address() + size_delta,
-                                     elms->Size()));
+  HeapProfiler* profiler = heap->isolate()->heap_profiler();
+  if (profiler->is_profiling()) {
+    profiler->ObjectMoveEvent(elms->address(),
+                              elms->address() + size_delta,
+                              elms->Size());
+  }
   return FixedArrayBase::cast(HeapObject::FromAddress(
       elms->address() + to_trim * entry_size));
 }
Index: src/heap-profiler.h
diff --git a/src/heap-profiler.h b/src/heap-profiler.h
index 96ae273902ed604fb20a217220275148f68f5bbf..74002278d40beb1a23a06523da4d5c6066911c9f 100644
--- a/src/heap-profiler.h
+++ b/src/heap-profiler.h
@@ -37,14 +37,6 @@ namespace internal {
 class HeapSnapshot;
 class HeapSnapshotsCollection;

-#define HEAP_PROFILE(heap, call) \ - do { \ - v8::internal::HeapProfiler* profiler = heap->isolate()->heap_profiler(); \ - if (profiler != NULL && profiler->is_profiling()) { \ - profiler->call; \ - } \
-  } while (false)
-
 class HeapProfiler {
  public:
   explicit HeapProfiler(Heap* heap);
Index: src/heap.cc
diff --git a/src/heap.cc b/src/heap.cc
index 76f34b263a3861c04fcbdd493f016daaa69d9a54..fec45d433bd86b351c216f392d57f43a3de43544 100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -2130,9 +2130,12 @@ class ScavengingVisitor : public StaticVisitorBase {
     if (logging_and_profiling_mode == LOGGING_AND_PROFILING_ENABLED) {
       // Update NewSpace stats if necessary.
       RecordCopiedObject(heap, target);
-      HEAP_PROFILE(heap,
- ObjectMoveEvent(source->address(), target->address(), size));
       Isolate* isolate = heap->isolate();
+      HeapProfiler* heap_profiler = isolate->heap_profiler();
+      if (heap_profiler->is_profiling()) {
+ heap_profiler->ObjectMoveEvent(source->address(), target->address(),
+                                       size);
+      }
       if (isolate->logger()->is_logging_code_events() ||
           isolate->cpu_profiler()->is_profiling()) {
         if (target->IsSharedFunctionInfo()) {
Index: src/mark-compact.cc
diff --git a/src/mark-compact.cc b/src/mark-compact.cc
index 2f8f5d74799652614098324fbcf98f6df2d5e455..8ec1e4be9f5048f72f0a6d8d7a167cb7cb5b6e47 100644
--- a/src/mark-compact.cc
+++ b/src/mark-compact.cc
@@ -2759,7 +2759,10 @@ void MarkCompactCollector::MigrateObject(Address dst,
                                          Address src,
                                          int size,
                                          AllocationSpace dest) {
-  HEAP_PROFILE(heap(), ObjectMoveEvent(src, dst, size));
+  HeapProfiler* heap_profiler = heap()->isolate()->heap_profiler();
+  if (heap_profiler->is_profiling()) {
+    heap_profiler->ObjectMoveEvent(src, dst, size);
+  }
   ASSERT(heap()->AllowedToBeMigrated(HeapObject::FromAddress(src), dest));
   ASSERT(dest != LO_SPACE && size <= Page::kMaxNonCodeHeapObjectSize);
   if (dest == OLD_POINTER_SPACE) {


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