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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: src/heap/spaces-inl.h
diff --git a/src/heap/spaces-inl.h b/src/heap/spaces-inl.h
index d578055229cf4638bba94097bd4e89ad7492234a..c1b3347ddb52acef9b3b6f63de19a0159f4e8dce 100644
--- a/src/heap/spaces-inl.h
+++ b/src/heap/spaces-inl.h
@@ -296,22 +296,16 @@ bool PagedSpace::Contains(Object* o) {
}
MemoryChunk* MemoryChunk::FromAnyPointerAddress(Heap* heap, Address addr) {
- MemoryChunk* maybe = reinterpret_cast<MemoryChunk*>(
- OffsetFrom(addr) & ~Page::kPageAlignmentMask);
- if (maybe->owner() != NULL) return maybe;
- LargeObjectIterator iterator(heap->lo_space());
- for (HeapObject* o = iterator.Next(); o != NULL; o = iterator.Next()) {
- // Fixed arrays are the only pointer-containing objects in large object
- // space.
- if (o->IsFixedArray()) {
- MemoryChunk* chunk = MemoryChunk::FromAddress(o->address());
- if (chunk->Contains(addr)) {
- return chunk;
- }
- }
+ MemoryChunk* chunk = MemoryChunk::FromAddress(addr);
+ uintptr_t offset = addr - chunk->address();
+ if (offset < MemoryChunk::kHeaderSize || chunk->owner() == nullptr) {
Hannes Payer (out of office) 2016/02/15 16:53:39 We already check somewhere else for LO page with o
ulan 2016/02/16 10:24:52 I added HasPageHeader predicate to chunk, which is
+ chunk = heap->lo_space()->FindPage(addr);
}
- UNREACHABLE();
- return NULL;
+ return chunk;
+}
+
+Page* Page::FromAnyPointerAddress(Heap* heap, Address addr) {
+ return static_cast<Page*>(MemoryChunk::FromAnyPointerAddress(heap, addr));
}
« src/heap/remembered-set.cc ('K') | « src/heap/spaces.cc ('k') | src/heap/store-buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698