Chromium Code Reviews| 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 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 392 NewSpacePage* page = NewSpacePage::FromAddress(old_address); | 392 NewSpacePage* page = NewSpacePage::FromAddress(old_address); |
| 393 Address age_mark = new_space_.age_mark(); | 393 Address age_mark = new_space_.age_mark(); |
| 394 return page->IsFlagSet(MemoryChunk::NEW_SPACE_BELOW_AGE_MARK) && | 394 return page->IsFlagSet(MemoryChunk::NEW_SPACE_BELOW_AGE_MARK) && |
| 395 (!page->ContainsLimit(age_mark) || old_address < age_mark); | 395 (!page->ContainsLimit(age_mark) || old_address < age_mark); |
| 396 } | 396 } |
| 397 | 397 |
| 398 void Heap::RecordWrite(Object* object, int offset, Object* o) { | 398 void Heap::RecordWrite(Object* object, int offset, Object* o) { |
| 399 if (!InNewSpace(o) || !object->IsHeapObject() || InNewSpace(object)) { | 399 if (!InNewSpace(o) || !object->IsHeapObject() || InNewSpace(object)) { |
| 400 return; | 400 return; |
| 401 } | 401 } |
| 402 Page* page = Page::FromAddress(reinterpret_cast<Address>(object)); | 402 RememberedSet<OLD_TO_NEW>::Insert( |
| 403 Address slot = HeapObject::cast(object)->address() + offset; | 403 Page::FromAddress(reinterpret_cast<Address>(object)), |
| 404 RememberedSet<OLD_TO_NEW>::Insert(page, slot); | 404 HeapObject::cast(object)->address() + offset); |
| 405 } | |
| 406 | |
| 407 void Heap::RecordFixedArrayElements(FixedArray* array, int offset, int length) { | |
| 408 if (InNewSpace(array)) return; | |
| 409 Page* page = Page::FromAddress(reinterpret_cast<Address>(array)); | |
| 410 for (int i = 0; i < length; i++) { | |
| 411 if (!InNewSpace(array->get(i))) continue; | |
|
ulan
2016/04/11 12:49:23
This should be if (!InNewSpace(array->get(offset +
| |
| 412 RememberedSet<OLD_TO_NEW>::Insert( | |
| 413 page, | |
| 414 reinterpret_cast<Address>(array->RawFieldOfElementAt(offset + i))); | |
| 415 } | |
| 405 } | 416 } |
| 406 | 417 |
| 407 | 418 |
| 408 bool Heap::AllowedToBeMigrated(HeapObject* obj, AllocationSpace dst) { | 419 bool Heap::AllowedToBeMigrated(HeapObject* obj, AllocationSpace dst) { |
| 409 // Object migration is governed by the following rules: | 420 // Object migration is governed by the following rules: |
| 410 // | 421 // |
| 411 // 1) Objects in new-space can be migrated to the old space | 422 // 1) Objects in new-space can be migrated to the old space |
| 412 // that matches their target space or they stay in new-space. | 423 // that matches their target space or they stay in new-space. |
| 413 // 2) Objects in old-space stay in the same space when migrating. | 424 // 2) Objects in old-space stay in the same space when migrating. |
| 414 // 3) Fillers (two or more words) can migrate due to left-trimming of | 425 // 3) Fillers (two or more words) can migrate due to left-trimming of |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 717 | 728 |
| 718 void VerifySmisVisitor::VisitPointers(Object** start, Object** end) { | 729 void VerifySmisVisitor::VisitPointers(Object** start, Object** end) { |
| 719 for (Object** current = start; current < end; current++) { | 730 for (Object** current = start; current < end; current++) { |
| 720 CHECK((*current)->IsSmi()); | 731 CHECK((*current)->IsSmi()); |
| 721 } | 732 } |
| 722 } | 733 } |
| 723 } // namespace internal | 734 } // namespace internal |
| 724 } // namespace v8 | 735 } // namespace v8 |
| 725 | 736 |
| 726 #endif // V8_HEAP_HEAP_INL_H_ | 737 #endif // V8_HEAP_HEAP_INL_H_ |
| OLD | NEW |