Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Side by Side Diff: test/cctest/test-heap-profiler.cc

Issue 10128006: Show names for the strong roots in heap snapshot. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressing comments. Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/profile-generator.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <ctype.h>
8
7 #include "cctest.h" 9 #include "cctest.h"
8 #include "heap-profiler.h" 10 #include "heap-profiler.h"
9 #include "snapshot.h" 11 #include "snapshot.h"
10 #include "debug.h" 12 #include "debug.h"
11 #include "utils-inl.h" 13 #include "utils-inl.h"
12 #include "../include/v8-profiler.h" 14 #include "../include/v8-profiler.h"
13 15
14 namespace { 16 namespace {
15 17
16 class NamedEntriesDetector { 18 class NamedEntriesDetector {
(...skipping 1597 matching lines...) Expand 10 before | Expand all | Expand 10 after
1614 // Dipose the persistent handles in a different order. 1616 // Dipose the persistent handles in a different order.
1615 p_AAA.Dispose(); 1617 p_AAA.Dispose();
1616 CHECK_EQ(global_handle_count + 2, 1618 CHECK_EQ(global_handle_count + 2,
1617 v8::HeapProfiler::GetPersistentHandleCount()); 1619 v8::HeapProfiler::GetPersistentHandleCount());
1618 p_CCC.Dispose(); 1620 p_CCC.Dispose();
1619 CHECK_EQ(global_handle_count + 1, 1621 CHECK_EQ(global_handle_count + 1,
1620 v8::HeapProfiler::GetPersistentHandleCount()); 1622 v8::HeapProfiler::GetPersistentHandleCount());
1621 p_BBB.Dispose(); 1623 p_BBB.Dispose();
1622 CHECK_EQ(global_handle_count, v8::HeapProfiler::GetPersistentHandleCount()); 1624 CHECK_EQ(global_handle_count, v8::HeapProfiler::GetPersistentHandleCount());
1623 } 1625 }
1626
1627
1628 TEST(AllStrongGcRootsHaveNames) {
1629 v8::HandleScope scope;
1630 LocalContext env;
1631
1632 CompileRun("foo = {};");
1633 const v8::HeapSnapshot* snapshot =
1634 v8::HeapProfiler::TakeSnapshot(v8_str("snapshot"));
1635 const v8::HeapGraphNode* gc_roots = GetNode(
1636 snapshot->GetRoot(), v8::HeapGraphNode::kObject, "(GC roots)");
1637 CHECK_NE(NULL, gc_roots);
1638 const v8::HeapGraphNode* strong_roots = GetNode(
1639 gc_roots, v8::HeapGraphNode::kObject, "(Strong roots)");
1640 CHECK_NE(NULL, strong_roots);
1641 for (int i = 0; i < strong_roots->GetChildrenCount(); ++i) {
1642 const v8::HeapGraphEdge* edge = strong_roots->GetChild(i);
1643 CHECK_EQ(v8::HeapGraphEdge::kInternal, edge->GetType());
1644 v8::String::AsciiValue name(edge->GetName());
1645 CHECK(isalpha(**name));
1646 }
1647 }
OLDNEW
« no previous file with comments | « src/profile-generator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698