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 <ctype.h> | 5 #include <ctype.h> |
6 | 6 |
7 #include "v8.h" | 7 #include "v8.h" |
8 | 8 |
9 #include "cctest.h" | 9 #include "cctest.h" |
10 #include "heap-profiler.h" | 10 #include "heap-profiler.h" |
(...skipping 1627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1638 const v8::HeapGraphNode* strong_roots = GetNode( | 1638 const v8::HeapGraphNode* strong_roots = GetNode( |
1639 gc_roots, v8::HeapGraphNode::kObject, "(Strong roots)"); | 1639 gc_roots, v8::HeapGraphNode::kObject, "(Strong roots)"); |
1640 CHECK_NE(NULL, strong_roots); | 1640 CHECK_NE(NULL, strong_roots); |
1641 for (int i = 0; i < strong_roots->GetChildrenCount(); ++i) { | 1641 for (int i = 0; i < strong_roots->GetChildrenCount(); ++i) { |
1642 const v8::HeapGraphEdge* edge = strong_roots->GetChild(i); | 1642 const v8::HeapGraphEdge* edge = strong_roots->GetChild(i); |
1643 CHECK_EQ(v8::HeapGraphEdge::kInternal, edge->GetType()); | 1643 CHECK_EQ(v8::HeapGraphEdge::kInternal, edge->GetType()); |
1644 v8::String::AsciiValue name(edge->GetName()); | 1644 v8::String::AsciiValue name(edge->GetName()); |
1645 CHECK(isalpha(**name)); | 1645 CHECK(isalpha(**name)); |
1646 } | 1646 } |
1647 } | 1647 } |
| 1648 |
| 1649 |
| 1650 TEST(NoRefsToNonEssentialEntries) { |
| 1651 v8::HandleScope scope; |
| 1652 LocalContext env; |
| 1653 CompileRun("global_object = {};\n"); |
| 1654 const v8::HeapSnapshot* snapshot = |
| 1655 v8::HeapProfiler::TakeSnapshot(v8_str("snapshot")); |
| 1656 const v8::HeapGraphNode* global = GetGlobalObject(snapshot); |
| 1657 const v8::HeapGraphNode* global_object = |
| 1658 GetProperty(global, v8::HeapGraphEdge::kProperty, "global_object"); |
| 1659 CHECK_NE(NULL, global_object); |
| 1660 const v8::HeapGraphNode* properties = |
| 1661 GetProperty(global_object, v8::HeapGraphEdge::kInternal, "properties"); |
| 1662 CHECK_EQ(NULL, properties); |
| 1663 const v8::HeapGraphNode* elements = |
| 1664 GetProperty(global_object, v8::HeapGraphEdge::kInternal, "elements"); |
| 1665 CHECK_EQ(NULL, elements); |
| 1666 } |
OLD | NEW |