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 // 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 1845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1856 ASSERT(TopPageOf(allocation_info_)->next_page()->is_valid()); | 1856 ASSERT(TopPageOf(allocation_info_)->next_page()->is_valid()); |
1857 SetAllocationInfo(&allocation_info_, | 1857 SetAllocationInfo(&allocation_info_, |
1858 TopPageOf(allocation_info_)->next_page()); | 1858 TopPageOf(allocation_info_)->next_page()); |
1859 return true; | 1859 return true; |
1860 } | 1860 } |
1861 | 1861 |
1862 | 1862 |
1863 // You have to call this last, since the implementation from PagedSpace | 1863 // You have to call this last, since the implementation from PagedSpace |
1864 // doesn't know that memory was 'promised' to large object space. | 1864 // doesn't know that memory was 'promised' to large object space. |
1865 bool LargeObjectSpace::ReserveSpace(int bytes) { | 1865 bool LargeObjectSpace::ReserveSpace(int bytes) { |
1866 // We add a slack-factor of 2 in order to have space for the remembered | 1866 return Heap::OldGenerationSpaceAvailable() >= bytes; |
1867 // set and a series of large-object allocations that are only just larger | |
1868 // than the page size. | |
1869 return Heap::OldGenerationSpaceAvailable() >= bytes * 2; | |
1870 } | 1867 } |
1871 | 1868 |
1872 | 1869 |
1873 // Slow case for normal allocation. Try in order: (1) allocate in the next | 1870 // Slow case for normal allocation. Try in order: (1) allocate in the next |
1874 // page in the space, (2) allocate off the space's free list, (3) expand the | 1871 // page in the space, (2) allocate off the space's free list, (3) expand the |
1875 // space, (4) fail. | 1872 // space, (4) fail. |
1876 HeapObject* OldSpace::SlowAllocateRaw(int size_in_bytes) { | 1873 HeapObject* OldSpace::SlowAllocateRaw(int size_in_bytes) { |
1877 // Linear allocation in this space has failed. If there is another page | 1874 // Linear allocation in this space has failed. If there is another page |
1878 // in the space, move to that page and allocate there. This allocation | 1875 // in the space, move to that page and allocate there. This allocation |
1879 // should succeed (size_in_bytes should not be greater than a page's | 1876 // should succeed (size_in_bytes should not be greater than a page's |
(...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2858 reinterpret_cast<Object**>(object->address() | 2855 reinterpret_cast<Object**>(object->address() |
2859 + Page::kObjectAreaSize), | 2856 + Page::kObjectAreaSize), |
2860 allocation_top); | 2857 allocation_top); |
2861 PrintF("\n"); | 2858 PrintF("\n"); |
2862 } | 2859 } |
2863 } | 2860 } |
2864 } | 2861 } |
2865 #endif // DEBUG | 2862 #endif // DEBUG |
2866 | 2863 |
2867 } } // namespace v8::internal | 2864 } } // namespace v8::internal |
OLD | NEW |