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 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 } | 475 } |
476 UNREACHABLE(); | 476 UNREACHABLE(); |
477 return false; | 477 return false; |
478 } | 478 } |
479 | 479 |
480 void Heap::CopyBlock(Address dst, Address src, int byte_size) { | 480 void Heap::CopyBlock(Address dst, Address src, int byte_size) { |
481 CopyWords(reinterpret_cast<Object**>(dst), reinterpret_cast<Object**>(src), | 481 CopyWords(reinterpret_cast<Object**>(dst), reinterpret_cast<Object**>(src), |
482 static_cast<size_t>(byte_size / kPointerSize)); | 482 static_cast<size_t>(byte_size / kPointerSize)); |
483 } | 483 } |
484 | 484 |
485 bool Heap::PurgeLeftTrimmedObject(Object** object) { | |
486 HeapObject* current = reinterpret_cast<HeapObject*>(*object); | |
487 const MapWord map_word = current->map_word(); | |
488 if (current->IsFiller() && !map_word.IsForwardingAddress()) { | |
489 #ifdef DEBUG | |
490 // We need to find a FixedArrayBase map after walking the fillers. | |
491 while (current->IsFiller()) { | |
492 Address next = reinterpret_cast<Address>(current); | |
493 if (current->map() == one_pointer_filler_map()) { | |
494 next += kPointerSize; | |
495 } else if (current->map() == two_pointer_filler_map()) { | |
496 next += 2 * kPointerSize; | |
497 } else { | |
498 next += current->Size(); | |
499 } | |
500 current = reinterpret_cast<HeapObject*>(next); | |
501 } | |
502 DCHECK(current->IsFixedArrayBase()); | |
503 #endif // DEBUG | |
504 *object = nullptr; | |
505 return true; | |
506 } | |
507 return false; | |
508 } | |
509 | |
510 template <Heap::FindMementoMode mode> | 485 template <Heap::FindMementoMode mode> |
511 AllocationMemento* Heap::FindAllocationMemento(HeapObject* object) { | 486 AllocationMemento* Heap::FindAllocationMemento(HeapObject* object) { |
512 // Check if there is potentially a memento behind the object. If | 487 // Check if there is potentially a memento behind the object. If |
513 // the last word of the memento is on another page we return | 488 // the last word of the memento is on another page we return |
514 // immediately. | 489 // immediately. |
515 Address object_address = object->address(); | 490 Address object_address = object->address(); |
516 Address memento_address = object_address + object->Size(); | 491 Address memento_address = object_address + object->Size(); |
517 Address last_memento_word_address = memento_address + kPointerSize; | 492 Address last_memento_word_address = memento_address + kPointerSize; |
518 if (!Page::OnSamePage(object_address, last_memento_word_address)) { | 493 if (!Page::OnSamePage(object_address, last_memento_word_address)) { |
519 return nullptr; | 494 return nullptr; |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
792 | 767 |
793 void VerifySmisVisitor::VisitPointers(Object** start, Object** end) { | 768 void VerifySmisVisitor::VisitPointers(Object** start, Object** end) { |
794 for (Object** current = start; current < end; current++) { | 769 for (Object** current = start; current < end; current++) { |
795 CHECK((*current)->IsSmi()); | 770 CHECK((*current)->IsSmi()); |
796 } | 771 } |
797 } | 772 } |
798 } // namespace internal | 773 } // namespace internal |
799 } // namespace v8 | 774 } // namespace v8 |
800 | 775 |
801 #endif // V8_HEAP_HEAP_INL_H_ | 776 #endif // V8_HEAP_HEAP_INL_H_ |
OLD | NEW |