OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 | 425 |
426 ASSERT(base == chunk->address()); | 426 ASSERT(base == chunk->address()); |
427 | 427 |
428 chunk->heap_ = heap; | 428 chunk->heap_ = heap; |
429 chunk->size_ = size; | 429 chunk->size_ = size; |
430 chunk->flags_ = 0; | 430 chunk->flags_ = 0; |
431 chunk->set_owner(owner); | 431 chunk->set_owner(owner); |
432 chunk->InitializeReservedMemory(); | 432 chunk->InitializeReservedMemory(); |
433 chunk->slots_buffer_ = NULL; | 433 chunk->slots_buffer_ = NULL; |
434 chunk->skip_list_ = NULL; | 434 chunk->skip_list_ = NULL; |
| 435 chunk->ResetLiveBytes(); |
435 Bitmap::Clear(chunk); | 436 Bitmap::Clear(chunk); |
436 chunk->initialize_scan_on_scavenge(false); | 437 chunk->initialize_scan_on_scavenge(false); |
437 chunk->SetFlag(WAS_SWEPT_PRECISELY); | 438 chunk->SetFlag(WAS_SWEPT_PRECISELY); |
438 | 439 |
439 ASSERT(OFFSET_OF(MemoryChunk, flags_) == kFlagsOffset); | 440 ASSERT(OFFSET_OF(MemoryChunk, flags_) == kFlagsOffset); |
440 | 441 |
441 if (executable == EXECUTABLE) chunk->SetFlag(IS_EXECUTABLE); | 442 if (executable == EXECUTABLE) chunk->SetFlag(IS_EXECUTABLE); |
442 | 443 |
443 if (owner == heap->old_data_space()) chunk->SetFlag(CONTAINS_ONLY_DATA); | 444 if (owner == heap->old_data_space()) chunk->SetFlag(CONTAINS_ONLY_DATA); |
444 | 445 |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
815 // All the interior pointers should be contained in the heap. | 816 // All the interior pointers should be contained in the heap. |
816 int size = object->Size(); | 817 int size = object->Size(); |
817 object->IterateBody(map->instance_type(), size, visitor); | 818 object->IterateBody(map->instance_type(), size, visitor); |
818 if (Marking::IsBlack(Marking::MarkBitFrom(object))) { | 819 if (Marking::IsBlack(Marking::MarkBitFrom(object))) { |
819 black_size += size; | 820 black_size += size; |
820 } | 821 } |
821 | 822 |
822 ASSERT(object->address() + size <= top); | 823 ASSERT(object->address() + size <= top); |
823 end_of_previous_object = object->address() + size; | 824 end_of_previous_object = object->address() + size; |
824 } | 825 } |
825 // TODO(1672): Page live bytes are off for some tests. | 826 |
826 // CHECK_LE(black_size, page->LiveBytes()); | 827 CHECK_LE(black_size, page->LiveBytes()); |
827 } | 828 } |
828 } | 829 } |
829 #endif | 830 #endif |
830 | 831 |
831 | 832 |
832 // ----------------------------------------------------------------------------- | 833 // ----------------------------------------------------------------------------- |
833 // NewSpace implementation | 834 // NewSpace implementation |
834 | 835 |
835 | 836 |
836 bool NewSpace::Setup(int reserved_semispace_capacity, | 837 bool NewSpace::Setup(int reserved_semispace_capacity, |
(...skipping 1660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2497 void LargeObjectSpace::CollectCodeStatistics() { | 2498 void LargeObjectSpace::CollectCodeStatistics() { |
2498 Isolate* isolate = heap()->isolate(); | 2499 Isolate* isolate = heap()->isolate(); |
2499 LargeObjectIterator obj_it(this); | 2500 LargeObjectIterator obj_it(this); |
2500 for (HeapObject* obj = obj_it.Next(); obj != NULL; obj = obj_it.Next()) { | 2501 for (HeapObject* obj = obj_it.Next(); obj != NULL; obj = obj_it.Next()) { |
2501 if (obj->IsCode()) { | 2502 if (obj->IsCode()) { |
2502 Code* code = Code::cast(obj); | 2503 Code* code = Code::cast(obj); |
2503 isolate->code_kind_statistics()[code->kind()] += code->Size(); | 2504 isolate->code_kind_statistics()[code->kind()] += code->Size(); |
2504 } | 2505 } |
2505 } | 2506 } |
2506 } | 2507 } |
| 2508 |
| 2509 |
| 2510 void Page::Print() { |
| 2511 // Make a best-effort to print the objects in the page. |
| 2512 PrintF("Page@%p in %s\n", |
| 2513 this->address(), |
| 2514 AllocationSpaceName(this->owner()->identity())); |
| 2515 printf(" --------------------------------------\n"); |
| 2516 HeapObjectIterator objects(this, heap()->GcSafeSizeOfOldObjectFunction()); |
| 2517 unsigned mark_size = 0; |
| 2518 for (HeapObject* object = objects.Next(); |
| 2519 object != NULL; |
| 2520 object = objects.Next()) { |
| 2521 bool is_marked = Marking::MarkBitFrom(object).Get(); |
| 2522 PrintF(" %c ", (is_marked ? '!' : ' ')); // Indent a little. |
| 2523 if (is_marked) { |
| 2524 mark_size += heap()->GcSafeSizeOfOldObjectFunction()(object); |
| 2525 } |
| 2526 object->ShortPrint(); |
| 2527 PrintF("\n"); |
| 2528 } |
| 2529 printf(" --------------------------------------\n"); |
| 2530 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
| 2531 } |
| 2532 |
2507 #endif // DEBUG | 2533 #endif // DEBUG |
2508 | 2534 |
2509 } } // namespace v8::internal | 2535 } } // namespace v8::internal |
OLD | NEW |