| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1776 int wasted = free_list_.Free(start, size_in_bytes); | 1776 int wasted = free_list_.Free(start, size_in_bytes); |
| 1777 accounting_stats_.DeallocateBytes(size_in_bytes - wasted); | 1777 accounting_stats_.DeallocateBytes(size_in_bytes - wasted); |
| 1778 return size_in_bytes - wasted; | 1778 return size_in_bytes - wasted; |
| 1779 } | 1779 } |
| 1780 | 1780 |
| 1781 void ResetFreeList() { | 1781 void ResetFreeList() { |
| 1782 free_list_.Reset(); | 1782 free_list_.Reset(); |
| 1783 } | 1783 } |
| 1784 | 1784 |
| 1785 // Set space allocation info. | 1785 // Set space allocation info. |
| 1786 void SetTop(Address top, Address limit) { | 1786 void SetTopAndLimit(Address top, Address limit) { |
| 1787 ASSERT(top == limit || | 1787 ASSERT(top == limit || |
| 1788 Page::FromAddress(top) == Page::FromAddress(limit - 1)); | 1788 Page::FromAddress(top) == Page::FromAddress(limit - 1)); |
| 1789 MemoryChunk::UpdateHighWaterMark(allocation_info_.top()); | 1789 MemoryChunk::UpdateHighWaterMark(allocation_info_.top()); |
| 1790 allocation_info_.set_top(top); | 1790 allocation_info_.set_top(top); |
| 1791 allocation_info_.set_limit(limit); | 1791 allocation_info_.set_limit(limit); |
| 1792 } | 1792 } |
| 1793 | 1793 |
| 1794 // Empty space allocation info, returning unused area to free list. |
| 1795 void EmptyAllocationInfo() { |
| 1796 // Mark the old linear allocation area with a free space map so it can be |
| 1797 // skipped when scanning the heap. |
| 1798 int old_linear_size = static_cast<int>(limit() - top()); |
| 1799 Free(top(), old_linear_size); |
| 1800 SetTopAndLimit(NULL, NULL); |
| 1801 } |
| 1802 |
| 1794 void Allocate(int bytes) { | 1803 void Allocate(int bytes) { |
| 1795 accounting_stats_.AllocateBytes(bytes); | 1804 accounting_stats_.AllocateBytes(bytes); |
| 1796 } | 1805 } |
| 1797 | 1806 |
| 1798 void IncreaseCapacity(int size); | 1807 void IncreaseCapacity(int size); |
| 1799 | 1808 |
| 1800 // Releases an unused page and shrinks the space. | 1809 // Releases an unused page and shrinks the space. |
| 1801 void ReleasePage(Page* page, bool unlink); | 1810 void ReleasePage(Page* page, bool unlink); |
| 1802 | 1811 |
| 1803 // The dummy page that anchors the linked list of pages. | 1812 // The dummy page that anchors the linked list of pages. |
| (...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2471 // The allocation limit address. | 2480 // The allocation limit address. |
| 2472 Address* allocation_limit_address() { | 2481 Address* allocation_limit_address() { |
| 2473 return allocation_info_.limit_address(); | 2482 return allocation_info_.limit_address(); |
| 2474 } | 2483 } |
| 2475 | 2484 |
| 2476 MUST_USE_RESULT INLINE(MaybeObject* AllocateRaw(int size_in_bytes)); | 2485 MUST_USE_RESULT INLINE(MaybeObject* AllocateRaw(int size_in_bytes)); |
| 2477 | 2486 |
| 2478 // Reset the allocation pointer to the beginning of the active semispace. | 2487 // Reset the allocation pointer to the beginning of the active semispace. |
| 2479 void ResetAllocationInfo(); | 2488 void ResetAllocationInfo(); |
| 2480 | 2489 |
| 2490 void UpdateInlineAllocationLimit(int size_in_bytes); |
| 2481 void LowerInlineAllocationLimit(intptr_t step) { | 2491 void LowerInlineAllocationLimit(intptr_t step) { |
| 2482 inline_allocation_limit_step_ = step; | 2492 inline_allocation_limit_step_ = step; |
| 2483 if (step == 0) { | 2493 UpdateInlineAllocationLimit(0); |
| 2484 allocation_info_.set_limit(to_space_.page_high()); | |
| 2485 } else { | |
| 2486 Address new_limit = Min( | |
| 2487 allocation_info_.top() + inline_allocation_limit_step_, | |
| 2488 allocation_info_.limit()); | |
| 2489 allocation_info_.set_limit(new_limit); | |
| 2490 } | |
| 2491 top_on_previous_step_ = allocation_info_.top(); | 2494 top_on_previous_step_ = allocation_info_.top(); |
| 2492 } | 2495 } |
| 2493 | 2496 |
| 2494 // Get the extent of the inactive semispace (for use as a marking stack, | 2497 // Get the extent of the inactive semispace (for use as a marking stack, |
| 2495 // or to zap it). Notice: space-addresses are not necessarily on the | 2498 // or to zap it). Notice: space-addresses are not necessarily on the |
| 2496 // same page, so FromSpaceStart() might be above FromSpaceEnd(). | 2499 // same page, so FromSpaceStart() might be above FromSpaceEnd(). |
| 2497 Address FromSpacePageLow() { return from_space_.page_low(); } | 2500 Address FromSpacePageLow() { return from_space_.page_low(); } |
| 2498 Address FromSpacePageHigh() { return from_space_.page_high(); } | 2501 Address FromSpacePageHigh() { return from_space_.page_high(); } |
| 2499 Address FromSpaceStart() { return from_space_.space_start(); } | 2502 Address FromSpaceStart() { return from_space_.space_start(); } |
| 2500 Address FromSpaceEnd() { return from_space_.space_end(); } | 2503 Address FromSpaceEnd() { return from_space_.space_end(); } |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2920 } | 2923 } |
| 2921 // Must be small, since an iteration is used for lookup. | 2924 // Must be small, since an iteration is used for lookup. |
| 2922 static const int kMaxComments = 64; | 2925 static const int kMaxComments = 64; |
| 2923 }; | 2926 }; |
| 2924 #endif | 2927 #endif |
| 2925 | 2928 |
| 2926 | 2929 |
| 2927 } } // namespace v8::internal | 2930 } } // namespace v8::internal |
| 2928 | 2931 |
| 2929 #endif // V8_SPACES_H_ | 2932 #endif // V8_SPACES_H_ |
| OLD | NEW |