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