| 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 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 774 CHECK_EQ(1, stats_update.intervals_count()); | 774 CHECK_EQ(1, stats_update.intervals_count()); |
| 775 CHECK_EQ(3, stats_update.numbers_written()); | 775 CHECK_EQ(3, stats_update.numbers_written()); |
| 776 CHECK_LT(0, stats_update.entries_size()); | 776 CHECK_LT(0, stats_update.entries_size()); |
| 777 CHECK_EQ(0, stats_update.first_interval_index()); | 777 CHECK_EQ(0, stats_update.first_interval_index()); |
| 778 } | 778 } |
| 779 | 779 |
| 780 // No data expected in update because nothing has happened. | 780 // No data expected in update because nothing has happened. |
| 781 CHECK_EQ(0, GetHeapStatsUpdate().numbers_written()); | 781 CHECK_EQ(0, GetHeapStatsUpdate().numbers_written()); |
| 782 { | 782 { |
| 783 v8::HandleScope inner_scope_1; | 783 v8::HandleScope inner_scope_1; |
| 784 v8::Local<v8::String> string1 = v8_str("string1"); | 784 v8_str("string1"); |
| 785 { | 785 { |
| 786 // Single chunk of data with one new entry expected in update. | 786 // Single chunk of data with one new entry expected in update. |
| 787 TestStatsStream stats_update = GetHeapStatsUpdate(); | 787 TestStatsStream stats_update = GetHeapStatsUpdate(); |
| 788 CHECK_EQ(1, stats_update.intervals_count()); | 788 CHECK_EQ(1, stats_update.intervals_count()); |
| 789 CHECK_EQ(3, stats_update.numbers_written()); | 789 CHECK_EQ(3, stats_update.numbers_written()); |
| 790 CHECK_LT(0, stats_update.entries_size()); | 790 CHECK_LT(0, stats_update.entries_size()); |
| 791 CHECK_EQ(1, stats_update.entries_count()); | 791 CHECK_EQ(1, stats_update.entries_count()); |
| 792 CHECK_EQ(2, stats_update.first_interval_index()); | 792 CHECK_EQ(2, stats_update.first_interval_index()); |
| 793 } | 793 } |
| 794 | 794 |
| 795 // No data expected in update because nothing happened. | 795 // No data expected in update because nothing happened. |
| 796 CHECK_EQ(0, GetHeapStatsUpdate().numbers_written()); | 796 CHECK_EQ(0, GetHeapStatsUpdate().numbers_written()); |
| 797 | 797 |
| 798 { | 798 { |
| 799 v8::HandleScope inner_scope_2; | 799 v8::HandleScope inner_scope_2; |
| 800 v8::Local<v8::String> string2 = v8_str("string2"); | 800 v8_str("string2"); |
| 801 | 801 |
| 802 uint32_t entries_size; | 802 uint32_t entries_size; |
| 803 { | 803 { |
| 804 v8::HandleScope inner_scope_3; | 804 v8::HandleScope inner_scope_3; |
| 805 v8::Handle<v8::String> string3 = v8::String::New("string3"); | 805 v8_str("string3"); |
| 806 v8::Handle<v8::String> string4 = v8::String::New("string4"); | 806 v8_str("string4"); |
| 807 | 807 |
| 808 { | 808 { |
| 809 // Single chunk of data with three new entries expected in update. | 809 // Single chunk of data with three new entries expected in update. |
| 810 TestStatsStream stats_update = GetHeapStatsUpdate(); | 810 TestStatsStream stats_update = GetHeapStatsUpdate(); |
| 811 CHECK_EQ(1, stats_update.intervals_count()); | 811 CHECK_EQ(1, stats_update.intervals_count()); |
| 812 CHECK_EQ(3, stats_update.numbers_written()); | 812 CHECK_EQ(3, stats_update.numbers_written()); |
| 813 CHECK_LT(0, entries_size = stats_update.entries_size()); | 813 CHECK_LT(0, entries_size = stats_update.entries_size()); |
| 814 CHECK_EQ(3, stats_update.entries_count()); | 814 CHECK_EQ(3, stats_update.entries_count()); |
| 815 CHECK_EQ(4, stats_update.first_interval_index()); | 815 CHECK_EQ(4, stats_update.first_interval_index()); |
| 816 } | 816 } |
| (...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1559 // Dipose the persistent handles in a different order. | 1559 // Dipose the persistent handles in a different order. |
| 1560 p_AAA.Dispose(); | 1560 p_AAA.Dispose(); |
| 1561 CHECK_EQ(global_handle_count + 2, | 1561 CHECK_EQ(global_handle_count + 2, |
| 1562 v8::HeapProfiler::GetPersistentHandleCount()); | 1562 v8::HeapProfiler::GetPersistentHandleCount()); |
| 1563 p_CCC.Dispose(); | 1563 p_CCC.Dispose(); |
| 1564 CHECK_EQ(global_handle_count + 1, | 1564 CHECK_EQ(global_handle_count + 1, |
| 1565 v8::HeapProfiler::GetPersistentHandleCount()); | 1565 v8::HeapProfiler::GetPersistentHandleCount()); |
| 1566 p_BBB.Dispose(); | 1566 p_BBB.Dispose(); |
| 1567 CHECK_EQ(global_handle_count, v8::HeapProfiler::GetPersistentHandleCount()); | 1567 CHECK_EQ(global_handle_count, v8::HeapProfiler::GetPersistentHandleCount()); |
| 1568 } | 1568 } |
| OLD | NEW |