| 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/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
| 8 #include "src/base/platform/platform.h" | 8 #include "src/base/platform/platform.h" |
| 9 #include "src/full-codegen.h" | 9 #include "src/full-codegen.h" |
| 10 #include "src/heap/mark-compact.h" | 10 #include "src/heap/mark-compact.h" |
| (...skipping 2973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2984 } else { | 2984 } else { |
| 2985 LargePage* page = current; | 2985 LargePage* page = current; |
| 2986 // Cut the chunk out from the chunk list. | 2986 // Cut the chunk out from the chunk list. |
| 2987 current = current->next_page(); | 2987 current = current->next_page(); |
| 2988 if (previous == NULL) { | 2988 if (previous == NULL) { |
| 2989 first_page_ = current; | 2989 first_page_ = current; |
| 2990 } else { | 2990 } else { |
| 2991 previous->set_next_page(current); | 2991 previous->set_next_page(current); |
| 2992 } | 2992 } |
| 2993 | 2993 |
| 2994 // Free the chunk. | 2994 // Account for the freed bytes. |
| 2995 heap()->mark_compact_collector()->ReportDeleteIfNeeded(object, | |
| 2996 heap()->isolate()); | |
| 2997 size_ -= static_cast<int>(page->size()); | 2995 size_ -= static_cast<int>(page->size()); |
| 2998 objects_size_ -= object->Size(); | 2996 objects_size_ -= object->Size(); |
| 2999 page_count_--; | 2997 page_count_--; |
| 3000 | 2998 |
| 3001 // Remove entries belonging to this page. | 2999 // Remove entries belonging to this page. |
| 3002 // Use variable alignment to help pass length check (<= 80 characters) | 3000 // Use variable alignment to help pass length check (<= 80 characters) |
| 3003 // of single line in tools/presubmit.py. | 3001 // of single line in tools/presubmit.py. |
| 3004 const intptr_t alignment = MemoryChunk::kAlignment; | 3002 const intptr_t alignment = MemoryChunk::kAlignment; |
| 3005 uintptr_t base = reinterpret_cast<uintptr_t>(page) / alignment; | 3003 uintptr_t base = reinterpret_cast<uintptr_t>(page) / alignment; |
| 3006 uintptr_t limit = base + (page->size() - 1) / alignment; | 3004 uintptr_t limit = base + (page->size() - 1) / alignment; |
| 3007 for (uintptr_t key = base; key <= limit; key++) { | 3005 for (uintptr_t key = base; key <= limit; key++) { |
| 3008 chunk_map_.Remove(reinterpret_cast<void*>(key), | 3006 chunk_map_.Remove(reinterpret_cast<void*>(key), |
| 3009 static_cast<uint32_t>(key)); | 3007 static_cast<uint32_t>(key)); |
| 3010 } | 3008 } |
| 3011 | 3009 |
| 3010 // Free the chunk. |
| 3012 if (is_pointer_object) { | 3011 if (is_pointer_object) { |
| 3013 heap()->QueueMemoryChunkForFree(page); | 3012 heap()->QueueMemoryChunkForFree(page); |
| 3014 } else { | 3013 } else { |
| 3015 heap()->isolate()->memory_allocator()->Free(page); | 3014 heap()->isolate()->memory_allocator()->Free(page); |
| 3016 } | 3015 } |
| 3017 } | 3016 } |
| 3018 } | 3017 } |
| 3019 heap()->FreeQueuedChunks(); | 3018 heap()->FreeQueuedChunks(); |
| 3020 } | 3019 } |
| 3021 | 3020 |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3139 object->ShortPrint(); | 3138 object->ShortPrint(); |
| 3140 PrintF("\n"); | 3139 PrintF("\n"); |
| 3141 } | 3140 } |
| 3142 printf(" --------------------------------------\n"); | 3141 printf(" --------------------------------------\n"); |
| 3143 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3142 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
| 3144 } | 3143 } |
| 3145 | 3144 |
| 3146 #endif // DEBUG | 3145 #endif // DEBUG |
| 3147 } | 3146 } |
| 3148 } // namespace v8::internal | 3147 } // namespace v8::internal |
| OLD | NEW |