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

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

Issue 10096016: Remove Debug object from the user roots in heap profiler. (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 "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 "utils-inl.h" 11 #include "utils-inl.h"
11 #include "../include/v8-profiler.h" 12 #include "../include/v8-profiler.h"
12 13
13 namespace { 14 namespace {
14 15
15 class NamedEntriesDetector { 16 class NamedEntriesDetector {
16 public: 17 public:
17 NamedEntriesDetector() 18 NamedEntriesDetector()
18 : has_A2(false), has_B2(false), has_C2(false) { 19 : has_A2(false), has_B2(false), has_C2(false) {
19 } 20 }
(...skipping 1536 matching lines...) Expand 10 before | Expand all | Expand 10 after
1556 CHECK_NE(NULL, global); 1557 CHECK_NE(NULL, global);
1557 const v8::HeapGraphNode* fun = 1558 const v8::HeapGraphNode* fun =
1558 GetProperty(global, v8::HeapGraphEdge::kProperty, "fun"); 1559 GetProperty(global, v8::HeapGraphEdge::kProperty, "fun");
1559 CHECK(HasWeakEdge(fun)); 1560 CHECK(HasWeakEdge(fun));
1560 const v8::HeapGraphNode* shared = 1561 const v8::HeapGraphNode* shared =
1561 GetProperty(fun, v8::HeapGraphEdge::kInternal, "shared"); 1562 GetProperty(fun, v8::HeapGraphEdge::kInternal, "shared");
1562 CHECK(HasWeakEdge(shared)); 1563 CHECK(HasWeakEdge(shared));
1563 } 1564 }
1564 1565
1565 1566
1567 TEST(NoDebugObjectInSnapshot) {
1568 v8::HandleScope scope;
1569 LocalContext env;
1570
1571 v8::internal::Isolate::Current()->debug()->Load();
1572 CompileRun("foo = {};");
1573 const v8::HeapSnapshot* snapshot =
1574 v8::HeapProfiler::TakeSnapshot(v8_str("snapshot"));
1575 const v8::HeapGraphNode* root = snapshot->GetRoot();
1576 int globals_count = 0;
1577 for (int i = 0; i < root->GetChildrenCount(); ++i) {
1578 const v8::HeapGraphEdge* edge = root->GetChild(i);
1579 if (edge->GetType() == v8::HeapGraphEdge::kShortcut) {
1580 ++globals_count;
1581 const v8::HeapGraphNode* global = edge->GetToNode();
1582 const v8::HeapGraphNode* foo =
1583 GetProperty(global, v8::HeapGraphEdge::kProperty, "foo");
1584 CHECK_NE(NULL, foo);
1585 }
1586 }
1587 CHECK_EQ(1, globals_count);
1588 }
1589
1590
1566 TEST(PersistentHandleCount) { 1591 TEST(PersistentHandleCount) {
1567 v8::HandleScope scope; 1592 v8::HandleScope scope;
1568 LocalContext env; 1593 LocalContext env;
1569 1594
1570 // V8 also uses global handles internally, so we can't test for an absolute 1595 // V8 also uses global handles internally, so we can't test for an absolute
1571 // number. 1596 // number.
1572 int global_handle_count = v8::HeapProfiler::GetPersistentHandleCount(); 1597 int global_handle_count = v8::HeapProfiler::GetPersistentHandleCount();
1573 1598
1574 // Create some persistent handles. 1599 // Create some persistent handles.
1575 v8::Persistent<v8::String> p_AAA = 1600 v8::Persistent<v8::String> p_AAA =
(...skipping 12 matching lines...) Expand all
1588 // Dipose the persistent handles in a different order. 1613 // Dipose the persistent handles in a different order.
1589 p_AAA.Dispose(); 1614 p_AAA.Dispose();
1590 CHECK_EQ(global_handle_count + 2, 1615 CHECK_EQ(global_handle_count + 2,
1591 v8::HeapProfiler::GetPersistentHandleCount()); 1616 v8::HeapProfiler::GetPersistentHandleCount());
1592 p_CCC.Dispose(); 1617 p_CCC.Dispose();
1593 CHECK_EQ(global_handle_count + 1, 1618 CHECK_EQ(global_handle_count + 1,
1594 v8::HeapProfiler::GetPersistentHandleCount()); 1619 v8::HeapProfiler::GetPersistentHandleCount());
1595 p_BBB.Dispose(); 1620 p_BBB.Dispose();
1596 CHECK_EQ(global_handle_count, v8::HeapProfiler::GetPersistentHandleCount()); 1621 CHECK_EQ(global_handle_count, v8::HeapProfiler::GetPersistentHandleCount());
1597 } 1622 }
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