Chromium Code Reviews| 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)); |
| } |