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 1696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1707 virtual intptr_t Waste() { return accounting_stats_.Waste(); } | 1707 virtual intptr_t Waste() { return accounting_stats_.Waste(); } |
1708 | 1708 |
1709 // Returns the allocation pointer in this space. | 1709 // Returns the allocation pointer in this space. |
1710 Address top() { return allocation_info_.top; } | 1710 Address top() { return allocation_info_.top; } |
1711 Address limit() { return allocation_info_.limit; } | 1711 Address limit() { return allocation_info_.limit; } |
1712 | 1712 |
1713 // The allocation top and limit addresses. | 1713 // The allocation top and limit addresses. |
1714 Address* allocation_top_address() { return &allocation_info_.top; } | 1714 Address* allocation_top_address() { return &allocation_info_.top; } |
1715 Address* allocation_limit_address() { return &allocation_info_.limit; } | 1715 Address* allocation_limit_address() { return &allocation_info_.limit; } |
1716 | 1716 |
| 1717 enum AllocationType { |
| 1718 NEW_OBJECT, |
| 1719 MOVE_OBJECT |
| 1720 }; |
| 1721 |
1717 // Allocate the requested number of bytes in the space if possible, return a | 1722 // Allocate the requested number of bytes in the space if possible, return a |
1718 // failure object if not. | 1723 // failure object if not. |
1719 MUST_USE_RESULT inline MaybeObject* AllocateRaw(int size_in_bytes); | 1724 MUST_USE_RESULT inline MaybeObject* AllocateRaw( |
| 1725 int size_in_bytes, |
| 1726 AllocationType event = NEW_OBJECT); |
1720 | 1727 |
1721 virtual bool ReserveSpace(int bytes); | 1728 virtual bool ReserveSpace(int bytes); |
1722 | 1729 |
1723 // Give a block of memory to the space's free list. It might be added to | 1730 // Give a block of memory to the space's free list. It might be added to |
1724 // the free list or accounted as waste. | 1731 // the free list or accounted as waste. |
1725 // If add_to_freelist is false then just accounting stats are updated and | 1732 // If add_to_freelist is false then just accounting stats are updated and |
1726 // no attempt to add area to free list is made. | 1733 // no attempt to add area to free list is made. |
1727 int Free(Address start, int size_in_bytes) { | 1734 int Free(Address start, int size_in_bytes) { |
1728 int wasted = free_list_.Free(start, size_in_bytes); | 1735 int wasted = free_list_.Free(start, size_in_bytes); |
1729 accounting_stats_.DeallocateBytes(size_in_bytes - wasted); | 1736 accounting_stats_.DeallocateBytes(size_in_bytes - wasted); |
(...skipping 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2896 } | 2903 } |
2897 // Must be small, since an iteration is used for lookup. | 2904 // Must be small, since an iteration is used for lookup. |
2898 static const int kMaxComments = 64; | 2905 static const int kMaxComments = 64; |
2899 }; | 2906 }; |
2900 #endif | 2907 #endif |
2901 | 2908 |
2902 | 2909 |
2903 } } // namespace v8::internal | 2910 } } // namespace v8::internal |
2904 | 2911 |
2905 #endif // V8_SPACES_H_ | 2912 #endif // V8_SPACES_H_ |
OLD | NEW |