OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
884 CHECK_EQ(length, ascii_str->length()); | 884 CHECK_EQ(length, ascii_str->length()); |
885 DeleteArray(non_ascii); | 885 DeleteArray(non_ascii); |
886 DeleteArray(ascii); | 886 DeleteArray(ascii); |
887 } | 887 } |
888 } | 888 } |
889 | 889 |
890 | 890 |
891 static int ObjectsFoundInHeap(Heap* heap, Handle<Object> objs[], int size) { | 891 static int ObjectsFoundInHeap(Heap* heap, Handle<Object> objs[], int size) { |
892 // Count the number of objects found in the heap. | 892 // Count the number of objects found in the heap. |
893 int found_count = 0; | 893 int found_count = 0; |
894 heap->EnsureHeapIsIterable(); | 894 heap->MakeHeapIterable(); |
895 HeapIterator iterator(heap); | 895 HeapIterator iterator(heap); |
896 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { | 896 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { |
897 for (int i = 0; i < size; i++) { | 897 for (int i = 0; i < size; i++) { |
898 if (*objs[i] == obj) { | 898 if (*objs[i] == obj) { |
899 found_count++; | 899 found_count++; |
900 } | 900 } |
901 } | 901 } |
902 } | 902 } |
903 return found_count; | 903 return found_count; |
904 } | 904 } |
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1623 // Waiting for sweeper threads should not change heap size. | 1623 // Waiting for sweeper threads should not change heap size. |
1624 if (collector->IsConcurrentSweepingInProgress()) { | 1624 if (collector->IsConcurrentSweepingInProgress()) { |
1625 collector->WaitUntilSweepingCompleted(); | 1625 collector->WaitUntilSweepingCompleted(); |
1626 } | 1626 } |
1627 CHECK_EQ(initial_size, static_cast<int>(CcTest::heap()->SizeOfObjects())); | 1627 CHECK_EQ(initial_size, static_cast<int>(CcTest::heap()->SizeOfObjects())); |
1628 } | 1628 } |
1629 | 1629 |
1630 | 1630 |
1631 TEST(TestSizeOfObjectsVsHeapIteratorPrecision) { | 1631 TEST(TestSizeOfObjectsVsHeapIteratorPrecision) { |
1632 CcTest::InitializeVM(); | 1632 CcTest::InitializeVM(); |
1633 CcTest::heap()->EnsureHeapIsIterable(); | 1633 CcTest::heap()->MakeHeapIterable(); |
1634 intptr_t size_of_objects_1 = CcTest::heap()->SizeOfObjects(); | 1634 intptr_t size_of_objects_1 = CcTest::heap()->SizeOfObjects(); |
1635 HeapIterator iterator(CcTest::heap()); | 1635 HeapIterator iterator(CcTest::heap()); |
1636 intptr_t size_of_objects_2 = 0; | 1636 intptr_t size_of_objects_2 = 0; |
1637 for (HeapObject* obj = iterator.next(); | 1637 for (HeapObject* obj = iterator.next(); |
1638 obj != NULL; | 1638 obj != NULL; |
1639 obj = iterator.next()) { | 1639 obj = iterator.next()) { |
1640 if (!obj->IsFreeSpace()) { | 1640 if (!obj->IsFreeSpace()) { |
1641 size_of_objects_2 += obj->Size(); | 1641 size_of_objects_2 += obj->Size(); |
1642 } | 1642 } |
1643 } | 1643 } |
(...skipping 2561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4205 "array;"); | 4205 "array;"); |
4206 | 4206 |
4207 Handle<JSObject> o = | 4207 Handle<JSObject> o = |
4208 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(result)); | 4208 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(result)); |
4209 CHECK(heap->InOldPointerSpace(o->elements())); | 4209 CHECK(heap->InOldPointerSpace(o->elements())); |
4210 CHECK(heap->InOldPointerSpace(*o)); | 4210 CHECK(heap->InOldPointerSpace(*o)); |
4211 Page* page = Page::FromAddress(o->elements()->address()); | 4211 Page* page = Page::FromAddress(o->elements()->address()); |
4212 CHECK(page->WasSwept() || | 4212 CHECK(page->WasSwept() || |
4213 Marking::IsBlack(Marking::MarkBitFrom(o->elements()))); | 4213 Marking::IsBlack(Marking::MarkBitFrom(o->elements()))); |
4214 } | 4214 } |
OLD | NEW |