| 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 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 case CODE_SPACE: | 431 case CODE_SPACE: |
| 432 return dst == src && type == CODE_TYPE; | 432 return dst == src && type == CODE_TYPE; |
| 433 case MAP_SPACE: | 433 case MAP_SPACE: |
| 434 case LO_SPACE: | 434 case LO_SPACE: |
| 435 return false; | 435 return false; |
| 436 } | 436 } |
| 437 UNREACHABLE(); | 437 UNREACHABLE(); |
| 438 return false; | 438 return false; |
| 439 } | 439 } |
| 440 | 440 |
| 441 | |
| 442 void Heap::CopyBlock(Address dst, Address src, int byte_size) { | 441 void Heap::CopyBlock(Address dst, Address src, int byte_size) { |
| 443 CopyWords(reinterpret_cast<Object**>(dst), reinterpret_cast<Object**>(src), | 442 CopyWords(reinterpret_cast<Object**>(dst), reinterpret_cast<Object**>(src), |
| 444 static_cast<size_t>(byte_size / kPointerSize)); | 443 static_cast<size_t>(byte_size / kPointerSize)); |
| 445 } | 444 } |
| 446 | 445 |
| 447 | |
| 448 void Heap::MoveBlock(Address dst, Address src, int byte_size) { | |
| 449 DCHECK(IsAligned(byte_size, kPointerSize)); | |
| 450 | |
| 451 int size_in_words = byte_size / kPointerSize; | |
| 452 | |
| 453 if ((dst < src) || (dst >= (src + byte_size))) { | |
| 454 Object** src_slot = reinterpret_cast<Object**>(src); | |
| 455 Object** dst_slot = reinterpret_cast<Object**>(dst); | |
| 456 Object** end_slot = src_slot + size_in_words; | |
| 457 | |
| 458 while (src_slot != end_slot) { | |
| 459 *dst_slot++ = *src_slot++; | |
| 460 } | |
| 461 } else { | |
| 462 MemMove(dst, src, static_cast<size_t>(byte_size)); | |
| 463 } | |
| 464 } | |
| 465 | |
| 466 template <Heap::FindMementoMode mode> | 446 template <Heap::FindMementoMode mode> |
| 467 AllocationMemento* Heap::FindAllocationMemento(HeapObject* object) { | 447 AllocationMemento* Heap::FindAllocationMemento(HeapObject* object) { |
| 468 // Check if there is potentially a memento behind the object. If | 448 // Check if there is potentially a memento behind the object. If |
| 469 // the last word of the memento is on another page we return | 449 // the last word of the memento is on another page we return |
| 470 // immediately. | 450 // immediately. |
| 471 Address object_address = object->address(); | 451 Address object_address = object->address(); |
| 472 Address memento_address = object_address + object->Size(); | 452 Address memento_address = object_address + object->Size(); |
| 473 Address last_memento_word_address = memento_address + kPointerSize; | 453 Address last_memento_word_address = memento_address + kPointerSize; |
| 474 if (!NewSpacePage::OnSamePage(object_address, last_memento_word_address)) { | 454 if (!NewSpacePage::OnSamePage(object_address, last_memento_word_address)) { |
| 475 return nullptr; | 455 return nullptr; |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 737 | 717 |
| 738 void VerifySmisVisitor::VisitPointers(Object** start, Object** end) { | 718 void VerifySmisVisitor::VisitPointers(Object** start, Object** end) { |
| 739 for (Object** current = start; current < end; current++) { | 719 for (Object** current = start; current < end; current++) { |
| 740 CHECK((*current)->IsSmi()); | 720 CHECK((*current)->IsSmi()); |
| 741 } | 721 } |
| 742 } | 722 } |
| 743 } // namespace internal | 723 } // namespace internal |
| 744 } // namespace v8 | 724 } // namespace v8 |
| 745 | 725 |
| 746 #endif // V8_HEAP_HEAP_INL_H_ | 726 #endif // V8_HEAP_HEAP_INL_H_ |
| OLD | NEW |