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 2575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2586 ASSERT(page->area_size() >= object_size); | 2586 ASSERT(page->area_size() >= object_size); |
2587 | 2587 |
2588 size_ += static_cast<int>(page->size()); | 2588 size_ += static_cast<int>(page->size()); |
2589 objects_size_ += object_size; | 2589 objects_size_ += object_size; |
2590 page_count_++; | 2590 page_count_++; |
2591 page->set_next_page(first_page_); | 2591 page->set_next_page(first_page_); |
2592 first_page_ = page; | 2592 first_page_ = page; |
2593 | 2593 |
2594 // Register all MemoryChunk::kAlignment-aligned chunks covered by | 2594 // Register all MemoryChunk::kAlignment-aligned chunks covered by |
2595 // this large page in the chunk map. | 2595 // this large page in the chunk map. |
2596 uintptr_t base = reinterpret_cast<uintptr_t>(page)/MemoryChunk::kAlignment; | 2596 uintptr_t base = reinterpret_cast<uintptr_t>(page) / MemoryChunk::kAlignment; |
2597 uintptr_t limit = base + (page->size()-1)/MemoryChunk::kAlignment; | 2597 uintptr_t limit = base + (page->size() - 1) / MemoryChunk::kAlignment; |
2598 for (uintptr_t key = base; key <= limit; key++) { | 2598 for (uintptr_t key = base; key <= limit; key++) { |
2599 HashMap::Entry* entry = chunk_map_.Lookup(reinterpret_cast<void*>(key), | 2599 HashMap::Entry* entry = chunk_map_.Lookup(reinterpret_cast<void*>(key), |
2600 key, true); | 2600 static_cast<uint32_t>(key), |
| 2601 true); |
2601 ASSERT(entry != NULL); | 2602 ASSERT(entry != NULL); |
2602 entry->value = page; | 2603 entry->value = page; |
2603 } | 2604 } |
2604 | 2605 |
2605 HeapObject* object = page->GetObject(); | 2606 HeapObject* object = page->GetObject(); |
2606 | 2607 |
2607 #ifdef DEBUG | 2608 #ifdef DEBUG |
2608 // Make the object consistent so the heap can be vefified in OldSpaceStep. | 2609 // Make the object consistent so the heap can be vefified in OldSpaceStep. |
2609 reinterpret_cast<Object**>(object->address())[0] = | 2610 reinterpret_cast<Object**>(object->address())[0] = |
2610 heap()->fixed_array_map(); | 2611 heap()->fixed_array_map(); |
(...skipping 11 matching lines...) Expand all Loading... |
2622 if (page != NULL) { | 2623 if (page != NULL) { |
2623 return page->GetObject(); | 2624 return page->GetObject(); |
2624 } | 2625 } |
2625 return Failure::Exception(); | 2626 return Failure::Exception(); |
2626 } | 2627 } |
2627 | 2628 |
2628 | 2629 |
2629 LargePage* LargeObjectSpace::FindPage(Address a) { | 2630 LargePage* LargeObjectSpace::FindPage(Address a) { |
2630 uintptr_t key = reinterpret_cast<uintptr_t>(a) / MemoryChunk::kAlignment; | 2631 uintptr_t key = reinterpret_cast<uintptr_t>(a) / MemoryChunk::kAlignment; |
2631 HashMap::Entry* e = chunk_map_.Lookup(reinterpret_cast<void*>(key), | 2632 HashMap::Entry* e = chunk_map_.Lookup(reinterpret_cast<void*>(key), |
2632 key, false); | 2633 static_cast<uint32_t>(key), |
| 2634 false); |
2633 if (e != NULL) { | 2635 if (e != NULL) { |
2634 ASSERT(e->value != NULL); | 2636 ASSERT(e->value != NULL); |
2635 LargePage* page = reinterpret_cast<LargePage*>(e->value); | 2637 LargePage* page = reinterpret_cast<LargePage*>(e->value); |
2636 ASSERT(page->is_valid()); | 2638 ASSERT(page->is_valid()); |
2637 if (page->Contains(a)) { | 2639 if (page->Contains(a)) { |
2638 return page; | 2640 return page; |
2639 } | 2641 } |
2640 } | 2642 } |
2641 return NULL; | 2643 return NULL; |
2642 } | 2644 } |
(...skipping 30 matching lines...) Expand all Loading... |
2673 objects_size_ -= object->Size(); | 2675 objects_size_ -= object->Size(); |
2674 page_count_--; | 2676 page_count_--; |
2675 | 2677 |
2676 // Remove entries belonging to this page. | 2678 // Remove entries belonging to this page. |
2677 // Use variable alignment to help pass length check (<= 80 characters) | 2679 // Use variable alignment to help pass length check (<= 80 characters) |
2678 // of single line in tools/presubmit.py. | 2680 // of single line in tools/presubmit.py. |
2679 const intptr_t alignment = MemoryChunk::kAlignment; | 2681 const intptr_t alignment = MemoryChunk::kAlignment; |
2680 uintptr_t base = reinterpret_cast<uintptr_t>(page)/alignment; | 2682 uintptr_t base = reinterpret_cast<uintptr_t>(page)/alignment; |
2681 uintptr_t limit = base + (page->size()-1)/alignment; | 2683 uintptr_t limit = base + (page->size()-1)/alignment; |
2682 for (uintptr_t key = base; key <= limit; key++) { | 2684 for (uintptr_t key = base; key <= limit; key++) { |
2683 chunk_map_.Remove(reinterpret_cast<void*>(key), key); | 2685 chunk_map_.Remove(reinterpret_cast<void*>(key), |
| 2686 static_cast<uint32_t>(key)); |
2684 } | 2687 } |
2685 | 2688 |
2686 if (is_pointer_object) { | 2689 if (is_pointer_object) { |
2687 heap()->QueueMemoryChunkForFree(page); | 2690 heap()->QueueMemoryChunkForFree(page); |
2688 } else { | 2691 } else { |
2689 heap()->isolate()->memory_allocator()->Free(page); | 2692 heap()->isolate()->memory_allocator()->Free(page); |
2690 } | 2693 } |
2691 } | 2694 } |
2692 } | 2695 } |
2693 heap()->FreeQueuedChunks(); | 2696 heap()->FreeQueuedChunks(); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2811 object->ShortPrint(); | 2814 object->ShortPrint(); |
2812 PrintF("\n"); | 2815 PrintF("\n"); |
2813 } | 2816 } |
2814 printf(" --------------------------------------\n"); | 2817 printf(" --------------------------------------\n"); |
2815 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 2818 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
2816 } | 2819 } |
2817 | 2820 |
2818 #endif // DEBUG | 2821 #endif // DEBUG |
2819 | 2822 |
2820 } } // namespace v8::internal | 2823 } } // namespace v8::internal |
OLD | NEW |