OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/heap/spaces.h" | 5 #include "src/heap/spaces.h" |
6 | 6 |
7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/base/platform/platform.h" | 8 #include "src/base/platform/platform.h" |
9 #include "src/base/platform/semaphore.h" | 9 #include "src/base/platform/semaphore.h" |
10 #include "src/full-codegen/full-codegen.h" | 10 #include "src/full-codegen/full-codegen.h" |
(...skipping 1873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1884 new_page->SetFlags(old_page->GetFlags(), Page::kCopyAllFlags); | 1884 new_page->SetFlags(old_page->GetFlags(), Page::kCopyAllFlags); |
1885 new_page->set_next_page(old_page->next_page()); | 1885 new_page->set_next_page(old_page->next_page()); |
1886 new_page->set_prev_page(old_page->prev_page()); | 1886 new_page->set_prev_page(old_page->prev_page()); |
1887 old_page->next_page()->set_prev_page(new_page); | 1887 old_page->next_page()->set_prev_page(new_page); |
1888 old_page->prev_page()->set_next_page(new_page); | 1888 old_page->prev_page()->set_next_page(new_page); |
1889 heap()->CreateFillerObjectAt(new_page->area_start(), new_page->area_size(), | 1889 heap()->CreateFillerObjectAt(new_page->area_start(), new_page->area_size(), |
1890 ClearRecordedSlots::kNo); | 1890 ClearRecordedSlots::kNo); |
1891 return true; | 1891 return true; |
1892 } | 1892 } |
1893 | 1893 |
| 1894 void SemiSpace::PrependPage(Page* page) { |
| 1895 // Remove page at the end. |
| 1896 Page* replacement_page = anchor()->prev_page(); |
| 1897 replacement_page->next_page()->set_prev_page(replacement_page->prev_page()); |
| 1898 replacement_page->prev_page()->set_next_page(replacement_page->next_page()); |
| 1899 DCHECK_NE(current_page(), replacement_page); |
| 1900 |
| 1901 SemiSpace* old_semi_space = reinterpret_cast<SemiSpace*>(page->owner()); |
| 1902 if (page == old_semi_space->current_page()) { |
| 1903 old_semi_space->current_page_ = replacement_page; |
| 1904 } |
| 1905 |
| 1906 // Replace it. |
| 1907 replacement_page->set_owner(page->owner()); |
| 1908 replacement_page->SetFlags(page->GetFlags(), Page::kCopyAllFlags); |
| 1909 page->next_page()->set_prev_page(replacement_page); |
| 1910 page->prev_page()->set_next_page(replacement_page); |
| 1911 replacement_page->set_prev_page(page->prev_page()); |
| 1912 replacement_page->set_next_page(page->next_page()); |
| 1913 page->set_next_page(nullptr); |
| 1914 page->set_prev_page(nullptr); |
| 1915 page->SetFlags(current_page()->GetFlags(), Page::kCopyAllFlags); |
| 1916 page->set_owner(this); |
| 1917 page->InsertAfter(anchor()); |
| 1918 } |
| 1919 |
1894 void SemiSpace::Swap(SemiSpace* from, SemiSpace* to) { | 1920 void SemiSpace::Swap(SemiSpace* from, SemiSpace* to) { |
1895 // We won't be swapping semispaces without data in them. | 1921 // We won't be swapping semispaces without data in them. |
1896 DCHECK_NE(from->anchor_.next_page(), &from->anchor_); | 1922 DCHECK_NE(from->anchor_.next_page(), &from->anchor_); |
1897 DCHECK_NE(to->anchor_.next_page(), &to->anchor_); | 1923 DCHECK_NE(to->anchor_.next_page(), &to->anchor_); |
1898 | 1924 |
1899 intptr_t saved_to_space_flags = to->current_page()->GetFlags(); | 1925 intptr_t saved_to_space_flags = to->current_page()->GetFlags(); |
1900 | 1926 |
1901 // We swap all properties but id_. | 1927 // We swap all properties but id_. |
1902 std::swap(from->current_capacity_, to->current_capacity_); | 1928 std::swap(from->current_capacity_, to->current_capacity_); |
1903 std::swap(from->maximum_capacity_, to->maximum_capacity_); | 1929 std::swap(from->maximum_capacity_, to->maximum_capacity_); |
(...skipping 1318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3222 object->ShortPrint(); | 3248 object->ShortPrint(); |
3223 PrintF("\n"); | 3249 PrintF("\n"); |
3224 } | 3250 } |
3225 printf(" --------------------------------------\n"); | 3251 printf(" --------------------------------------\n"); |
3226 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3252 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
3227 } | 3253 } |
3228 | 3254 |
3229 #endif // DEBUG | 3255 #endif // DEBUG |
3230 } // namespace internal | 3256 } // namespace internal |
3231 } // namespace v8 | 3257 } // namespace v8 |
OLD | NEW |