Reviewers: Mads Ager, Description: Don't bother callling into the ProducerHeapProfile methods if logging producers is turned off.
Please review this at http://codereview.chromium.org/500092 SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/ Affected files: M bleeding_edge/src/heap-profiler.h M bleeding_edge/src/heap-profiler.cc Index: bleeding_edge/src/heap-profiler.h =================================================================== --- bleeding_edge/src/heap-profiler.h (revision 3482) +++ bleeding_edge/src/heap-profiler.h (working copy) @@ -261,8 +261,12 @@ 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_; }; Index: bleeding_edge/src/heap-profiler.cc =================================================================== --- bleeding_edge/src/heap-profiler.cc (revision 3482) +++ bleeding_edge/src/heap-profiler.cc (working copy) @@ -667,8 +667,9 @@ 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; -- v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev
