| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
| 2 | 2 |
| 3 #include <stdlib.h> | 3 #include <stdlib.h> |
| 4 | 4 |
| 5 #include "v8.h" | 5 #include "v8.h" |
| 6 | 6 |
| 7 #include "execution.h" | 7 #include "execution.h" |
| 8 #include "factory.h" | 8 #include "factory.h" |
| 9 #include "macro-assembler.h" | 9 #include "macro-assembler.h" |
| 10 #include "global-handles.h" | 10 #include "global-handles.h" |
| (...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 811 delete[] str; | 811 delete[] str; |
| 812 | 812 |
| 813 // Add a Map object to look for. | 813 // Add a Map object to look for. |
| 814 objs[next_objs_index++] = Handle<Map>(HeapObject::cast(*objs[0])->map()); | 814 objs[next_objs_index++] = Handle<Map>(HeapObject::cast(*objs[0])->map()); |
| 815 | 815 |
| 816 CHECK_EQ(objs_count, next_objs_index); | 816 CHECK_EQ(objs_count, next_objs_index); |
| 817 CHECK_EQ(objs_count, ObjectsFoundInHeap(objs, objs_count)); | 817 CHECK_EQ(objs_count, ObjectsFoundInHeap(objs, objs_count)); |
| 818 } | 818 } |
| 819 | 819 |
| 820 | 820 |
| 821 #if 0 |
| 821 TEST(LargeObjectSpaceContains) { | 822 TEST(LargeObjectSpaceContains) { |
| 822 InitializeVM(); | 823 InitializeVM(); |
| 823 | 824 |
| 824 Heap::CollectGarbage(NEW_SPACE); | 825 Heap::CollectGarbage(NEW_SPACE); |
| 825 | 826 |
| 826 Address current_top = Heap::new_space()->top(); | 827 Address current_top = Heap::new_space()->top(); |
| 827 Page* page = Page::FromAddress(current_top); | 828 Page* page = Page::FromAddress(current_top); |
| 828 Address current_page = page->address(); | 829 Address current_page = page->address(); |
| 829 Address next_page = current_page + Page::kPageSize; | 830 Address next_page = current_page + Page::kPageSize; |
| 830 int bytes_to_page = static_cast<int>(next_page - current_top); | 831 int bytes_to_page = static_cast<int>(next_page - current_top); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 852 CHECK_EQ(flags_ptr, | 853 CHECK_EQ(flags_ptr, |
| 853 HeapObject::RawField(array, FixedArray::OffsetOfElementAt(index))); | 854 HeapObject::RawField(array, FixedArray::OffsetOfElementAt(index))); |
| 854 array->set(index, Smi::FromInt(0)); | 855 array->set(index, Smi::FromInt(0)); |
| 855 // This chould have turned next page into LargeObjectPage: | 856 // This chould have turned next page into LargeObjectPage: |
| 856 // CHECK(Page::FromAddress(next_page)->IsLargeObjectPage()); | 857 // CHECK(Page::FromAddress(next_page)->IsLargeObjectPage()); |
| 857 | 858 |
| 858 HeapObject* addr = HeapObject::FromAddress(next_page + 2 * kPointerSize); | 859 HeapObject* addr = HeapObject::FromAddress(next_page + 2 * kPointerSize); |
| 859 CHECK(Heap::new_space()->Contains(addr)); | 860 CHECK(Heap::new_space()->Contains(addr)); |
| 860 CHECK(!Heap::lo_space()->Contains(addr)); | 861 CHECK(!Heap::lo_space()->Contains(addr)); |
| 861 } | 862 } |
| 863 #endif |
| 862 | 864 |
| 863 | 865 |
| 864 TEST(EmptyHandleEscapeFrom) { | 866 TEST(EmptyHandleEscapeFrom) { |
| 865 InitializeVM(); | 867 InitializeVM(); |
| 866 | 868 |
| 867 v8::HandleScope scope; | 869 v8::HandleScope scope; |
| 868 Handle<JSObject> runaway; | 870 Handle<JSObject> runaway; |
| 869 | 871 |
| 870 { | 872 { |
| 871 v8::HandleScope nested; | 873 v8::HandleScope nested; |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1295 CHECK(helper.b_found()); | 1297 CHECK(helper.b_found()); |
| 1296 } | 1298 } |
| 1297 // ...but is now unreachable. | 1299 // ...but is now unreachable. |
| 1298 { | 1300 { |
| 1299 HeapIteratorTestHelper helper(a_saved, *b); | 1301 HeapIteratorTestHelper helper(a_saved, *b); |
| 1300 helper.IterateHeap(HeapIterator::kFilterUnreachable); | 1302 helper.IterateHeap(HeapIterator::kFilterUnreachable); |
| 1301 CHECK(!helper.a_found()); | 1303 CHECK(!helper.a_found()); |
| 1302 CHECK(helper.b_found()); | 1304 CHECK(helper.b_found()); |
| 1303 } | 1305 } |
| 1304 } | 1306 } |
| OLD | NEW |