| 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 #include "src/heap/spaces.h" | 5 #include "src/heap/spaces.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/base/platform/platform.h" | 10 #include "src/base/platform/platform.h" |
| (...skipping 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1280 } | 1280 } |
| 1281 | 1281 |
| 1282 bool PagedSpace::ContainsSlow(Address addr) { | 1282 bool PagedSpace::ContainsSlow(Address addr) { |
| 1283 Page* p = Page::FromAddress(addr); | 1283 Page* p = Page::FromAddress(addr); |
| 1284 for (Page* page : *this) { | 1284 for (Page* page : *this) { |
| 1285 if (page == p) return true; | 1285 if (page == p) return true; |
| 1286 } | 1286 } |
| 1287 return false; | 1287 return false; |
| 1288 } | 1288 } |
| 1289 | 1289 |
| 1290 | |
| 1291 Object* PagedSpace::FindObject(Address addr) { | |
| 1292 // Note: this function can only be called on iterable spaces. | |
| 1293 DCHECK(!heap()->mark_compact_collector()->in_use()); | |
| 1294 | |
| 1295 if (!Contains(addr)) return Smi::kZero; // Signaling not found. | |
| 1296 | |
| 1297 Page* p = Page::FromAddress(addr); | |
| 1298 HeapObjectIterator it(p); | |
| 1299 for (HeapObject* obj = it.Next(); obj != NULL; obj = it.Next()) { | |
| 1300 Address cur = obj->address(); | |
| 1301 Address next = cur + obj->Size(); | |
| 1302 if ((cur <= addr) && (addr < next)) return obj; | |
| 1303 } | |
| 1304 | |
| 1305 UNREACHABLE(); | |
| 1306 return Smi::kZero; | |
| 1307 } | |
| 1308 | |
| 1309 void PagedSpace::ShrinkImmortalImmovablePages() { | 1290 void PagedSpace::ShrinkImmortalImmovablePages() { |
| 1310 DCHECK(!heap()->deserialization_complete()); | 1291 DCHECK(!heap()->deserialization_complete()); |
| 1311 MemoryChunk::UpdateHighWaterMark(allocation_info_.top()); | 1292 MemoryChunk::UpdateHighWaterMark(allocation_info_.top()); |
| 1312 EmptyAllocationInfo(); | 1293 EmptyAllocationInfo(); |
| 1313 ResetFreeList(); | 1294 ResetFreeList(); |
| 1314 | 1295 |
| 1315 for (Page* page : *this) { | 1296 for (Page* page : *this) { |
| 1316 DCHECK(page->IsFlagSet(Page::NEVER_EVACUATE)); | 1297 DCHECK(page->IsFlagSet(Page::NEVER_EVACUATE)); |
| 1317 size_t unused = page->ShrinkToHighWaterMark(); | 1298 size_t unused = page->ShrinkToHighWaterMark(); |
| 1318 accounting_stats_.DecreaseCapacity(static_cast<intptr_t>(unused)); | 1299 accounting_stats_.DecreaseCapacity(static_cast<intptr_t>(unused)); |
| (...skipping 1928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3247 object->ShortPrint(); | 3228 object->ShortPrint(); |
| 3248 PrintF("\n"); | 3229 PrintF("\n"); |
| 3249 } | 3230 } |
| 3250 printf(" --------------------------------------\n"); | 3231 printf(" --------------------------------------\n"); |
| 3251 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3232 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
| 3252 } | 3233 } |
| 3253 | 3234 |
| 3254 #endif // DEBUG | 3235 #endif // DEBUG |
| 3255 } // namespace internal | 3236 } // namespace internal |
| 3256 } // namespace v8 | 3237 } // namespace v8 |
| OLD | NEW |