| 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 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 823 Address next_page = current_page + Page::kPageSize; | 823 Address next_page = current_page + Page::kPageSize; |
| 824 int bytes_to_page = static_cast<int>(next_page - current_top); | 824 int bytes_to_page = static_cast<int>(next_page - current_top); |
| 825 if (bytes_to_page <= FixedArray::kHeaderSize) { | 825 if (bytes_to_page <= FixedArray::kHeaderSize) { |
| 826 // Alas, need to cross another page to be able to | 826 // Alas, need to cross another page to be able to |
| 827 // put desired value. | 827 // put desired value. |
| 828 next_page += Page::kPageSize; | 828 next_page += Page::kPageSize; |
| 829 bytes_to_page = static_cast<int>(next_page - current_top); | 829 bytes_to_page = static_cast<int>(next_page - current_top); |
| 830 } | 830 } |
| 831 CHECK(bytes_to_page > FixedArray::kHeaderSize); | 831 CHECK(bytes_to_page > FixedArray::kHeaderSize); |
| 832 | 832 |
| 833 int* is_normal_page_ptr = &Page::FromAddress(next_page)->is_normal_page; | 833 intptr_t* flags_ptr = &Page::FromAddress(next_page)->flags; |
| 834 Address is_normal_page_addr = reinterpret_cast<Address>(is_normal_page_ptr); | 834 Address flags_addr = reinterpret_cast<Address>(flags_ptr); |
| 835 | 835 |
| 836 int bytes_to_allocate = | 836 int bytes_to_allocate = |
| 837 static_cast<int>(is_normal_page_addr - current_top) + kPointerSize; | 837 static_cast<int>(flags_addr - current_top) + kPointerSize; |
| 838 | 838 |
| 839 int n_elements = (bytes_to_allocate - FixedArray::kHeaderSize) / | 839 int n_elements = (bytes_to_allocate - FixedArray::kHeaderSize) / |
| 840 kPointerSize; | 840 kPointerSize; |
| 841 CHECK_EQ(bytes_to_allocate, FixedArray::SizeFor(n_elements)); | 841 CHECK_EQ(bytes_to_allocate, FixedArray::SizeFor(n_elements)); |
| 842 FixedArray* array = FixedArray::cast( | 842 FixedArray* array = FixedArray::cast( |
| 843 Heap::AllocateFixedArray(n_elements)); | 843 Heap::AllocateFixedArray(n_elements)); |
| 844 | 844 |
| 845 int index = n_elements - 1; | 845 int index = n_elements - 1; |
| 846 CHECK_EQ(is_normal_page_ptr, | 846 CHECK_EQ(flags_ptr, |
| 847 HeapObject::RawField(array, FixedArray::OffsetOfElementAt(index))); | 847 HeapObject::RawField(array, FixedArray::OffsetOfElementAt(index))); |
| 848 array->set(index, Smi::FromInt(0)); | 848 array->set(index, Smi::FromInt(0)); |
| 849 // This chould have turned next page into LargeObjectPage: | 849 // This chould have turned next page into LargeObjectPage: |
| 850 // CHECK(Page::FromAddress(next_page)->IsLargeObjectPage()); | 850 // CHECK(Page::FromAddress(next_page)->IsLargeObjectPage()); |
| 851 | 851 |
| 852 HeapObject* addr = HeapObject::FromAddress(next_page + 2 * kPointerSize); | 852 HeapObject* addr = HeapObject::FromAddress(next_page + 2 * kPointerSize); |
| 853 CHECK(Heap::new_space()->Contains(addr)); | 853 CHECK(Heap::new_space()->Contains(addr)); |
| 854 CHECK(!Heap::lo_space()->Contains(addr)); | 854 CHECK(!Heap::lo_space()->Contains(addr)); |
| 855 } | 855 } |
| 856 | 856 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 958 CHECK(page->IsRSetSet(clone_addr, object_size - kPointerSize)); | 958 CHECK(page->IsRSetSet(clone_addr, object_size - kPointerSize)); |
| 959 // Probe several addresses after the object. | 959 // Probe several addresses after the object. |
| 960 for (int i = 0; i < 7; i++) { | 960 for (int i = 0; i < 7; i++) { |
| 961 int offset = object_size + i * kPointerSize; | 961 int offset = object_size + i * kPointerSize; |
| 962 if (clone_addr + offset >= page->ObjectAreaEnd()) { | 962 if (clone_addr + offset >= page->ObjectAreaEnd()) { |
| 963 break; | 963 break; |
| 964 } | 964 } |
| 965 CHECK(!page->IsRSetSet(clone_addr, offset)); | 965 CHECK(!page->IsRSetSet(clone_addr, offset)); |
| 966 } | 966 } |
| 967 } | 967 } |
| OLD | NEW |