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

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

Issue 299813002: Revert "Fix Heap::IsHeapIterable." (again) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 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
« no previous file with comments | « test/cctest/test-api.cc ('k') | test/cctest/test-object-observe.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 872 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 CHECK_EQ(length, ascii_str->length()); 883 CHECK_EQ(length, ascii_str->length());
884 DeleteArray(non_ascii); 884 DeleteArray(non_ascii);
885 DeleteArray(ascii); 885 DeleteArray(ascii);
886 } 886 }
887 } 887 }
888 888
889 889
890 static int ObjectsFoundInHeap(Heap* heap, Handle<Object> objs[], int size) { 890 static int ObjectsFoundInHeap(Heap* heap, Handle<Object> objs[], int size) {
891 // Count the number of objects found in the heap. 891 // Count the number of objects found in the heap.
892 int found_count = 0; 892 int found_count = 0;
893 heap->EnsureHeapIsIterable();
893 HeapIterator iterator(heap); 894 HeapIterator iterator(heap);
894 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { 895 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) {
895 for (int i = 0; i < size; i++) { 896 for (int i = 0; i < size; i++) {
896 if (*objs[i] == obj) { 897 if (*objs[i] == obj) {
897 found_count++; 898 found_count++;
898 } 899 }
899 } 900 }
900 } 901 }
901 return found_count; 902 return found_count;
902 } 903 }
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
1621 // Waiting for sweeper threads should not change heap size. 1622 // Waiting for sweeper threads should not change heap size.
1622 if (collector->IsConcurrentSweepingInProgress()) { 1623 if (collector->IsConcurrentSweepingInProgress()) {
1623 collector->WaitUntilSweepingCompleted(); 1624 collector->WaitUntilSweepingCompleted();
1624 } 1625 }
1625 CHECK_EQ(initial_size, static_cast<int>(CcTest::heap()->SizeOfObjects())); 1626 CHECK_EQ(initial_size, static_cast<int>(CcTest::heap()->SizeOfObjects()));
1626 } 1627 }
1627 1628
1628 1629
1629 TEST(TestSizeOfObjectsVsHeapIteratorPrecision) { 1630 TEST(TestSizeOfObjectsVsHeapIteratorPrecision) {
1630 CcTest::InitializeVM(); 1631 CcTest::InitializeVM();
1632 CcTest::heap()->EnsureHeapIsIterable();
1633 intptr_t size_of_objects_1 = CcTest::heap()->SizeOfObjects();
1631 HeapIterator iterator(CcTest::heap()); 1634 HeapIterator iterator(CcTest::heap());
1632 intptr_t size_of_objects_1 = CcTest::heap()->SizeOfObjects();
1633 intptr_t size_of_objects_2 = 0; 1635 intptr_t size_of_objects_2 = 0;
1634 for (HeapObject* obj = iterator.next(); 1636 for (HeapObject* obj = iterator.next();
1635 obj != NULL; 1637 obj != NULL;
1636 obj = iterator.next()) { 1638 obj = iterator.next()) {
1637 if (!obj->IsFreeSpace()) { 1639 if (!obj->IsFreeSpace()) {
1638 size_of_objects_2 += obj->Size(); 1640 size_of_objects_2 += obj->Size();
1639 } 1641 }
1640 } 1642 }
1641 // Delta must be within 5% of the larger result. 1643 // Delta must be within 5% of the larger result.
1642 // TODO(gc): Tighten this up by distinguishing between byte 1644 // TODO(gc): Tighten this up by distinguishing between byte
(...skipping 2599 matching lines...) Expand 10 before | Expand all | Expand 10 after
4242 "array;"); 4244 "array;");
4243 4245
4244 Handle<JSObject> o = 4246 Handle<JSObject> o =
4245 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(result)); 4247 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(result));
4246 CHECK(heap->InOldPointerSpace(o->elements())); 4248 CHECK(heap->InOldPointerSpace(o->elements()));
4247 CHECK(heap->InOldPointerSpace(*o)); 4249 CHECK(heap->InOldPointerSpace(*o));
4248 Page* page = Page::FromAddress(o->elements()->address()); 4250 Page* page = Page::FromAddress(o->elements()->address());
4249 CHECK(page->WasSwept() || 4251 CHECK(page->WasSwept() ||
4250 Marking::IsBlack(Marking::MarkBitFrom(o->elements()))); 4252 Marking::IsBlack(Marking::MarkBitFrom(o->elements())));
4251 } 4253 }
OLDNEW
« no previous file with comments | « test/cctest/test-api.cc ('k') | test/cctest/test-object-observe.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698