Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(914)

Side by Side Diff: src/heap/spaces-inl.h

Issue 1683653002: Add a generic remembered set class. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 } 259 }
260 260
261 bool PagedSpace::Contains(Object* o) { 261 bool PagedSpace::Contains(Object* o) {
262 if (!o->IsHeapObject()) return false; 262 if (!o->IsHeapObject()) return false;
263 Page* p = Page::FromAddress(HeapObject::cast(o)->address()); 263 Page* p = Page::FromAddress(HeapObject::cast(o)->address());
264 if (!p->is_valid()) return false; 264 if (!p->is_valid()) return false;
265 return p->owner() == this; 265 return p->owner() == this;
266 } 266 }
267 267
268 MemoryChunk* MemoryChunk::FromAnyPointerAddress(Heap* heap, Address addr) { 268 MemoryChunk* MemoryChunk::FromAnyPointerAddress(Heap* heap, Address addr) {
269 MemoryChunk* maybe = reinterpret_cast<MemoryChunk*>( 269 MemoryChunk* chunk = MemoryChunk::FromAddress(addr);
270 OffsetFrom(addr) & ~Page::kPageAlignmentMask); 270 uintptr_t offset = addr - chunk->address();
271 if (maybe->owner() != NULL) return maybe; 271 if (offset < MemoryChunk::kHeaderSize || chunk->owner() == nullptr) {
272 LargeObjectIterator iterator(heap->lo_space()); 272 chunk = heap->lo_space()->FindPage(addr);
273 for (HeapObject* o = iterator.Next(); o != NULL; o = iterator.Next()) {
274 // Fixed arrays are the only pointer-containing objects in large object
275 // space.
276 if (o->IsFixedArray()) {
277 MemoryChunk* chunk = MemoryChunk::FromAddress(o->address());
278 if (chunk->Contains(addr)) {
279 return chunk;
280 }
281 }
282 } 273 }
283 UNREACHABLE(); 274 return chunk;
284 return NULL; 275 }
276
277 Page* Page::FromAnyPointerAddress(Heap* heap, Address addr) {
278 return static_cast<Page*>(MemoryChunk::FromAnyPointerAddress(heap, addr));
285 } 279 }
286 280
287 281
288 PointerChunkIterator::PointerChunkIterator(Heap* heap) 282 PointerChunkIterator::PointerChunkIterator(Heap* heap)
289 : state_(kOldSpaceState), 283 : state_(kOldSpaceState),
290 old_iterator_(heap->old_space()), 284 old_iterator_(heap->old_space()),
291 map_iterator_(heap->map_space()), 285 map_iterator_(heap->map_space()),
292 lo_iterator_(heap->lo_space()) {} 286 lo_iterator_(heap->lo_space()) {}
293 287
294 288
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 other->allocation_info_.Reset(nullptr, nullptr); 575 other->allocation_info_.Reset(nullptr, nullptr);
582 return true; 576 return true;
583 } 577 }
584 return false; 578 return false;
585 } 579 }
586 580
587 } // namespace internal 581 } // namespace internal
588 } // namespace v8 582 } // namespace v8
589 583
590 #endif // V8_HEAP_SPACES_INL_H_ 584 #endif // V8_HEAP_SPACES_INL_H_
OLDNEW
« no previous file with comments | « src/heap/spaces.cc ('k') | src/heap/store-buffer.h » ('j') | src/heap/store-buffer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698