From a3aa9e96ef09793bdfd67bf398bf79d064101596 Mon Sep 17 00:00:00 2001 From: "kasperl@chromium.org" Date: Thu, 17 Dec 2009 09:16:44 +0000 Subject: [PATCH] Don't bother callling into the ProducerHeapProfile methods if logging producers is turned off. Review URL: http://codereview.chromium.org/500092 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3483 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/heap-profiler.cc | 5 +++-- src/heap-profiler.h | 6 +++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/heap-profiler.cc b/src/heap-profiler.cc index bd1cd2d..b615055 100644 --- a/src/heap-profiler.cc +++ b/src/heap-profiler.cc @@ -667,8 +667,9 @@ void ProducerHeapProfile::Setup() { can_log_ = true; } -void ProducerHeapProfile::RecordJSObjectAllocation(Object* obj) { - if (!can_log_ || !FLAG_log_producers) return; +void ProducerHeapProfile::DoRecordJSObjectAllocation(Object* obj) { + ASSERT(FLAG_log_producers); + if (!can_log_) return; int framesCount = 0; for (JavaScriptFrameIterator it; !it.done(); it.Advance()) { ++framesCount; diff --git a/src/heap-profiler.h b/src/heap-profiler.h index f8cb04d..c615942 100644 --- a/src/heap-profiler.h +++ b/src/heap-profiler.h @@ -261,8 +261,12 @@ class RetainerHeapProfile BASE_EMBEDDED { class ProducerHeapProfile : public AllStatic { public: static void Setup(); - static void RecordJSObjectAllocation(Object* obj); + static void RecordJSObjectAllocation(Object* obj) { + if (FLAG_log_producers) DoRecordJSObjectAllocation(obj); + } + private: + static void DoRecordJSObjectAllocation(Object* obj); static bool can_log_; }; -- 2.7.4