Index: src/api.cc |
diff --git a/src/api.cc b/src/api.cc |
index f6398aedf5ea50100398db2b73a20edb5984c9b8..aeef7ba4bf2cb9f95eb57d674b5e9430d65f6604 100644 |
--- a/src/api.cc |
+++ b/src/api.cc |
@@ -7512,6 +7512,44 @@ const CpuProfileNode* CpuProfileNode::GetChild(int index) const { |
} |
+unsigned CpuProfileNode::GetDeoptCount() const { |
+ const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); |
+ return static_cast<unsigned>(node->deopt_infos().size()); |
+} |
+ |
+ |
+const CpuProfileDeoptInfo* CpuProfileNode::GetDeoptInfo(unsigned index) const { |
+ const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); |
+ DCHECK_LT(index, node->deopt_infos().size()); |
yurys
2015/03/30 13:20:18
Drop this as List already performs such checks.
|
+ if (index >= node->deopt_infos().size()) return NULL; |
+ const i::DeoptInfo& deopt_info = node->deopt_infos().at(index); |
+ return reinterpret_cast<const CpuProfileDeoptInfo*>(&deopt_info); |
+} |
+ |
+ |
+const char* CpuProfileDeoptInfo::GetDeoptReason() const { |
+ const i::DeoptInfo* deopt_info = reinterpret_cast<const i::DeoptInfo*>(this); |
+ return deopt_info->deopt_reason; |
+} |
+ |
+ |
+unsigned CpuProfileDeoptInfo::GetFramesCount() const { |
+ const i::DeoptInfo* deopt_info = reinterpret_cast<const i::DeoptInfo*>(this); |
+ return static_cast<unsigned>(deopt_info->stack.size()); |
+} |
+ |
+ |
+bool CpuProfileDeoptInfo::GetCallFrames(Frame* frames, |
yurys
2015/03/30 13:20:18
Return number of written frames?
|
+ unsigned int length) const { |
+ if (frames == NULL || length == 0) return false; |
+ const i::DeoptInfo* deopt_info = reinterpret_cast<const i::DeoptInfo*>(this); |
+ for (size_t i = 0; i < deopt_info->stack.size() && i < length; ++i) { |
+ frames[i] = deopt_info->stack[i]; |
+ } |
+ return true; |
+} |
+ |
+ |
void CpuProfile::Delete() { |
i::Isolate* isolate = i::Isolate::Current(); |
i::CpuProfiler* profiler = isolate->cpu_profiler(); |