Chromium Code Reviews| 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 "debug.h" | 10 #include "debug.h" |
| 11 #include "utils-inl.h" | 11 #include "utils-inl.h" |
| 12 #include "../include/v8-profiler.h" | 12 #include "../include/v8-profiler.h" |
| 13 #include <ctype.h> | |
|
mnaganov (inactive)
2012/04/19 13:52:29
System headers must go before project headers:
ht
alexeif
2012/04/19 15:27:43
Done.
| |
| 13 | 14 |
| 14 namespace { | 15 namespace { |
| 15 | 16 |
| 16 class NamedEntriesDetector { | 17 class NamedEntriesDetector { |
| 17 public: | 18 public: |
| 18 NamedEntriesDetector() | 19 NamedEntriesDetector() |
| 19 : has_A2(false), has_B2(false), has_C2(false) { | 20 : has_A2(false), has_B2(false), has_C2(false) { |
| 20 } | 21 } |
| 21 | 22 |
| 22 void CheckEntry(i::HeapEntry* entry) { | 23 void CheckEntry(i::HeapEntry* entry) { |
| (...skipping 1591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1614 // Dipose the persistent handles in a different order. | 1615 // Dipose the persistent handles in a different order. |
| 1615 p_AAA.Dispose(); | 1616 p_AAA.Dispose(); |
| 1616 CHECK_EQ(global_handle_count + 2, | 1617 CHECK_EQ(global_handle_count + 2, |
| 1617 v8::HeapProfiler::GetPersistentHandleCount()); | 1618 v8::HeapProfiler::GetPersistentHandleCount()); |
| 1618 p_CCC.Dispose(); | 1619 p_CCC.Dispose(); |
| 1619 CHECK_EQ(global_handle_count + 1, | 1620 CHECK_EQ(global_handle_count + 1, |
| 1620 v8::HeapProfiler::GetPersistentHandleCount()); | 1621 v8::HeapProfiler::GetPersistentHandleCount()); |
| 1621 p_BBB.Dispose(); | 1622 p_BBB.Dispose(); |
| 1622 CHECK_EQ(global_handle_count, v8::HeapProfiler::GetPersistentHandleCount()); | 1623 CHECK_EQ(global_handle_count, v8::HeapProfiler::GetPersistentHandleCount()); |
| 1623 } | 1624 } |
| 1625 | |
| 1626 | |
| 1627 TEST(AllStrongGcRootsHaveNames) { | |
| 1628 v8::HandleScope scope; | |
| 1629 LocalContext env; | |
| 1630 | |
| 1631 CompileRun("foo = {};"); | |
| 1632 const v8::HeapSnapshot* snapshot = | |
| 1633 v8::HeapProfiler::TakeSnapshot(v8_str("snapshot")); | |
| 1634 const v8::HeapGraphNode* gc_roots = GetNode( | |
| 1635 snapshot->GetRoot(), v8::HeapGraphNode::kObject, "(GC roots)"); | |
| 1636 CHECK_NE(NULL, gc_roots); | |
| 1637 const v8::HeapGraphNode* strong_roots = GetNode( | |
| 1638 gc_roots, v8::HeapGraphNode::kObject, "(Strong roots)"); | |
| 1639 CHECK_NE(NULL, strong_roots); | |
| 1640 for (int i = 0; i < strong_roots->GetChildrenCount(); ++i) { | |
| 1641 const v8::HeapGraphEdge* edge = strong_roots->GetChild(i); | |
| 1642 CHECK_EQ(v8::HeapGraphEdge::kInternal, edge->GetType()); | |
| 1643 v8::String::AsciiValue name(edge->GetName()); | |
| 1644 CHECK(isalpha(**name)); | |
| 1645 } | |
| 1646 } | |
| OLD | NEW |