| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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_SPACES_INL_H_ | 5 #ifndef V8_HEAP_SPACES_INL_H_ |
| 6 #define V8_HEAP_SPACES_INL_H_ | 6 #define V8_HEAP_SPACES_INL_H_ |
| 7 | 7 |
| 8 #include "src/heap/incremental-marking.h" | 8 #include "src/heap/incremental-marking.h" |
| 9 #include "src/heap/spaces.h" | 9 #include "src/heap/spaces.h" |
| 10 #include "src/isolate.h" | 10 #include "src/isolate.h" |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 bool PagedSpace::Contains(Address addr) { | 209 bool PagedSpace::Contains(Address addr) { |
| 210 Page* p = Page::FromAddress(addr); | 210 Page* p = Page::FromAddress(addr); |
| 211 if (!p->is_valid()) return false; | 211 if (!p->is_valid()) return false; |
| 212 return p->owner() == this; | 212 return p->owner() == this; |
| 213 } | 213 } |
| 214 | 214 |
| 215 | 215 |
| 216 bool PagedSpace::Contains(HeapObject* o) { return Contains(o->address()); } | 216 bool PagedSpace::Contains(HeapObject* o) { return Contains(o->address()); } |
| 217 | 217 |
| 218 | 218 |
| 219 void MemoryChunk::set_scan_on_scavenge(bool scan) { | |
| 220 if (scan) { | |
| 221 if (!scan_on_scavenge()) heap_->increment_scan_on_scavenge_pages(); | |
| 222 SetFlag(SCAN_ON_SCAVENGE); | |
| 223 } else { | |
| 224 if (scan_on_scavenge()) heap_->decrement_scan_on_scavenge_pages(); | |
| 225 ClearFlag(SCAN_ON_SCAVENGE); | |
| 226 } | |
| 227 heap_->incremental_marking()->SetOldSpacePageFlags(this); | |
| 228 } | |
| 229 | |
| 230 | |
| 231 MemoryChunk* MemoryChunk::FromAnyPointerAddress(Heap* heap, Address addr) { | 219 MemoryChunk* MemoryChunk::FromAnyPointerAddress(Heap* heap, Address addr) { |
| 232 MemoryChunk* maybe = reinterpret_cast<MemoryChunk*>( | 220 MemoryChunk* maybe = reinterpret_cast<MemoryChunk*>( |
| 233 OffsetFrom(addr) & ~Page::kPageAlignmentMask); | 221 OffsetFrom(addr) & ~Page::kPageAlignmentMask); |
| 234 if (maybe->owner() != NULL) return maybe; | 222 if (maybe->owner() != NULL) return maybe; |
| 235 LargeObjectIterator iterator(heap->lo_space()); | 223 LargeObjectIterator iterator(heap->lo_space()); |
| 236 for (HeapObject* o = iterator.Next(); o != NULL; o = iterator.Next()) { | 224 for (HeapObject* o = iterator.Next(); o != NULL; o = iterator.Next()) { |
| 237 // Fixed arrays are the only pointer-containing objects in large object | 225 // Fixed arrays are the only pointer-containing objects in large object |
| 238 // space. | 226 // space. |
| 239 if (o->IsFixedArray()) { | 227 if (o->IsFixedArray()) { |
| 240 MemoryChunk* chunk = MemoryChunk::FromAddress(o->address()); | 228 MemoryChunk* chunk = MemoryChunk::FromAddress(o->address()); |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 other->allocation_info_.Reset(nullptr, nullptr); | 532 other->allocation_info_.Reset(nullptr, nullptr); |
| 545 return true; | 533 return true; |
| 546 } | 534 } |
| 547 return false; | 535 return false; |
| 548 } | 536 } |
| 549 | 537 |
| 550 } // namespace internal | 538 } // namespace internal |
| 551 } // namespace v8 | 539 } // namespace v8 |
| 552 | 540 |
| 553 #endif // V8_HEAP_SPACES_INL_H_ | 541 #endif // V8_HEAP_SPACES_INL_H_ |
| OLD | NEW |