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

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

Issue 9858016: I'd like to add HeapSnapshot::GetMaxSnapshotJSObjectId function. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: printf was removed, typo was fixed. Created 8 years, 9 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
« src/profile-generator.cc ('K') | « 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 "utils-inl.h" 10 #include "utils-inl.h"
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 "var a = new A();\n" 415 "var a = new A();\n"
416 "var b = new B(a);"); 416 "var b = new B(a);");
417 const v8::HeapSnapshot* snapshot1 = 417 const v8::HeapSnapshot* snapshot1 =
418 v8::HeapProfiler::TakeSnapshot(v8_str("s1")); 418 v8::HeapProfiler::TakeSnapshot(v8_str("s1"));
419 419
420 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); 420 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
421 421
422 const v8::HeapSnapshot* snapshot2 = 422 const v8::HeapSnapshot* snapshot2 =
423 v8::HeapProfiler::TakeSnapshot(v8_str("s2")); 423 v8::HeapProfiler::TakeSnapshot(v8_str("s2"));
424 424
425 // Second snapshot has one more string, it is it's name 's2'.
426 CHECK_EQ_SNAPSHOT_OBJECT_ID(
427 snapshot1->GetMaxSnapshotJSObjectId() + i::HeapObjectsMap::kObjectIdStep,
428 snapshot2->GetMaxSnapshotJSObjectId());
429
425 const v8::HeapGraphNode* global1 = GetGlobalObject(snapshot1); 430 const v8::HeapGraphNode* global1 = GetGlobalObject(snapshot1);
426 const v8::HeapGraphNode* global2 = GetGlobalObject(snapshot2); 431 const v8::HeapGraphNode* global2 = GetGlobalObject(snapshot2);
427 CHECK_NE_SNAPSHOT_OBJECT_ID(0, global1->GetId()); 432 CHECK_NE_SNAPSHOT_OBJECT_ID(0, global1->GetId());
428 CHECK_EQ_SNAPSHOT_OBJECT_ID(global1->GetId(), global2->GetId()); 433 CHECK_EQ_SNAPSHOT_OBJECT_ID(global1->GetId(), global2->GetId());
429 const v8::HeapGraphNode* A1 = 434 const v8::HeapGraphNode* A1 =
430 GetProperty(global1, v8::HeapGraphEdge::kProperty, "A"); 435 GetProperty(global1, v8::HeapGraphEdge::kProperty, "A");
431 CHECK_NE(NULL, A1); 436 CHECK_NE(NULL, A1);
432 const v8::HeapGraphNode* A2 = 437 const v8::HeapGraphNode* A2 =
433 GetProperty(global2, v8::HeapGraphEdge::kProperty, "A"); 438 GetProperty(global2, v8::HeapGraphEdge::kProperty, "A");
434 CHECK_NE(NULL, A2); 439 CHECK_NE(NULL, A2);
(...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after
1359 // Dipose the persistent handles in a different order. 1364 // Dipose the persistent handles in a different order.
1360 p_AAA.Dispose(); 1365 p_AAA.Dispose();
1361 CHECK_EQ(global_handle_count + 2, 1366 CHECK_EQ(global_handle_count + 2,
1362 v8::HeapProfiler::GetPersistentHandleCount()); 1367 v8::HeapProfiler::GetPersistentHandleCount());
1363 p_CCC.Dispose(); 1368 p_CCC.Dispose();
1364 CHECK_EQ(global_handle_count + 1, 1369 CHECK_EQ(global_handle_count + 1,
1365 v8::HeapProfiler::GetPersistentHandleCount()); 1370 v8::HeapProfiler::GetPersistentHandleCount());
1366 p_BBB.Dispose(); 1371 p_BBB.Dispose();
1367 CHECK_EQ(global_handle_count, v8::HeapProfiler::GetPersistentHandleCount()); 1372 CHECK_EQ(global_handle_count, v8::HeapProfiler::GetPersistentHandleCount());
1368 } 1373 }
OLDNEW
« src/profile-generator.cc ('K') | « src/profile-generator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698