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 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 ASSERT(slots_buffer_ == NULL); | 594 ASSERT(slots_buffer_ == NULL); |
595 ClearFlag(EVACUATION_CANDIDATE); | 595 ClearFlag(EVACUATION_CANDIDATE); |
596 } | 596 } |
597 | 597 |
598 Address area_start() { return area_start_; } | 598 Address area_start() { return area_start_; } |
599 Address area_end() { return area_end_; } | 599 Address area_end() { return area_end_; } |
600 int area_size() { | 600 int area_size() { |
601 return static_cast<int>(area_end() - area_start()); | 601 return static_cast<int>(area_end() - area_start()); |
602 } | 602 } |
603 | 603 |
| 604 size_t CommittedPhysicalMemory(); |
| 605 |
604 protected: | 606 protected: |
605 MemoryChunk* next_chunk_; | 607 MemoryChunk* next_chunk_; |
606 MemoryChunk* prev_chunk_; | 608 MemoryChunk* prev_chunk_; |
607 size_t size_; | 609 size_t size_; |
608 intptr_t flags_; | 610 intptr_t flags_; |
609 | 611 |
610 // Start and end of allocatable memory on this chunk. | 612 // Start and end of allocatable memory on this chunk. |
611 Address area_start_; | 613 Address area_start_; |
612 Address area_end_; | 614 Address area_end_; |
613 | 615 |
(...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1467 // Prepares for a mark-compact GC. | 1469 // Prepares for a mark-compact GC. |
1468 virtual void PrepareForMarkCompact(); | 1470 virtual void PrepareForMarkCompact(); |
1469 | 1471 |
1470 // Current capacity without growing (Size() + Available()). | 1472 // Current capacity without growing (Size() + Available()). |
1471 intptr_t Capacity() { return accounting_stats_.Capacity(); } | 1473 intptr_t Capacity() { return accounting_stats_.Capacity(); } |
1472 | 1474 |
1473 // Total amount of memory committed for this space. For paged | 1475 // Total amount of memory committed for this space. For paged |
1474 // spaces this equals the capacity. | 1476 // spaces this equals the capacity. |
1475 intptr_t CommittedMemory() { return Capacity(); } | 1477 intptr_t CommittedMemory() { return Capacity(); } |
1476 | 1478 |
| 1479 // Total amount of physical memory committed for this space. |
| 1480 size_t CommittedPhysicalMemory(); |
| 1481 |
1477 // Sets the capacity, the available space and the wasted space to zero. | 1482 // Sets the capacity, the available space and the wasted space to zero. |
1478 // The stats are rebuilt during sweeping by adding each page to the | 1483 // The stats are rebuilt during sweeping by adding each page to the |
1479 // capacity and the size when it is encountered. As free spaces are | 1484 // capacity and the size when it is encountered. As free spaces are |
1480 // discovered during the sweeping they are subtracted from the size and added | 1485 // discovered during the sweeping they are subtracted from the size and added |
1481 // to the available and wasted totals. | 1486 // to the available and wasted totals. |
1482 void ClearStats() { | 1487 void ClearStats() { |
1483 accounting_stats_.ClearSizeWaste(); | 1488 accounting_stats_.ClearSizeWaste(); |
1484 } | 1489 } |
1485 | 1490 |
1486 // Available bytes without growing. These are the bytes on the free list. | 1491 // 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... |
1933 // Returns the maximum capacity of the semi space. | 1938 // Returns the maximum capacity of the semi space. |
1934 int MaximumCapacity() { return maximum_capacity_; } | 1939 int MaximumCapacity() { return maximum_capacity_; } |
1935 | 1940 |
1936 // Returns the initial capacity of the semi space. | 1941 // Returns the initial capacity of the semi space. |
1937 int InitialCapacity() { return initial_capacity_; } | 1942 int InitialCapacity() { return initial_capacity_; } |
1938 | 1943 |
1939 SemiSpaceId id() { return id_; } | 1944 SemiSpaceId id() { return id_; } |
1940 | 1945 |
1941 static void Swap(SemiSpace* from, SemiSpace* to); | 1946 static void Swap(SemiSpace* from, SemiSpace* to); |
1942 | 1947 |
| 1948 size_t CommittedPhysicalMemory(); |
| 1949 |
1943 private: | 1950 private: |
1944 // Flips the semispace between being from-space and to-space. | 1951 // Flips the semispace between being from-space and to-space. |
1945 // Copies the flags into the masked positions on all pages in the space. | 1952 // Copies the flags into the masked positions on all pages in the space. |
1946 void FlipPages(intptr_t flags, intptr_t flag_mask); | 1953 void FlipPages(intptr_t flags, intptr_t flag_mask); |
1947 | 1954 |
1948 NewSpacePage* anchor() { return &anchor_; } | 1955 NewSpacePage* anchor() { return &anchor_; } |
1949 | 1956 |
1950 // The current and maximum capacity of the space. | 1957 // The current and maximum capacity of the space. |
1951 int capacity_; | 1958 int capacity_; |
1952 int maximum_capacity_; | 1959 int maximum_capacity_; |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2130 ASSERT(to_space_.Capacity() == from_space_.Capacity()); | 2137 ASSERT(to_space_.Capacity() == from_space_.Capacity()); |
2131 return to_space_.Capacity(); | 2138 return to_space_.Capacity(); |
2132 } | 2139 } |
2133 | 2140 |
2134 // Return the total amount of memory committed for new space. | 2141 // Return the total amount of memory committed for new space. |
2135 intptr_t CommittedMemory() { | 2142 intptr_t CommittedMemory() { |
2136 if (from_space_.is_committed()) return 2 * Capacity(); | 2143 if (from_space_.is_committed()) return 2 * Capacity(); |
2137 return Capacity(); | 2144 return Capacity(); |
2138 } | 2145 } |
2139 | 2146 |
| 2147 size_t CommittedPhysicalMemory() { |
| 2148 return to_space_.CommittedPhysicalMemory() |
| 2149 + (from_space_.is_committed() ? from_space_.CommittedPhysicalMemory() |
| 2150 : 0); |
| 2151 } |
| 2152 |
2140 // Return the available bytes without growing. | 2153 // Return the available bytes without growing. |
2141 intptr_t Available() { | 2154 intptr_t Available() { |
2142 return Capacity() - Size(); | 2155 return Capacity() - Size(); |
2143 } | 2156 } |
2144 | 2157 |
2145 // Return the maximum capacity of a semispace. | 2158 // Return the maximum capacity of a semispace. |
2146 int MaximumCapacity() { | 2159 int MaximumCapacity() { |
2147 ASSERT(to_space_.MaximumCapacity() == from_space_.MaximumCapacity()); | 2160 ASSERT(to_space_.MaximumCapacity() == from_space_.MaximumCapacity()); |
2148 return to_space_.MaximumCapacity(); | 2161 return to_space_.MaximumCapacity(); |
2149 } | 2162 } |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2497 } | 2510 } |
2498 | 2511 |
2499 virtual intptr_t SizeOfObjects() { | 2512 virtual intptr_t SizeOfObjects() { |
2500 return objects_size_; | 2513 return objects_size_; |
2501 } | 2514 } |
2502 | 2515 |
2503 intptr_t CommittedMemory() { | 2516 intptr_t CommittedMemory() { |
2504 return Size(); | 2517 return Size(); |
2505 } | 2518 } |
2506 | 2519 |
| 2520 size_t CommittedPhysicalMemory(); |
| 2521 |
2507 int PageCount() { | 2522 int PageCount() { |
2508 return page_count_; | 2523 return page_count_; |
2509 } | 2524 } |
2510 | 2525 |
2511 // Finds an object for a given address, returns Failure::Exception() | 2526 // Finds an object for a given address, returns Failure::Exception() |
2512 // if it is not found. The function iterates through all objects in this | 2527 // if it is not found. The function iterates through all objects in this |
2513 // space, may be slow. | 2528 // space, may be slow. |
2514 MaybeObject* FindObject(Address a); | 2529 MaybeObject* FindObject(Address a); |
2515 | 2530 |
2516 // Finds a large object page containing the given address, returns NULL | 2531 // Finds a large object page containing the given address, returns NULL |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2649 } | 2664 } |
2650 // Must be small, since an iteration is used for lookup. | 2665 // Must be small, since an iteration is used for lookup. |
2651 static const int kMaxComments = 64; | 2666 static const int kMaxComments = 64; |
2652 }; | 2667 }; |
2653 #endif | 2668 #endif |
2654 | 2669 |
2655 | 2670 |
2656 } } // namespace v8::internal | 2671 } } // namespace v8::internal |
2657 | 2672 |
2658 #endif // V8_SPACES_H_ | 2673 #endif // V8_SPACES_H_ |
OLD | NEW |