Index: src/api.cc |
diff --git a/src/api.cc b/src/api.cc |
index 7a967dbffd5a0e684c523a39586e54317d05820f..e7a9e5c340dce6562a390ccf841452f3cbdc402a 100644 |
--- a/src/api.cc |
+++ b/src/api.cc |
@@ -4592,10 +4592,18 @@ Handle<String> HeapGraphNode::GetName() const { |
uint64_t HeapGraphNode::GetId() const { |
IsDeadCheck("v8::HeapGraphNode::GetId"); |
+ ASSERT(ToInternal(this)->snapshot()->type() != i::HeapSnapshot::kAggregated); |
return ToInternal(this)->id(); |
} |
+int HeapGraphNode::GetInstancesCount() const { |
+ IsDeadCheck("v8::HeapGraphNode::GetInstancesCount"); |
+ ASSERT(ToInternal(this)->snapshot()->type() == i::HeapSnapshot::kAggregated); |
+ return static_cast<int>(ToInternal(this)->id()); |
+} |
+ |
+ |
int HeapGraphNode::GetSelfSize() const { |
IsDeadCheck("v8::HeapGraphNode::GetSelfSize"); |
return ToInternal(this)->self_size(); |
@@ -4677,6 +4685,12 @@ static i::HeapSnapshot* ToInternal(const HeapSnapshot* snapshot) { |
} |
+HeapSnapshot::Type HeapSnapshot::GetType() const { |
+ IsDeadCheck("v8::HeapSnapshot::GetType"); |
+ return static_cast<HeapSnapshot::Type>(ToInternal(this)->type()); |
+} |
+ |
+ |
unsigned HeapSnapshot::GetUid() const { |
IsDeadCheck("v8::HeapSnapshot::GetUid"); |
return ToInternal(this)->uid(); |
@@ -4724,10 +4738,22 @@ const HeapSnapshot* HeapProfiler::FindSnapshot(unsigned uid) { |
} |
-const HeapSnapshot* HeapProfiler::TakeSnapshot(Handle<String> title) { |
+const HeapSnapshot* HeapProfiler::TakeSnapshot(Handle<String> title, |
+ HeapSnapshot::Type type) { |
IsDeadCheck("v8::HeapProfiler::TakeSnapshot"); |
+ i::HeapSnapshot::Type internal_type = i::HeapSnapshot::kFull; |
+ switch (type) { |
+ case HeapSnapshot::kFull: |
+ internal_type = i::HeapSnapshot::kFull; |
+ break; |
+ case HeapSnapshot::kAggregated: |
+ internal_type = i::HeapSnapshot::kAggregated; |
+ break; |
+ default: |
+ UNREACHABLE(); |
+ } |
return reinterpret_cast<const HeapSnapshot*>( |
- i::HeapProfiler::TakeSnapshot(*Utils::OpenHandle(*title))); |
+ i::HeapProfiler::TakeSnapshot(*Utils::OpenHandle(*title), internal_type)); |
} |
#endif // ENABLE_LOGGING_AND_PROFILING |