OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_HEAP_INL_H_ | 5 #ifndef V8_HEAP_INL_H_ |
6 #define V8_HEAP_INL_H_ | 6 #define V8_HEAP_INL_H_ |
7 | 7 |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "src/heap.h" | 10 #include "src/heap.h" |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 } | 295 } |
296 | 296 |
297 | 297 |
298 bool Heap::OldGenerationAllocationLimitReached() { | 298 bool Heap::OldGenerationAllocationLimitReached() { |
299 if (!incremental_marking()->IsStopped()) return false; | 299 if (!incremental_marking()->IsStopped()) return false; |
300 return OldGenerationSpaceAvailable() < 0; | 300 return OldGenerationSpaceAvailable() < 0; |
301 } | 301 } |
302 | 302 |
303 | 303 |
304 bool Heap::ShouldBePromoted(Address old_address, int object_size) { | 304 bool Heap::ShouldBePromoted(Address old_address, int object_size) { |
305 // An object should be promoted if: | 305 // An object should be promoted if the object has survived a |
306 // - the object has survived a scavenge operation or | 306 // scavenge operation. |
307 // - to space is already 25% full. | |
308 NewSpacePage* page = NewSpacePage::FromAddress(old_address); | 307 NewSpacePage* page = NewSpacePage::FromAddress(old_address); |
309 Address age_mark = new_space_.age_mark(); | 308 Address age_mark = new_space_.age_mark(); |
310 bool below_mark = page->IsFlagSet(MemoryChunk::NEW_SPACE_BELOW_AGE_MARK) && | 309 return page->IsFlagSet(MemoryChunk::NEW_SPACE_BELOW_AGE_MARK) && |
311 (!page->ContainsLimit(age_mark) || old_address < age_mark); | 310 (!page->ContainsLimit(age_mark) || old_address < age_mark); |
312 return below_mark || (new_space_.Size() + object_size) >= | |
313 (new_space_.EffectiveCapacity() >> 2); | |
314 } | 311 } |
315 | 312 |
316 | 313 |
317 void Heap::RecordWrite(Address address, int offset) { | 314 void Heap::RecordWrite(Address address, int offset) { |
318 if (!InNewSpace(address)) store_buffer_.Mark(address + offset); | 315 if (!InNewSpace(address)) store_buffer_.Mark(address + offset); |
319 } | 316 } |
320 | 317 |
321 | 318 |
322 void Heap::RecordWrites(Address address, int start, int len) { | 319 void Heap::RecordWrites(Address address, int start, int len) { |
323 if (!InNewSpace(address)) { | 320 if (!InNewSpace(address)) { |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
725 | 722 |
726 | 723 |
727 double GCTracer::SizeOfHeapObjects() { | 724 double GCTracer::SizeOfHeapObjects() { |
728 return (static_cast<double>(heap_->SizeOfObjects())) / MB; | 725 return (static_cast<double>(heap_->SizeOfObjects())) / MB; |
729 } | 726 } |
730 | 727 |
731 | 728 |
732 } } // namespace v8::internal | 729 } } // namespace v8::internal |
733 | 730 |
734 #endif // V8_HEAP_INL_H_ | 731 #endif // V8_HEAP_INL_H_ |
OLD | NEW |