OLD | NEW |
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 815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
826 found_A_del = true; | 826 found_A_del = true; |
827 s2_A_id = node->GetId(); | 827 s2_A_id = node->GetId(); |
828 } | 828 } |
829 } | 829 } |
830 } | 830 } |
831 CHECK(found_A_del); | 831 CHECK(found_A_del); |
832 CHECK_NE_UINT64_T(0, s1_A_id); | 832 CHECK_NE_UINT64_T(0, s1_A_id); |
833 CHECK(s1_A_id != s2_A_id); | 833 CHECK(s1_A_id != s2_A_id); |
834 } | 834 } |
835 | 835 |
| 836 |
| 837 namespace v8 { |
| 838 namespace internal { |
| 839 |
| 840 class HeapSnapshotTester { |
| 841 public: |
| 842 static int CalculateNetworkSize(JSObject* obj) { |
| 843 return HeapSnapshot::CalculateNetworkSize(obj); |
| 844 } |
| 845 }; |
| 846 |
| 847 } } // namespace v8::internal |
| 848 |
| 849 // http://code.google.com/p/v8/issues/detail?id=822 |
| 850 // Trying to call CalculateNetworkSize on an object with elements set |
| 851 // to non-FixedArray may cause an assertion error in debug builds. |
| 852 TEST(Issue822) { |
| 853 v8::HandleScope scope; |
| 854 LocalContext context; |
| 855 const int kElementCount = 260; |
| 856 uint8_t* pixel_data = reinterpret_cast<uint8_t*>(malloc(kElementCount)); |
| 857 i::Handle<i::PixelArray> pixels = i::Factory::NewPixelArray(kElementCount, |
| 858 pixel_data); |
| 859 v8::Handle<v8::Object> obj = v8::Object::New(); |
| 860 // Set the elements to be the pixels. |
| 861 obj->SetIndexedPropertiesToPixelData(pixel_data, kElementCount); |
| 862 i::Handle<i::JSObject> jsobj = v8::Utils::OpenHandle(*obj); |
| 863 // This call must not cause an assertion error in debug builds. |
| 864 i::HeapSnapshotTester::CalculateNetworkSize(*jsobj); |
| 865 } |
| 866 |
836 #endif // ENABLE_LOGGING_AND_PROFILING | 867 #endif // ENABLE_LOGGING_AND_PROFILING |
OLD | NEW |