Index: src/heap-profiler.h |
=================================================================== |
--- src/heap-profiler.h (revision 7267) |
+++ src/heap-profiler.h (working copy) |
@@ -28,6 +28,7 @@ |
#ifndef V8_HEAP_PROFILER_H_ |
#define V8_HEAP_PROFILER_H_ |
+#include "isolate.h" |
#include "zone-inl.h" |
namespace v8 { |
@@ -38,14 +39,15 @@ |
class HeapSnapshot; |
class HeapSnapshotsCollection; |
-#define HEAP_PROFILE(Call) \ |
- do { \ |
- if (v8::internal::HeapProfiler::is_profiling()) { \ |
- v8::internal::HeapProfiler::Call; \ |
- } \ |
+#define HEAP_PROFILE(heap, call) \ |
+ do { \ |
+ v8::internal::HeapProfiler* profiler = heap->isolate()->heap_profiler(); \ |
+ if (profiler != NULL && profiler->is_profiling()) { \ |
+ profiler->call; \ |
+ } \ |
} while (false) |
#else |
-#define HEAP_PROFILE(Call) ((void) 0) |
+#define HEAP_PROFILE(heap, call) ((void) 0) |
#endif // ENABLE_LOGGING_AND_PROFILING |
// The HeapProfiler writes data to the log files, which can be postprocessed |
@@ -66,15 +68,15 @@ |
static HeapSnapshot* GetSnapshot(int index); |
static HeapSnapshot* FindSnapshot(unsigned uid); |
- static void ObjectMoveEvent(Address from, Address to); |
+ void ObjectMoveEvent(Address from, Address to); |
- static void DefineWrapperClass( |
+ void DefineWrapperClass( |
uint16_t class_id, v8::HeapProfiler::WrapperInfoCallback callback); |
- static v8::RetainedObjectInfo* ExecuteWrapperClassCallback(uint16_t class_id, |
- Object** wrapper); |
- static INLINE(bool is_profiling()) { |
- return singleton_ != NULL && singleton_->snapshots_->is_tracking_objects(); |
+ v8::RetainedObjectInfo* ExecuteWrapperClassCallback(uint16_t class_id, |
+ Object** wrapper); |
+ INLINE(bool is_profiling()) { |
+ return snapshots_->is_tracking_objects(); |
} |
// Obsolete interface. |
@@ -95,7 +97,6 @@ |
unsigned next_snapshot_uid_; |
List<v8::HeapProfiler::WrapperInfoCallback> wrapper_callbacks_; |
- static HeapProfiler* singleton_; |
#endif // ENABLE_LOGGING_AND_PROFILING |
}; |
@@ -154,10 +155,10 @@ |
// We use symbols that are illegal JS identifiers to identify special cases. |
// Their actual value is irrelevant for us. |
switch (special) { |
- case ROOTS: return Heap::result_symbol(); |
- case GLOBAL_PROPERTY: return Heap::code_symbol(); |
- case CODE: return Heap::arguments_shadow_symbol(); |
- case SELF: return Heap::catch_var_symbol(); |
+ case ROOTS: return HEAP->result_symbol(); |
+ case GLOBAL_PROPERTY: return HEAP->code_symbol(); |
+ case CODE: return HEAP->arguments_shadow_symbol(); |
+ case SELF: return HEAP->catch_var_symbol(); |
default: |
UNREACHABLE(); |
return NULL; |
@@ -347,7 +348,6 @@ |
class HeapEntriesMap; |
class HeapEntriesAllocator; |
-class HeapSnapshot; |
class AggregatedHeapSnapshotGenerator { |
public: |
@@ -368,16 +368,23 @@ |
}; |
-class ProducerHeapProfile : public AllStatic { |
+class ProducerHeapProfile { |
public: |
- static void Setup(); |
- static void RecordJSObjectAllocation(Object* obj) { |
+ void Setup(); |
+ void RecordJSObjectAllocation(Object* obj) { |
if (FLAG_log_producers) DoRecordJSObjectAllocation(obj); |
} |
private: |
- static void DoRecordJSObjectAllocation(Object* obj); |
- static bool can_log_; |
+ ProducerHeapProfile() : can_log_(false) { } |
+ |
+ void DoRecordJSObjectAllocation(Object* obj); |
+ Isolate* isolate_; |
+ bool can_log_; |
+ |
+ friend class Isolate; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ProducerHeapProfile); |
}; |
#endif // ENABLE_LOGGING_AND_PROFILING |