| 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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 PrintIsolate( | 242 PrintIsolate( |
| 243 heap()->isolate(), "live-bytes: update page=%p delta=%d %d->%d\n", | 243 heap()->isolate(), "live-bytes: update page=%p delta=%d %d->%d\n", |
| 244 static_cast<void*>(this), by, live_byte_count_, live_byte_count_ + by); | 244 static_cast<void*>(this), by, live_byte_count_, live_byte_count_ + by); |
| 245 } | 245 } |
| 246 live_byte_count_ += by; | 246 live_byte_count_ += by; |
| 247 DCHECK_GE(live_byte_count_, 0); | 247 DCHECK_GE(live_byte_count_, 0); |
| 248 DCHECK_LE(static_cast<size_t>(live_byte_count_), size_); | 248 DCHECK_LE(static_cast<size_t>(live_byte_count_), size_); |
| 249 } | 249 } |
| 250 | 250 |
| 251 bool PagedSpace::Contains(Address addr) { | 251 bool PagedSpace::Contains(Address addr) { |
| 252 Page* p = Page::FromAddress(addr); | 252 return MemoryChunk::FromAnyPointerAddress(heap(), addr)->owner() == this; |
| 253 if (!Page::IsValid(p)) return false; | |
| 254 return p->owner() == this; | |
| 255 } | 253 } |
| 256 | 254 |
| 257 bool PagedSpace::Contains(Object* o) { | 255 bool PagedSpace::Contains(Object* o) { |
| 258 if (!o->IsHeapObject()) return false; | 256 if (!o->IsHeapObject()) return false; |
| 259 Page* p = Page::FromAddress(HeapObject::cast(o)->address()); | 257 Page* p = Page::FromAddress(HeapObject::cast(o)->address()); |
| 260 if (!Page::IsValid(p)) return false; | 258 if (!Page::IsValid(p)) return false; |
| 261 return p->owner() == this; | 259 return p->owner() == this; |
| 262 } | 260 } |
| 263 | 261 |
| 264 void PagedSpace::UnlinkFreeListCategories(Page* page) { | 262 void PagedSpace::UnlinkFreeListCategories(Page* page) { |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 other->allocation_info_.Reset(nullptr, nullptr); | 622 other->allocation_info_.Reset(nullptr, nullptr); |
| 625 return true; | 623 return true; |
| 626 } | 624 } |
| 627 return false; | 625 return false; |
| 628 } | 626 } |
| 629 | 627 |
| 630 } // namespace internal | 628 } // namespace internal |
| 631 } // namespace v8 | 629 } // namespace v8 |
| 632 | 630 |
| 633 #endif // V8_HEAP_SPACES_INL_H_ | 631 #endif // V8_HEAP_SPACES_INL_H_ |
| OLD | NEW |