Index: src/spaces.h |
diff --git a/src/spaces.h b/src/spaces.h |
index 41bfec90f142797bdc295d622505ee963c6b05c6..60432e39cf7c30a55da8131e52fba42350705b7e 100644 |
--- a/src/spaces.h |
+++ b/src/spaces.h |
@@ -1469,9 +1469,16 @@ class PagedSpace : public Space { |
// linear allocation area (between top and limit) are also counted here. |
virtual intptr_t Size() { return accounting_stats_.Size(); } |
- // As size, but the bytes in the current linear allocation area are not |
- // included. |
- virtual intptr_t SizeOfObjects() { return Size() - (limit() - top()); } |
+ // As size, but the bytes in lazily swept pages are estimated and the bytes |
+ // in the current linear allocation area are not included. |
+ intptr_t SizeOfObjectsSlow(); |
+ virtual intptr_t SizeOfObjects() { |
+ if (IsSweepingComplete()) { |
+ return Size() - (limit() - top()); |
+ } else { |
+ return SizeOfObjectsSlow(); |
+ } |
+ } |
// Wasted bytes in this space. These are just the bytes that were thrown away |
// due to being too small to use for allocation. They do not include the |
@@ -1479,9 +1486,7 @@ class PagedSpace : public Space { |
virtual intptr_t Waste() { return accounting_stats_.Waste(); } |
// Returns the allocation pointer in this space. |
- Address top() { |
- return allocation_info_.top; |
- } |
+ Address top() { return allocation_info_.top; } |
Address limit() { return allocation_info_.limit; } |
// Allocate the requested number of bytes in the space if possible, return a |