| 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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 UNREACHABLE(); | 247 UNREACHABLE(); |
| 248 } | 248 } |
| 249 if (allocation.To(&object)) { | 249 if (allocation.To(&object)) { |
| 250 OnAllocationEvent(object, size_in_bytes); | 250 OnAllocationEvent(object, size_in_bytes); |
| 251 } else { | 251 } else { |
| 252 old_gen_exhausted_ = true; | 252 old_gen_exhausted_ = true; |
| 253 } | 253 } |
| 254 | 254 |
| 255 if (!old_gen_exhausted_ && incremental_marking()->black_allocation() && | 255 if (!old_gen_exhausted_ && incremental_marking()->black_allocation() && |
| 256 space != OLD_SPACE) { | 256 space != OLD_SPACE) { |
| 257 Marking::MarkBlack(Marking::MarkBitFrom(object)); | 257 Marking::MarkBlack(ObjectMarking::MarkBitFrom(object)); |
| 258 MemoryChunk::IncrementLiveBytesFromGC(object, size_in_bytes); | 258 MemoryChunk::IncrementLiveBytesFromGC(object, size_in_bytes); |
| 259 } | 259 } |
| 260 return allocation; | 260 return allocation; |
| 261 } | 261 } |
| 262 | 262 |
| 263 | 263 |
| 264 void Heap::OnAllocationEvent(HeapObject* object, int size_in_bytes) { | 264 void Heap::OnAllocationEvent(HeapObject* object, int size_in_bytes) { |
| 265 HeapProfiler* profiler = isolate_->heap_profiler(); | 265 HeapProfiler* profiler = isolate_->heap_profiler(); |
| 266 if (profiler->is_tracking_allocations()) { | 266 if (profiler->is_tracking_allocations()) { |
| 267 profiler->AllocationEvent(object->address(), size_in_bytes); | 267 profiler->AllocationEvent(object->address(), size_in_bytes); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 if (!incremental_marking()->IsStopped()) return false; | 392 if (!incremental_marking()->IsStopped()) return false; |
| 393 return OldGenerationSpaceAvailable() < 0; | 393 return OldGenerationSpaceAvailable() < 0; |
| 394 } | 394 } |
| 395 | 395 |
| 396 template <PromotionMode promotion_mode> | 396 template <PromotionMode promotion_mode> |
| 397 bool Heap::ShouldBePromoted(Address old_address, int object_size) { | 397 bool Heap::ShouldBePromoted(Address old_address, int object_size) { |
| 398 Page* page = Page::FromAddress(old_address); | 398 Page* page = Page::FromAddress(old_address); |
| 399 Address age_mark = new_space_.age_mark(); | 399 Address age_mark = new_space_.age_mark(); |
| 400 | 400 |
| 401 if (promotion_mode == PROMOTE_MARKED) { | 401 if (promotion_mode == PROMOTE_MARKED) { |
| 402 MarkBit mark_bit = Marking::MarkBitFrom(old_address); | 402 MarkBit mark_bit = ObjectMarking::MarkBitFrom(old_address); |
| 403 if (!Marking::IsWhite(mark_bit)) { | 403 if (!Marking::IsWhite(mark_bit)) { |
| 404 return true; | 404 return true; |
| 405 } | 405 } |
| 406 } | 406 } |
| 407 | 407 |
| 408 return page->IsFlagSet(MemoryChunk::NEW_SPACE_BELOW_AGE_MARK) && | 408 return page->IsFlagSet(MemoryChunk::NEW_SPACE_BELOW_AGE_MARK) && |
| 409 (!page->ContainsLimit(age_mark) || old_address < age_mark); | 409 (!page->ContainsLimit(age_mark) || old_address < age_mark); |
| 410 } | 410 } |
| 411 | 411 |
| 412 PromotionMode Heap::CurrentPromotionMode() { | 412 PromotionMode Heap::CurrentPromotionMode() { |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 767 | 767 |
| 768 void VerifySmisVisitor::VisitPointers(Object** start, Object** end) { | 768 void VerifySmisVisitor::VisitPointers(Object** start, Object** end) { |
| 769 for (Object** current = start; current < end; current++) { | 769 for (Object** current = start; current < end; current++) { |
| 770 CHECK((*current)->IsSmi()); | 770 CHECK((*current)->IsSmi()); |
| 771 } | 771 } |
| 772 } | 772 } |
| 773 } // namespace internal | 773 } // namespace internal |
| 774 } // namespace v8 | 774 } // namespace v8 |
| 775 | 775 |
| 776 #endif // V8_HEAP_HEAP_INL_H_ | 776 #endif // V8_HEAP_HEAP_INL_H_ |
| OLD | NEW |