| 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 1487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1498 accounting_stats_.AllocateBytes(bytes); | 1498 accounting_stats_.AllocateBytes(bytes); |
| 1499 } | 1499 } |
| 1500 | 1500 |
| 1501 void IncreaseCapacity(int size) { | 1501 void IncreaseCapacity(int size) { |
| 1502 accounting_stats_.ExpandSpace(size); | 1502 accounting_stats_.ExpandSpace(size); |
| 1503 } | 1503 } |
| 1504 | 1504 |
| 1505 // Releases half of unused pages. | 1505 // Releases half of unused pages. |
| 1506 void Shrink(); | 1506 void Shrink(); |
| 1507 | 1507 |
| 1508 // Ensures that the capacity is at least 'capacity'. Returns false on failure. | |
| 1509 bool EnsureCapacity(int capacity); | |
| 1510 | |
| 1511 // The dummy page that anchors the linked list of pages. | 1508 // The dummy page that anchors the linked list of pages. |
| 1512 Page* anchor() { return &anchor_; } | 1509 Page* anchor() { return &anchor_; } |
| 1513 | 1510 |
| 1514 #ifdef DEBUG | 1511 #ifdef DEBUG |
| 1515 // Print meta info and objects in this space. | 1512 // Print meta info and objects in this space. |
| 1516 virtual void Print(); | 1513 virtual void Print(); |
| 1517 | 1514 |
| 1518 // Verify integrity of this space. | 1515 // Verify integrity of this space. |
| 1519 virtual void Verify(ObjectVisitor* visitor); | 1516 virtual void Verify(ObjectVisitor* visitor); |
| 1520 | 1517 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1618 | 1615 |
| 1619 Page* first_unswept_page_; | 1616 Page* first_unswept_page_; |
| 1620 Page* last_unswept_page_; | 1617 Page* last_unswept_page_; |
| 1621 | 1618 |
| 1622 // Expands the space by allocating a fixed number of pages. Returns false if | 1619 // Expands the space by allocating a fixed number of pages. Returns false if |
| 1623 // it cannot allocate requested number of pages from OS. | 1620 // it cannot allocate requested number of pages from OS. |
| 1624 bool Expand(); | 1621 bool Expand(); |
| 1625 | 1622 |
| 1626 // Generic fast case allocation function that tries linear allocation at the | 1623 // Generic fast case allocation function that tries linear allocation at the |
| 1627 // address denoted by top in allocation_info_. | 1624 // address denoted by top in allocation_info_. |
| 1628 inline HeapObject* AllocateLinearly(AllocationInfo* alloc_info, | 1625 inline HeapObject* AllocateLinearly(int size_in_bytes); |
| 1629 int size_in_bytes); | |
| 1630 | 1626 |
| 1631 // Slow path of AllocateRaw. This function is space-dependent. | 1627 // Slow path of AllocateRaw. This function is space-dependent. |
| 1632 MUST_USE_RESULT virtual HeapObject* SlowAllocateRaw(int size_in_bytes); | 1628 MUST_USE_RESULT virtual HeapObject* SlowAllocateRaw(int size_in_bytes); |
| 1633 | 1629 |
| 1634 #ifdef DEBUG | 1630 #ifdef DEBUG |
| 1635 // Returns the number of total pages in this space. | 1631 // Returns the number of total pages in this space. |
| 1636 int CountTotalPages(); | 1632 int CountTotalPages(); |
| 1637 #endif | 1633 #endif |
| 1638 | 1634 |
| 1639 friend class PageIterator; | 1635 friend class PageIterator; |
| (...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2612 } | 2608 } |
| 2613 // Must be small, since an iteration is used for lookup. | 2609 // Must be small, since an iteration is used for lookup. |
| 2614 static const int kMaxComments = 64; | 2610 static const int kMaxComments = 64; |
| 2615 }; | 2611 }; |
| 2616 #endif | 2612 #endif |
| 2617 | 2613 |
| 2618 | 2614 |
| 2619 } } // namespace v8::internal | 2615 } } // namespace v8::internal |
| 2620 | 2616 |
| 2621 #endif // V8_SPACES_H_ | 2617 #endif // V8_SPACES_H_ |
| OLD | NEW |