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_HEAP_INL_H_ | 5 #ifndef V8_HEAP_HEAP_INL_H_ |
6 #define V8_HEAP_HEAP_INL_H_ | 6 #define V8_HEAP_HEAP_INL_H_ |
7 | 7 |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "src/base/platform/platform.h" | 10 #include "src/base/platform/platform.h" |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 } | 162 } |
163 | 163 |
164 Address* Heap::OldSpaceAllocationTopAddress() { | 164 Address* Heap::OldSpaceAllocationTopAddress() { |
165 return old_space_->allocation_top_address(); | 165 return old_space_->allocation_top_address(); |
166 } | 166 } |
167 | 167 |
168 Address* Heap::OldSpaceAllocationLimitAddress() { | 168 Address* Heap::OldSpaceAllocationLimitAddress() { |
169 return old_space_->allocation_limit_address(); | 169 return old_space_->allocation_limit_address(); |
170 } | 170 } |
171 | 171 |
172 bool Heap::HeapIsFullEnoughToStartIncrementalMarking(intptr_t limit) { | |
173 if (FLAG_stress_compaction && (gc_count_ & 1) != 0) return true; | |
174 | |
175 intptr_t adjusted_allocation_limit = limit - new_space_->Capacity(); | |
176 | |
177 if (PromotedTotalSize() >= adjusted_allocation_limit) return true; | |
178 | |
179 if (HighMemoryPressure()) return true; | |
180 | |
181 return false; | |
182 } | |
183 | |
184 void Heap::UpdateNewSpaceAllocationCounter() { | 172 void Heap::UpdateNewSpaceAllocationCounter() { |
185 new_space_allocation_counter_ = NewSpaceAllocationCounter(); | 173 new_space_allocation_counter_ = NewSpaceAllocationCounter(); |
186 } | 174 } |
187 | 175 |
188 size_t Heap::NewSpaceAllocationCounter() { | 176 size_t Heap::NewSpaceAllocationCounter() { |
189 return new_space_allocation_counter_ + new_space()->AllocatedSinceLastGC(); | 177 return new_space_allocation_counter_ + new_space()->AllocatedSinceLastGC(); |
190 } | 178 } |
191 | 179 |
192 template <> | 180 template <> |
193 bool inline Heap::IsOneByte(Vector<const char> str, int chars) { | 181 bool inline Heap::IsOneByte(Vector<const char> str, int chars) { |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 bool Heap::InOldSpace(Object* object) { return old_space_->Contains(object); } | 473 bool Heap::InOldSpace(Object* object) { return old_space_->Contains(object); } |
486 | 474 |
487 bool Heap::InNewSpaceSlow(Address address) { | 475 bool Heap::InNewSpaceSlow(Address address) { |
488 return new_space_->ContainsSlow(address); | 476 return new_space_->ContainsSlow(address); |
489 } | 477 } |
490 | 478 |
491 bool Heap::InOldSpaceSlow(Address address) { | 479 bool Heap::InOldSpaceSlow(Address address) { |
492 return old_space_->ContainsSlow(address); | 480 return old_space_->ContainsSlow(address); |
493 } | 481 } |
494 | 482 |
495 bool Heap::OldGenerationAllocationLimitReached() { | |
496 if (!incremental_marking()->IsStopped() && !ShouldOptimizeForMemoryUsage()) { | |
497 return false; | |
498 } | |
499 return OldGenerationSpaceAvailable() < 0; | |
500 } | |
501 | |
502 template <PromotionMode promotion_mode> | 483 template <PromotionMode promotion_mode> |
503 bool Heap::ShouldBePromoted(Address old_address, int object_size) { | 484 bool Heap::ShouldBePromoted(Address old_address, int object_size) { |
504 if (promotion_mode == PROMOTE_MARKED) { | 485 if (promotion_mode == PROMOTE_MARKED) { |
505 MarkBit mark_bit = ObjectMarking::MarkBitFrom(old_address); | 486 MarkBit mark_bit = ObjectMarking::MarkBitFrom(old_address); |
506 if (!Marking::IsWhite(mark_bit)) { | 487 if (!Marking::IsWhite(mark_bit)) { |
507 return true; | 488 return true; |
508 } | 489 } |
509 } | 490 } |
510 | 491 |
511 return Page::FromAddress(old_address)->InIntermediateGeneration(); | 492 return Page::FromAddress(old_address)->InIntermediateGeneration(); |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
849 | 830 |
850 void VerifySmisVisitor::VisitPointers(Object** start, Object** end) { | 831 void VerifySmisVisitor::VisitPointers(Object** start, Object** end) { |
851 for (Object** current = start; current < end; current++) { | 832 for (Object** current = start; current < end; current++) { |
852 CHECK((*current)->IsSmi()); | 833 CHECK((*current)->IsSmi()); |
853 } | 834 } |
854 } | 835 } |
855 } // namespace internal | 836 } // namespace internal |
856 } // namespace v8 | 837 } // namespace v8 |
857 | 838 |
858 #endif // V8_HEAP_HEAP_INL_H_ | 839 #endif // V8_HEAP_HEAP_INL_H_ |
OLD | NEW |