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

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

Issue 6776009: Heap profiler: emit more descriptive names for system objects and properties. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Comments addressed, compilation fixed Created 9 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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 the V8 project authors. All rights reserved.
2 // 2 //
3 // Tests for heap profiler 3 // Tests for heap profiler
4 4
5 #ifdef ENABLE_LOGGING_AND_PROFILING 5 #ifdef ENABLE_LOGGING_AND_PROFILING
6 6
7 #include "v8.h" 7 #include "v8.h"
8 #include "heap-profiler.h" 8 #include "heap-profiler.h"
9 #include "snapshot.h" 9 #include "snapshot.h"
10 #include "string-stream.h" 10 #include "string-stream.h"
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 CHECK_EQ(v8::HeapGraphNode::kClosure, lazy->GetType()); 567 CHECK_EQ(v8::HeapGraphNode::kClosure, lazy->GetType());
568 const v8::HeapGraphNode* anonymous = 568 const v8::HeapGraphNode* anonymous =
569 GetProperty(global, v8::HeapGraphEdge::kShortcut, "anonymous"); 569 GetProperty(global, v8::HeapGraphEdge::kShortcut, "anonymous");
570 CHECK_NE(NULL, anonymous); 570 CHECK_NE(NULL, anonymous);
571 CHECK_EQ(v8::HeapGraphNode::kClosure, anonymous->GetType()); 571 CHECK_EQ(v8::HeapGraphNode::kClosure, anonymous->GetType());
572 v8::String::AsciiValue anonymous_name(anonymous->GetName()); 572 v8::String::AsciiValue anonymous_name(anonymous->GetName());
573 CHECK_EQ("", *anonymous_name); 573 CHECK_EQ("", *anonymous_name);
574 574
575 // Find references to code. 575 // Find references to code.
576 const v8::HeapGraphNode* compiled_code = 576 const v8::HeapGraphNode* compiled_code =
577 GetProperty(compiled, v8::HeapGraphEdge::kInternal, "code"); 577 GetProperty(compiled, v8::HeapGraphEdge::kInternal, "shared");
578 CHECK_NE(NULL, compiled_code); 578 CHECK_NE(NULL, compiled_code);
579 const v8::HeapGraphNode* lazy_code = 579 const v8::HeapGraphNode* lazy_code =
580 GetProperty(lazy, v8::HeapGraphEdge::kInternal, "code"); 580 GetProperty(lazy, v8::HeapGraphEdge::kInternal, "shared");
581 CHECK_NE(NULL, lazy_code); 581 CHECK_NE(NULL, lazy_code);
582 582
583 // Verify that non-compiled code doesn't contain references to "x" 583 // Verify that non-compiled code doesn't contain references to "x"
584 // literal, while compiled code does. The scope info is stored in FixedArray 584 // literal, while compiled code does. The scope info is stored in FixedArray
585 // objects attached to the SharedFunctionInfo. 585 // objects attached to the SharedFunctionInfo.
586 bool compiled_references_x = false, lazy_references_x = false; 586 bool compiled_references_x = false, lazy_references_x = false;
587 for (int i = 0, count = compiled_code->GetChildrenCount(); i < count; ++i) { 587 for (int i = 0, count = compiled_code->GetChildrenCount(); i < count; ++i) {
588 const v8::HeapGraphEdge* prop = compiled_code->GetChild(i); 588 const v8::HeapGraphEdge* prop = compiled_code->GetChild(i);
589 const v8::HeapGraphNode* node = prop->GetToNode(); 589 const v8::HeapGraphNode* node = prop->GetToNode();
590 if (node->GetType() == v8::HeapGraphNode::kArray) { 590 if (node->GetType() == v8::HeapGraphNode::kArray) {
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
1250 aaa, v8::HeapGraphNode::kString, "AAA"); 1250 aaa, v8::HeapGraphNode::kString, "AAA");
1251 CHECK_NE(NULL, n_AAA); 1251 CHECK_NE(NULL, n_AAA);
1252 const v8::HeapGraphNode* n_BBB = GetNode( 1252 const v8::HeapGraphNode* n_BBB = GetNode(
1253 aaa, v8::HeapGraphNode::kString, "BBB"); 1253 aaa, v8::HeapGraphNode::kString, "BBB");
1254 CHECK_NE(NULL, n_BBB); 1254 CHECK_NE(NULL, n_BBB);
1255 CHECK_EQ(1, ccc->GetChildrenCount()); 1255 CHECK_EQ(1, ccc->GetChildrenCount());
1256 const v8::HeapGraphNode* n_CCC = GetNode( 1256 const v8::HeapGraphNode* n_CCC = GetNode(
1257 ccc, v8::HeapGraphNode::kString, "CCC"); 1257 ccc, v8::HeapGraphNode::kString, "CCC");
1258 CHECK_NE(NULL, n_CCC); 1258 CHECK_NE(NULL, n_CCC);
1259 1259
1260 CHECK_EQ(aaa, GetProperty(n_AAA, v8::HeapGraphEdge::kInternal, "Native")); 1260 CHECK_EQ(aaa, GetProperty(n_AAA, v8::HeapGraphEdge::kInternal, "native"));
1261 CHECK_EQ(aaa, GetProperty(n_BBB, v8::HeapGraphEdge::kInternal, "Native")); 1261 CHECK_EQ(aaa, GetProperty(n_BBB, v8::HeapGraphEdge::kInternal, "native"));
1262 CHECK_EQ(ccc, GetProperty(n_CCC, v8::HeapGraphEdge::kInternal, "Native")); 1262 CHECK_EQ(ccc, GetProperty(n_CCC, v8::HeapGraphEdge::kInternal, "native"));
1263 } 1263 }
1264 1264
1265 1265
1266 TEST(DeleteAllHeapSnapshots) { 1266 TEST(DeleteAllHeapSnapshots) {
1267 v8::HandleScope scope; 1267 v8::HandleScope scope;
1268 LocalContext env; 1268 LocalContext env;
1269 1269
1270 CHECK_EQ(0, v8::HeapProfiler::GetSnapshotsCount()); 1270 CHECK_EQ(0, v8::HeapProfiler::GetSnapshotsCount());
1271 v8::HeapProfiler::DeleteAllSnapshots(); 1271 v8::HeapProfiler::DeleteAllSnapshots();
1272 CHECK_EQ(0, v8::HeapProfiler::GetSnapshotsCount()); 1272 CHECK_EQ(0, v8::HeapProfiler::GetSnapshotsCount());
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1314 const_cast<v8::HeapSnapshot*>(s2)->Delete(); 1314 const_cast<v8::HeapSnapshot*>(s2)->Delete();
1315 CHECK_EQ(1, v8::HeapProfiler::GetSnapshotsCount()); 1315 CHECK_EQ(1, v8::HeapProfiler::GetSnapshotsCount());
1316 CHECK_EQ(NULL, v8::HeapProfiler::FindSnapshot(uid2)); 1316 CHECK_EQ(NULL, v8::HeapProfiler::FindSnapshot(uid2));
1317 CHECK_EQ(s3, v8::HeapProfiler::FindSnapshot(uid3)); 1317 CHECK_EQ(s3, v8::HeapProfiler::FindSnapshot(uid3));
1318 const_cast<v8::HeapSnapshot*>(s3)->Delete(); 1318 const_cast<v8::HeapSnapshot*>(s3)->Delete();
1319 CHECK_EQ(0, v8::HeapProfiler::GetSnapshotsCount()); 1319 CHECK_EQ(0, v8::HeapProfiler::GetSnapshotsCount());
1320 CHECK_EQ(NULL, v8::HeapProfiler::FindSnapshot(uid3)); 1320 CHECK_EQ(NULL, v8::HeapProfiler::FindSnapshot(uid3));
1321 } 1321 }
1322 1322
1323 #endif // ENABLE_LOGGING_AND_PROFILING 1323 #endif // ENABLE_LOGGING_AND_PROFILING
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