| 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 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 Page* page = Page::FromAddress(old_address); | 495 Page* page = Page::FromAddress(old_address); |
| 496 Address age_mark = new_space_->age_mark(); | 496 Address age_mark = new_space_->age_mark(); |
| 497 return page->IsFlagSet(MemoryChunk::NEW_SPACE_BELOW_AGE_MARK) && | 497 return page->IsFlagSet(MemoryChunk::NEW_SPACE_BELOW_AGE_MARK) && |
| 498 (!page->ContainsLimit(age_mark) || old_address < age_mark); | 498 (!page->ContainsLimit(age_mark) || old_address < age_mark); |
| 499 } | 499 } |
| 500 | 500 |
| 501 void Heap::RecordWrite(Object* object, int offset, Object* o) { | 501 void Heap::RecordWrite(Object* object, int offset, Object* o) { |
| 502 if (!InNewSpace(o) || !object->IsHeapObject() || InNewSpace(object)) { | 502 if (!InNewSpace(o) || !object->IsHeapObject() || InNewSpace(object)) { |
| 503 return; | 503 return; |
| 504 } | 504 } |
| 505 RememberedSet<OLD_TO_NEW>::Insert( | 505 store_buffer()->InsertEntry(HeapObject::cast(object)->address() + offset); |
| 506 Page::FromAddress(reinterpret_cast<Address>(object)), | |
| 507 HeapObject::cast(object)->address() + offset); | |
| 508 } | 506 } |
| 509 | 507 |
| 510 void Heap::RecordWriteIntoCode(Code* host, RelocInfo* rinfo, Object* value) { | 508 void Heap::RecordWriteIntoCode(Code* host, RelocInfo* rinfo, Object* value) { |
| 511 if (InNewSpace(value)) { | 509 if (InNewSpace(value)) { |
| 512 RecordWriteIntoCodeSlow(host, rinfo, value); | 510 RecordWriteIntoCodeSlow(host, rinfo, value); |
| 513 } | 511 } |
| 514 } | 512 } |
| 515 | 513 |
| 516 void Heap::RecordFixedArrayElements(FixedArray* array, int offset, int length) { | 514 void Heap::RecordFixedArrayElements(FixedArray* array, int offset, int length) { |
| 517 if (InNewSpace(array)) return; | 515 if (InNewSpace(array)) return; |
| 518 Page* page = Page::FromAddress(reinterpret_cast<Address>(array)); | |
| 519 for (int i = 0; i < length; i++) { | 516 for (int i = 0; i < length; i++) { |
| 520 if (!InNewSpace(array->get(offset + i))) continue; | 517 if (!InNewSpace(array->get(offset + i))) continue; |
| 521 RememberedSet<OLD_TO_NEW>::Insert( | 518 store_buffer()->InsertEntry( |
| 522 page, | |
| 523 reinterpret_cast<Address>(array->RawFieldOfElementAt(offset + i))); | 519 reinterpret_cast<Address>(array->RawFieldOfElementAt(offset + i))); |
| 524 } | 520 } |
| 525 } | 521 } |
| 526 | 522 |
| 527 Address* Heap::store_buffer_top_address() { | 523 Address* Heap::store_buffer_top_address() { |
| 528 return store_buffer()->top_address(); | 524 return store_buffer()->top_address(); |
| 529 } | 525 } |
| 530 | 526 |
| 531 bool Heap::AllowedToBeMigrated(HeapObject* obj, AllocationSpace dst) { | 527 bool Heap::AllowedToBeMigrated(HeapObject* obj, AllocationSpace dst) { |
| 532 // Object migration is governed by the following rules: | 528 // Object migration is governed by the following rules: |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 850 | 846 |
| 851 void VerifySmisVisitor::VisitPointers(Object** start, Object** end) { | 847 void VerifySmisVisitor::VisitPointers(Object** start, Object** end) { |
| 852 for (Object** current = start; current < end; current++) { | 848 for (Object** current = start; current < end; current++) { |
| 853 CHECK((*current)->IsSmi()); | 849 CHECK((*current)->IsSmi()); |
| 854 } | 850 } |
| 855 } | 851 } |
| 856 } // namespace internal | 852 } // namespace internal |
| 857 } // namespace v8 | 853 } // namespace v8 |
| 858 | 854 |
| 859 #endif // V8_HEAP_HEAP_INL_H_ | 855 #endif // V8_HEAP_HEAP_INL_H_ |
| OLD | NEW |