| 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 1602 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1613     } |  1613     } | 
|  1614     if (ratio <= ratio_threshold) return 0;  // Not fragmented. |  1614     if (ratio <= ratio_threshold) return 0;  // Not fragmented. | 
|  1615  |  1615  | 
|  1616     return static_cast<int>(ratio - ratio_threshold); |  1616     return static_cast<int>(ratio - ratio_threshold); | 
|  1617   } |  1617   } | 
|  1618  |  1618  | 
|  1619   void EvictEvacuationCandidatesFromFreeLists(); |  1619   void EvictEvacuationCandidatesFromFreeLists(); | 
|  1620  |  1620  | 
|  1621   bool CanExpand(); |  1621   bool CanExpand(); | 
|  1622  |  1622  | 
 |  1623   // Expands the space by allocating a fixed number of pages. Returns false if | 
 |  1624   // it cannot allocate requested number of pages from OS, or if the hard heap | 
 |  1625   // size limit has been hit. | 
 |  1626   bool Expand(); | 
 |  1627  | 
|  1623   // Returns the number of total pages in this space. |  1628   // Returns the number of total pages in this space. | 
|  1624   int CountTotalPages(); |  1629   int CountTotalPages(); | 
|  1625  |  1630  | 
|  1626  protected: |  1631  protected: | 
|  1627   // Maximum capacity of this space. |  1632   // Maximum capacity of this space. | 
|  1628   intptr_t max_capacity_; |  1633   intptr_t max_capacity_; | 
|  1629  |  1634  | 
|  1630   // Accounting information for this space. |  1635   // Accounting information for this space. | 
|  1631   AllocationStats accounting_stats_; |  1636   AllocationStats accounting_stats_; | 
|  1632  |  1637  | 
|  1633   // The dummy page that anchors the double linked list of pages. |  1638   // The dummy page that anchors the double linked list of pages. | 
|  1634   Page anchor_; |  1639   Page anchor_; | 
|  1635  |  1640  | 
|  1636   // The space's free list. |  1641   // The space's free list. | 
|  1637   FreeList free_list_; |  1642   FreeList free_list_; | 
|  1638  |  1643  | 
|  1639   // Normal allocation information. |  1644   // Normal allocation information. | 
|  1640   AllocationInfo allocation_info_; |  1645   AllocationInfo allocation_info_; | 
|  1641  |  1646  | 
|  1642   // Bytes of each page that cannot be allocated.  Possibly non-zero |  1647   // Bytes of each page that cannot be allocated.  Possibly non-zero | 
|  1643   // for pages in spaces with only fixed-size objects.  Always zero |  1648   // for pages in spaces with only fixed-size objects.  Always zero | 
|  1644   // for pages in spaces with variable sized objects (those pages are |  1649   // for pages in spaces with variable sized objects (those pages are | 
|  1645   // padded with free-list nodes). |  1650   // padded with free-list nodes). | 
|  1646   int page_extra_; |  1651   int page_extra_; | 
|  1647  |  1652  | 
|  1648   bool was_swept_conservatively_; |  1653   bool was_swept_conservatively_; | 
|  1649  |  1654  | 
|  1650   Page* first_unswept_page_; |  1655   Page* first_unswept_page_; | 
|  1651  |  1656  | 
|  1652   // Expands the space by allocating a fixed number of pages. Returns false if |  | 
|  1653   // it cannot allocate requested number of pages from OS. |  | 
|  1654   bool Expand(); |  | 
|  1655  |  | 
|  1656   // Generic fast case allocation function that tries linear allocation at the |  1657   // Generic fast case allocation function that tries linear allocation at the | 
|  1657   // address denoted by top in allocation_info_. |  1658   // address denoted by top in allocation_info_. | 
|  1658   inline HeapObject* AllocateLinearly(int size_in_bytes); |  1659   inline HeapObject* AllocateLinearly(int size_in_bytes); | 
|  1659  |  1660  | 
|  1660   // Slow path of AllocateRaw.  This function is space-dependent. |  1661   // Slow path of AllocateRaw.  This function is space-dependent. | 
|  1661   MUST_USE_RESULT virtual HeapObject* SlowAllocateRaw(int size_in_bytes); |  1662   MUST_USE_RESULT virtual HeapObject* SlowAllocateRaw(int size_in_bytes); | 
|  1662  |  1663  | 
|  1663   friend class PageIterator; |  1664   friend class PageIterator; | 
|  1664 }; |  1665 }; | 
|  1665  |  1666  | 
| (...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2629   } |  2630   } | 
|  2630   // Must be small, since an iteration is used for lookup. |  2631   // Must be small, since an iteration is used for lookup. | 
|  2631   static const int kMaxComments = 64; |  2632   static const int kMaxComments = 64; | 
|  2632 }; |  2633 }; | 
|  2633 #endif |  2634 #endif | 
|  2634  |  2635  | 
|  2635  |  2636  | 
|  2636 } }  // namespace v8::internal |  2637 } }  // namespace v8::internal | 
|  2637  |  2638  | 
|  2638 #endif  // V8_SPACES_H_ |  2639 #endif  // V8_SPACES_H_ | 
| OLD | NEW |