OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // | 2 // |
3 // Tests for heap profiler | 3 // Tests for heap profiler |
4 | 4 |
5 #include "v8.h" | 5 #include "v8.h" |
6 | 6 |
7 #include "cctest.h" | 7 #include "cctest.h" |
8 #include "heap-profiler.h" | 8 #include "heap-profiler.h" |
9 #include "snapshot.h" | 9 #include "snapshot.h" |
10 #include "utils-inl.h" | 10 #include "utils-inl.h" |
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 const v8::HeapSnapshot* snapshot = | 767 const v8::HeapSnapshot* snapshot = |
768 v8::HeapProfiler::TakeSnapshot(v8_str("retained")); | 768 v8::HeapProfiler::TakeSnapshot(v8_str("retained")); |
769 | 769 |
770 CHECK_EQ(3, TestRetainedObjectInfo::instances.length()); | 770 CHECK_EQ(3, TestRetainedObjectInfo::instances.length()); |
771 for (int i = 0; i < TestRetainedObjectInfo::instances.length(); ++i) { | 771 for (int i = 0; i < TestRetainedObjectInfo::instances.length(); ++i) { |
772 CHECK(TestRetainedObjectInfo::instances[i]->disposed()); | 772 CHECK(TestRetainedObjectInfo::instances[i]->disposed()); |
773 delete TestRetainedObjectInfo::instances[i]; | 773 delete TestRetainedObjectInfo::instances[i]; |
774 } | 774 } |
775 | 775 |
776 const v8::HeapGraphNode* native_group_aaa = GetNode( | 776 const v8::HeapGraphNode* native_group_aaa = GetNode( |
777 snapshot->GetRoot(), v8::HeapGraphNode::kNative, "aaa-group"); | 777 snapshot->GetRoot(), v8::HeapGraphNode::kSynthetic, "aaa-group"); |
778 CHECK_NE(NULL, native_group_aaa); | 778 CHECK_NE(NULL, native_group_aaa); |
779 CHECK_EQ(1, native_group_aaa->GetChildrenCount()); | 779 CHECK_EQ(1, native_group_aaa->GetChildrenCount()); |
780 const v8::HeapGraphNode* aaa = GetNode( | 780 const v8::HeapGraphNode* aaa = GetNode( |
781 native_group_aaa, v8::HeapGraphNode::kNative, "aaa / 100 entries"); | 781 native_group_aaa, v8::HeapGraphNode::kNative, "aaa / 100 entries"); |
782 CHECK_NE(NULL, aaa); | 782 CHECK_NE(NULL, aaa); |
783 CHECK_EQ(2, aaa->GetChildrenCount()); | 783 CHECK_EQ(2, aaa->GetChildrenCount()); |
784 | 784 |
785 const v8::HeapGraphNode* native_group_ccc = GetNode( | 785 const v8::HeapGraphNode* native_group_ccc = GetNode( |
786 snapshot->GetRoot(), v8::HeapGraphNode::kNative, "ccc-group"); | 786 snapshot->GetRoot(), v8::HeapGraphNode::kSynthetic, "ccc-group"); |
787 const v8::HeapGraphNode* ccc = GetNode( | 787 const v8::HeapGraphNode* ccc = GetNode( |
788 native_group_ccc, v8::HeapGraphNode::kNative, "ccc"); | 788 native_group_ccc, v8::HeapGraphNode::kNative, "ccc"); |
789 CHECK_NE(NULL, ccc); | 789 CHECK_NE(NULL, ccc); |
790 | 790 |
791 const v8::HeapGraphNode* n_AAA = GetNode( | 791 const v8::HeapGraphNode* n_AAA = GetNode( |
792 aaa, v8::HeapGraphNode::kString, "AAA"); | 792 aaa, v8::HeapGraphNode::kString, "AAA"); |
793 CHECK_NE(NULL, n_AAA); | 793 CHECK_NE(NULL, n_AAA); |
794 const v8::HeapGraphNode* n_BBB = GetNode( | 794 const v8::HeapGraphNode* n_BBB = GetNode( |
795 aaa, v8::HeapGraphNode::kString, "BBB"); | 795 aaa, v8::HeapGraphNode::kString, "BBB"); |
796 CHECK_NE(NULL, n_BBB); | 796 CHECK_NE(NULL, n_BBB); |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1224 v8::HeapProfiler::TakeSnapshot(v8_str("fun")); | 1224 v8::HeapProfiler::TakeSnapshot(v8_str("fun")); |
1225 const v8::HeapGraphNode* global = GetGlobalObject(snapshot); | 1225 const v8::HeapGraphNode* global = GetGlobalObject(snapshot); |
1226 CHECK_NE(NULL, global); | 1226 CHECK_NE(NULL, global); |
1227 const v8::HeapGraphNode* fun = | 1227 const v8::HeapGraphNode* fun = |
1228 GetProperty(global, v8::HeapGraphEdge::kShortcut, "fun"); | 1228 GetProperty(global, v8::HeapGraphEdge::kShortcut, "fun"); |
1229 CHECK(HasWeakEdge(fun)); | 1229 CHECK(HasWeakEdge(fun)); |
1230 const v8::HeapGraphNode* shared = | 1230 const v8::HeapGraphNode* shared = |
1231 GetProperty(fun, v8::HeapGraphEdge::kInternal, "shared"); | 1231 GetProperty(fun, v8::HeapGraphEdge::kInternal, "shared"); |
1232 CHECK(HasWeakEdge(shared)); | 1232 CHECK(HasWeakEdge(shared)); |
1233 } | 1233 } |
OLD | NEW |