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" |
11 #include "../include/v8-profiler.h" | 11 #include "../include/v8-profiler.h" |
12 | 12 |
13 namespace i = v8::internal; | |
14 | |
15 namespace { | 13 namespace { |
16 | 14 |
17 class NamedEntriesDetector { | 15 class NamedEntriesDetector { |
18 public: | 16 public: |
19 NamedEntriesDetector() | 17 NamedEntriesDetector() |
20 : has_A2(false), has_B2(false), has_C2(false) { | 18 : has_A2(false), has_B2(false), has_C2(false) { |
21 } | 19 } |
22 | 20 |
23 void Apply(i::HeapEntry** entry_ptr) { | 21 void Apply(i::HeapEntry** entry_ptr) { |
24 if (IsReachableNodeWithName(*entry_ptr, "A2")) has_A2 = true; | 22 if (IsReachableNodeWithName(*entry_ptr, "A2")) has_A2 = true; |
(...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
884 CHECK_NE(NULL, global); | 882 CHECK_NE(NULL, global); |
885 // Verify that we can find this object by iteration. | 883 // Verify that we can find this object by iteration. |
886 const int nodes_count = snapshot->GetNodesCount(); | 884 const int nodes_count = snapshot->GetNodesCount(); |
887 int count = 0; | 885 int count = 0; |
888 for (int i = 0; i < nodes_count; ++i) { | 886 for (int i = 0; i < nodes_count; ++i) { |
889 if (snapshot->GetNode(i) == global) | 887 if (snapshot->GetNode(i) == global) |
890 ++count; | 888 ++count; |
891 } | 889 } |
892 CHECK_EQ(1, count); | 890 CHECK_EQ(1, count); |
893 } | 891 } |
OLD | NEW |