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

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

Issue 7204040: Heap profiler: add an ability to iterate over snapshot's nodes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 6 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/api.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 #ifdef ENABLE_LOGGING_AND_PROFILING 5 #ifdef ENABLE_LOGGING_AND_PROFILING
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 1354 matching lines...) Expand 10 before | Expand all | Expand 10 after
1365 "document = { URL: new URLWithException() };"); 1365 "document = { URL: new URLWithException() };");
1366 const v8::HeapSnapshot* snapshot = 1366 const v8::HeapSnapshot* snapshot =
1367 v8::HeapProfiler::TakeSnapshot(v8::String::New("document")); 1367 v8::HeapProfiler::TakeSnapshot(v8::String::New("document"));
1368 const v8::HeapGraphNode* global = GetGlobalObject(snapshot); 1368 const v8::HeapGraphNode* global = GetGlobalObject(snapshot);
1369 CHECK_NE(NULL, global); 1369 CHECK_NE(NULL, global);
1370 CHECK_EQ("Object", 1370 CHECK_EQ("Object",
1371 const_cast<i::HeapEntry*>( 1371 const_cast<i::HeapEntry*>(
1372 reinterpret_cast<const i::HeapEntry*>(global))->name()); 1372 reinterpret_cast<const i::HeapEntry*>(global))->name());
1373 } 1373 }
1374 1374
1375
1376 TEST(NodesIteration) {
1377 v8::HandleScope scope;
1378 LocalContext env;
1379 const v8::HeapSnapshot* snapshot =
1380 v8::HeapProfiler::TakeSnapshot(v8::String::New("iteration"));
1381 const v8::HeapGraphNode* global = GetGlobalObject(snapshot);
1382 CHECK_NE(NULL, global);
1383 // Verify that we can find this object by iteration.
1384 const int nodes_count = snapshot->GetNodesCount();
1385 int count = 0;
1386 for (int i = 0; i < nodes_count; ++i) {
1387 if (snapshot->GetNode(i) == global)
1388 ++count;
1389 }
1390 CHECK_EQ(1, count);
1391 }
1392
1375 #endif // ENABLE_LOGGING_AND_PROFILING 1393 #endif // ENABLE_LOGGING_AND_PROFILING
OLDNEW
« no previous file with comments | « src/api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698