OLD | NEW |
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 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 int total_; | 670 int total_; |
671 int abort_count_; | 671 int abort_count_; |
672 }; | 672 }; |
673 } | 673 } |
674 | 674 |
675 TEST(TakeHeapSnapshotAborting) { | 675 TEST(TakeHeapSnapshotAborting) { |
676 v8::HandleScope scope; | 676 v8::HandleScope scope; |
677 LocalContext env; | 677 LocalContext env; |
678 | 678 |
679 const int snapshots_count = v8::HeapProfiler::GetSnapshotsCount(); | 679 const int snapshots_count = v8::HeapProfiler::GetSnapshotsCount(); |
680 TestActivityControl aborting_control(3); | 680 TestActivityControl aborting_control(1); |
681 const v8::HeapSnapshot* no_snapshot = | 681 const v8::HeapSnapshot* no_snapshot = |
682 v8::HeapProfiler::TakeSnapshot(v8_str("abort"), | 682 v8::HeapProfiler::TakeSnapshot(v8_str("abort"), |
683 v8::HeapSnapshot::kFull, | 683 v8::HeapSnapshot::kFull, |
684 &aborting_control); | 684 &aborting_control); |
685 CHECK_EQ(NULL, no_snapshot); | 685 CHECK_EQ(NULL, no_snapshot); |
686 CHECK_EQ(snapshots_count, v8::HeapProfiler::GetSnapshotsCount()); | 686 CHECK_EQ(snapshots_count, v8::HeapProfiler::GetSnapshotsCount()); |
687 CHECK_GT(aborting_control.total(), aborting_control.done()); | 687 CHECK_GT(aborting_control.total(), aborting_control.done()); |
688 | 688 |
689 TestActivityControl control(-1); // Don't abort. | 689 TestActivityControl control(-1); // Don't abort. |
690 const v8::HeapSnapshot* snapshot = | 690 const v8::HeapSnapshot* snapshot = |
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1261 v8::HeapProfiler::TakeSnapshot(v8_str("fun")); | 1261 v8::HeapProfiler::TakeSnapshot(v8_str("fun")); |
1262 const v8::HeapGraphNode* global = GetGlobalObject(snapshot); | 1262 const v8::HeapGraphNode* global = GetGlobalObject(snapshot); |
1263 CHECK_NE(NULL, global); | 1263 CHECK_NE(NULL, global); |
1264 const v8::HeapGraphNode* fun = | 1264 const v8::HeapGraphNode* fun = |
1265 GetProperty(global, v8::HeapGraphEdge::kShortcut, "fun"); | 1265 GetProperty(global, v8::HeapGraphEdge::kShortcut, "fun"); |
1266 CHECK(HasWeakEdge(fun)); | 1266 CHECK(HasWeakEdge(fun)); |
1267 const v8::HeapGraphNode* shared = | 1267 const v8::HeapGraphNode* shared = |
1268 GetProperty(fun, v8::HeapGraphEdge::kInternal, "shared"); | 1268 GetProperty(fun, v8::HeapGraphEdge::kInternal, "shared"); |
1269 CHECK(HasWeakEdge(shared)); | 1269 CHECK(HasWeakEdge(shared)); |
1270 } | 1270 } |
OLD | NEW |