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 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 ASSERT(slots_buffer_ == NULL); | 646 ASSERT(slots_buffer_ == NULL); |
647 ClearFlag(EVACUATION_CANDIDATE); | 647 ClearFlag(EVACUATION_CANDIDATE); |
648 } | 648 } |
649 | 649 |
650 Address area_start() { return area_start_; } | 650 Address area_start() { return area_start_; } |
651 Address area_end() { return area_end_; } | 651 Address area_end() { return area_end_; } |
652 int area_size() { | 652 int area_size() { |
653 return static_cast<int>(area_end() - area_start()); | 653 return static_cast<int>(area_end() - area_start()); |
654 } | 654 } |
655 | 655 |
656 size_t CommittedPhysicalMemory(); | |
657 | |
658 protected: | 656 protected: |
659 MemoryChunk* next_chunk_; | 657 MemoryChunk* next_chunk_; |
660 MemoryChunk* prev_chunk_; | 658 MemoryChunk* prev_chunk_; |
661 size_t size_; | 659 size_t size_; |
662 intptr_t flags_; | 660 intptr_t flags_; |
663 | 661 |
664 // Start and end of allocatable memory on this chunk. | 662 // Start and end of allocatable memory on this chunk. |
665 Address area_start_; | 663 Address area_start_; |
666 Address area_end_; | 664 Address area_end_; |
667 | 665 |
(...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1523 // Prepares for a mark-compact GC. | 1521 // Prepares for a mark-compact GC. |
1524 virtual void PrepareForMarkCompact(); | 1522 virtual void PrepareForMarkCompact(); |
1525 | 1523 |
1526 // Current capacity without growing (Size() + Available()). | 1524 // Current capacity without growing (Size() + Available()). |
1527 intptr_t Capacity() { return accounting_stats_.Capacity(); } | 1525 intptr_t Capacity() { return accounting_stats_.Capacity(); } |
1528 | 1526 |
1529 // Total amount of memory committed for this space. For paged | 1527 // Total amount of memory committed for this space. For paged |
1530 // spaces this equals the capacity. | 1528 // spaces this equals the capacity. |
1531 intptr_t CommittedMemory() { return Capacity(); } | 1529 intptr_t CommittedMemory() { return Capacity(); } |
1532 | 1530 |
1533 // Total amount of physical memory committed for this space. | |
1534 size_t CommittedPhysicalMemory(); | |
1535 | |
1536 // Sets the capacity, the available space and the wasted space to zero. | 1531 // Sets the capacity, the available space and the wasted space to zero. |
1537 // The stats are rebuilt during sweeping by adding each page to the | 1532 // The stats are rebuilt during sweeping by adding each page to the |
1538 // capacity and the size when it is encountered. As free spaces are | 1533 // capacity and the size when it is encountered. As free spaces are |
1539 // discovered during the sweeping they are subtracted from the size and added | 1534 // discovered during the sweeping they are subtracted from the size and added |
1540 // to the available and wasted totals. | 1535 // to the available and wasted totals. |
1541 void ClearStats() { | 1536 void ClearStats() { |
1542 accounting_stats_.ClearSizeWaste(); | 1537 accounting_stats_.ClearSizeWaste(); |
1543 } | 1538 } |
1544 | 1539 |
1545 // Available bytes without growing. These are the bytes on the free list. | 1540 // Available bytes without growing. These are the bytes on the free list. |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1992 // Returns the maximum capacity of the semi space. | 1987 // Returns the maximum capacity of the semi space. |
1993 int MaximumCapacity() { return maximum_capacity_; } | 1988 int MaximumCapacity() { return maximum_capacity_; } |
1994 | 1989 |
1995 // Returns the initial capacity of the semi space. | 1990 // Returns the initial capacity of the semi space. |
1996 int InitialCapacity() { return initial_capacity_; } | 1991 int InitialCapacity() { return initial_capacity_; } |
1997 | 1992 |
1998 SemiSpaceId id() { return id_; } | 1993 SemiSpaceId id() { return id_; } |
1999 | 1994 |
2000 static void Swap(SemiSpace* from, SemiSpace* to); | 1995 static void Swap(SemiSpace* from, SemiSpace* to); |
2001 | 1996 |
2002 size_t CommittedPhysicalMemory(); | |
2003 | |
2004 private: | 1997 private: |
2005 // Flips the semispace between being from-space and to-space. | 1998 // Flips the semispace between being from-space and to-space. |
2006 // Copies the flags into the masked positions on all pages in the space. | 1999 // Copies the flags into the masked positions on all pages in the space. |
2007 void FlipPages(intptr_t flags, intptr_t flag_mask); | 2000 void FlipPages(intptr_t flags, intptr_t flag_mask); |
2008 | 2001 |
2009 NewSpacePage* anchor() { return &anchor_; } | 2002 NewSpacePage* anchor() { return &anchor_; } |
2010 | 2003 |
2011 // The current and maximum capacity of the space. | 2004 // The current and maximum capacity of the space. |
2012 int capacity_; | 2005 int capacity_; |
2013 int maximum_capacity_; | 2006 int maximum_capacity_; |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2191 ASSERT(to_space_.Capacity() == from_space_.Capacity()); | 2184 ASSERT(to_space_.Capacity() == from_space_.Capacity()); |
2192 return to_space_.Capacity(); | 2185 return to_space_.Capacity(); |
2193 } | 2186 } |
2194 | 2187 |
2195 // Return the total amount of memory committed for new space. | 2188 // Return the total amount of memory committed for new space. |
2196 intptr_t CommittedMemory() { | 2189 intptr_t CommittedMemory() { |
2197 if (from_space_.is_committed()) return 2 * Capacity(); | 2190 if (from_space_.is_committed()) return 2 * Capacity(); |
2198 return Capacity(); | 2191 return Capacity(); |
2199 } | 2192 } |
2200 | 2193 |
2201 size_t CommittedPhysicalMemory() { | |
2202 return to_space_.CommittedPhysicalMemory() | |
2203 + (from_space_.is_committed() ? from_space_.CommittedPhysicalMemory() | |
2204 : 0); | |
2205 } | |
2206 | |
2207 // Return the available bytes without growing. | 2194 // Return the available bytes without growing. |
2208 intptr_t Available() { | 2195 intptr_t Available() { |
2209 return Capacity() - Size(); | 2196 return Capacity() - Size(); |
2210 } | 2197 } |
2211 | 2198 |
2212 // Return the maximum capacity of a semispace. | 2199 // Return the maximum capacity of a semispace. |
2213 int MaximumCapacity() { | 2200 int MaximumCapacity() { |
2214 ASSERT(to_space_.MaximumCapacity() == from_space_.MaximumCapacity()); | 2201 ASSERT(to_space_.MaximumCapacity() == from_space_.MaximumCapacity()); |
2215 return to_space_.MaximumCapacity(); | 2202 return to_space_.MaximumCapacity(); |
2216 } | 2203 } |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2564 } | 2551 } |
2565 | 2552 |
2566 virtual intptr_t SizeOfObjects() { | 2553 virtual intptr_t SizeOfObjects() { |
2567 return objects_size_; | 2554 return objects_size_; |
2568 } | 2555 } |
2569 | 2556 |
2570 intptr_t CommittedMemory() { | 2557 intptr_t CommittedMemory() { |
2571 return Size(); | 2558 return Size(); |
2572 } | 2559 } |
2573 | 2560 |
2574 size_t CommittedPhysicalMemory(); | |
2575 | |
2576 int PageCount() { | 2561 int PageCount() { |
2577 return page_count_; | 2562 return page_count_; |
2578 } | 2563 } |
2579 | 2564 |
2580 // Finds an object for a given address, returns Failure::Exception() | 2565 // Finds an object for a given address, returns Failure::Exception() |
2581 // if it is not found. The function iterates through all objects in this | 2566 // if it is not found. The function iterates through all objects in this |
2582 // space, may be slow. | 2567 // space, may be slow. |
2583 MaybeObject* FindObject(Address a); | 2568 MaybeObject* FindObject(Address a); |
2584 | 2569 |
2585 // Finds a large object page containing the given address, returns NULL | 2570 // Finds a large object page containing the given address, returns NULL |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2718 } | 2703 } |
2719 // Must be small, since an iteration is used for lookup. | 2704 // Must be small, since an iteration is used for lookup. |
2720 static const int kMaxComments = 64; | 2705 static const int kMaxComments = 64; |
2721 }; | 2706 }; |
2722 #endif | 2707 #endif |
2723 | 2708 |
2724 | 2709 |
2725 } } // namespace v8::internal | 2710 } } // namespace v8::internal |
2726 | 2711 |
2727 #endif // V8_SPACES_H_ | 2712 #endif // V8_SPACES_H_ |
OLD | NEW |