From 6dd52eaf4784b06af060bf054e07968e45937cdf Mon Sep 17 00:00:00 2001 From: jochen Date: Fri, 15 May 2015 00:37:15 -0700 Subject: [PATCH] Remove static logging of memory allocations We want to move to a world where there's no Isolate::Current but we always knows which isolate we're in. There's no way we can teach this info to the C++ allocator. BUG=none R=hpayer@chromium.org LOG=n Review URL: https://codereview.chromium.org/1128023005 Cr-Commit-Position: refs/heads/master@{#28414} --- src/globals.h | 20 -------------------- src/heap/spaces.h | 15 --------------- src/log.cc | 10 ---------- src/log.h | 5 ----- 4 files changed, 50 deletions(-) diff --git a/src/globals.h b/src/globals.h index 00623ca..7619831 100644 --- a/src/globals.h +++ b/src/globals.h @@ -645,26 +645,6 @@ struct AccessorDescriptor { #define DOUBLE_POINTER_ALIGN(value) \ (((value) + kDoubleAlignmentMask) & ~kDoubleAlignmentMask) -// Support for tracking C++ memory allocation. Insert TRACK_MEMORY("Fisk") -// inside a C++ class and new and delete will be overloaded so logging is -// performed. -// This file (globals.h) is included before log.h, so we use direct calls to -// the Logger rather than the LOG macro. -#ifdef DEBUG -#define TRACK_MEMORY(name) \ - void* operator new(size_t size) { \ - void* result = ::operator new(size); \ - Logger::NewEventStatic(name, result, size); \ - return result; \ - } \ - void operator delete(void* object) { \ - Logger::DeleteEventStatic(name, object); \ - ::operator delete(object); \ - } -#else -#define TRACK_MEMORY(name) -#endif - // CPU feature flags. enum CpuFeature { diff --git a/src/heap/spaces.h b/src/heap/spaces.h index f165663..7ea318d 100644 --- a/src/heap/spaces.h +++ b/src/heap/spaces.h @@ -2253,9 +2253,6 @@ class SemiSpace : public Space { friend class SemiSpaceIterator; friend class NewSpacePageIterator; - - public: - TRACK_MEMORY("SemiSpace") }; @@ -2625,9 +2622,6 @@ class NewSpace : public Space { SlowAllocateRaw(int size_in_bytes, AllocationAlignment alignment); friend class SemiSpaceIterator; - - public: - TRACK_MEMORY("NewSpace") }; @@ -2641,9 +2635,6 @@ class OldSpace : public PagedSpace { OldSpace(Heap* heap, intptr_t max_capacity, AllocationSpace id, Executability executable) : PagedSpace(heap, max_capacity, id, executable) {} - - public: - TRACK_MEMORY("OldSpace") }; @@ -2689,9 +2680,6 @@ class MapSpace : public PagedSpace { } const int max_map_space_pages_; - - public: - TRACK_MEMORY("MapSpace") }; @@ -2785,9 +2773,6 @@ class LargeObjectSpace : public Space { HashMap chunk_map_; friend class LargeObjectIterator; - - public: - TRACK_MEMORY("LargeObjectSpace") }; diff --git a/src/log.cc b/src/log.cc index ec2bb63..de99a77 100644 --- a/src/log.cc +++ b/src/log.cc @@ -1079,16 +1079,6 @@ void Logger::DeleteEvent(const char* name, void* object) { } -void Logger::NewEventStatic(const char* name, void* object, size_t size) { - Isolate::Current()->logger()->NewEvent(name, object, size); -} - - -void Logger::DeleteEventStatic(const char* name, void* object) { - Isolate::Current()->logger()->DeleteEvent(name, object); -} - - void Logger::CallbackEventInternal(const char* prefix, Name* name, Address entry_point) { if (!FLAG_log_code || !log_->IsEnabled()) return; diff --git a/src/log.h b/src/log.h index c0559e7..9402110 100644 --- a/src/log.h +++ b/src/log.h @@ -188,11 +188,6 @@ class Logger { void NewEvent(const char* name, void* object, size_t size); void DeleteEvent(const char* name, void* object); - // Static versions of the above, operate on current isolate's logger. - // Used in TRACK_MEMORY(TypeName) defined in globals.h - static void NewEventStatic(const char* name, void* object, size_t size); - static void DeleteEventStatic(const char* name, void* object); - // Emits an event with a tag, and some resource usage information. // -> (name, tag, ). // Currently, the resource usage information is a process time stamp -- 2.7.4