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 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1135 } | 1135 } |
1136 | 1136 |
1137 if (page->WasSwept()) { | 1137 if (page->WasSwept()) { |
1138 intptr_t size = free_list_.EvictFreeListItems(page); | 1138 intptr_t size = free_list_.EvictFreeListItems(page); |
1139 accounting_stats_.AllocateBytes(size); | 1139 accounting_stats_.AllocateBytes(size); |
1140 ASSERT_EQ(AreaSize(), static_cast<int>(size)); | 1140 ASSERT_EQ(AreaSize(), static_cast<int>(size)); |
1141 } else { | 1141 } else { |
1142 DecreaseUnsweptFreeBytes(page); | 1142 DecreaseUnsweptFreeBytes(page); |
1143 } | 1143 } |
1144 | 1144 |
| 1145 // TODO(hpayer): This check is just used for debugging purpose and |
| 1146 // should be removed or turned into an assert after investigating the |
| 1147 // crash in concurrent sweeping. |
| 1148 CHECK(!free_list_.ContainsPageFreeListItems(page)); |
| 1149 |
1145 if (Page::FromAllocationTop(allocation_info_.top()) == page) { | 1150 if (Page::FromAllocationTop(allocation_info_.top()) == page) { |
1146 allocation_info_.set_top(NULL); | 1151 allocation_info_.set_top(NULL); |
1147 allocation_info_.set_limit(NULL); | 1152 allocation_info_.set_limit(NULL); |
1148 } | 1153 } |
1149 | 1154 |
1150 if (unlink) { | 1155 if (unlink) { |
1151 page->Unlink(); | 1156 page->Unlink(); |
1152 } | 1157 } |
1153 if (page->IsFlagSet(MemoryChunk::CONTAINS_ONLY_DATA)) { | 1158 if (page->IsFlagSet(MemoryChunk::CONTAINS_ONLY_DATA)) { |
1154 heap()->isolate()->memory_allocator()->Free(page); | 1159 heap()->isolate()->memory_allocator()->Free(page); |
(...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2118 } | 2123 } |
2119 } | 2124 } |
2120 if (top_ == NULL) { | 2125 if (top_ == NULL) { |
2121 end_ = NULL; | 2126 end_ = NULL; |
2122 } | 2127 } |
2123 available_ -= sum; | 2128 available_ -= sum; |
2124 return sum; | 2129 return sum; |
2125 } | 2130 } |
2126 | 2131 |
2127 | 2132 |
| 2133 bool FreeListCategory::ContainsPageFreeListItemsInList(Page* p) { |
| 2134 FreeListNode** n = &top_; |
| 2135 while (*n != NULL) { |
| 2136 if (Page::FromAddress((*n)->address()) == p) return true; |
| 2137 n = (*n)->next_address(); |
| 2138 } |
| 2139 return false; |
| 2140 } |
| 2141 |
| 2142 |
2128 FreeListNode* FreeListCategory::PickNodeFromList(int *node_size) { | 2143 FreeListNode* FreeListCategory::PickNodeFromList(int *node_size) { |
2129 FreeListNode* node = top_; | 2144 FreeListNode* node = top_; |
2130 | 2145 |
2131 if (node == NULL) return NULL; | 2146 if (node == NULL) return NULL; |
2132 | 2147 |
2133 while (node != NULL && | 2148 while (node != NULL && |
2134 Page::FromAddress(node->address())->IsEvacuationCandidate()) { | 2149 Page::FromAddress(node->address())->IsEvacuationCandidate()) { |
2135 available_ -= reinterpret_cast<FreeSpace*>(node)->Size(); | 2150 available_ -= reinterpret_cast<FreeSpace*>(node)->Size(); |
2136 node = node->next(); | 2151 node = node->next(); |
2137 } | 2152 } |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2445 large_list_.EvictFreeListItemsInList(p); | 2460 large_list_.EvictFreeListItemsInList(p); |
2446 p->set_available_in_small_free_list(0); | 2461 p->set_available_in_small_free_list(0); |
2447 p->set_available_in_medium_free_list(0); | 2462 p->set_available_in_medium_free_list(0); |
2448 p->set_available_in_large_free_list(0); | 2463 p->set_available_in_large_free_list(0); |
2449 } | 2464 } |
2450 | 2465 |
2451 return sum; | 2466 return sum; |
2452 } | 2467 } |
2453 | 2468 |
2454 | 2469 |
| 2470 bool FreeList::ContainsPageFreeListItems(Page* p) { |
| 2471 return huge_list_.EvictFreeListItemsInList(p) || |
| 2472 small_list_.EvictFreeListItemsInList(p) || |
| 2473 medium_list_.EvictFreeListItemsInList(p) || |
| 2474 large_list_.EvictFreeListItemsInList(p); |
| 2475 } |
| 2476 |
| 2477 |
2455 void FreeList::RepairLists(Heap* heap) { | 2478 void FreeList::RepairLists(Heap* heap) { |
2456 small_list_.RepairFreeList(heap); | 2479 small_list_.RepairFreeList(heap); |
2457 medium_list_.RepairFreeList(heap); | 2480 medium_list_.RepairFreeList(heap); |
2458 large_list_.RepairFreeList(heap); | 2481 large_list_.RepairFreeList(heap); |
2459 huge_list_.RepairFreeList(heap); | 2482 huge_list_.RepairFreeList(heap); |
2460 } | 2483 } |
2461 | 2484 |
2462 | 2485 |
2463 #ifdef DEBUG | 2486 #ifdef DEBUG |
2464 intptr_t FreeListCategory::SumFreeList() { | 2487 intptr_t FreeListCategory::SumFreeList() { |
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3178 object->ShortPrint(); | 3201 object->ShortPrint(); |
3179 PrintF("\n"); | 3202 PrintF("\n"); |
3180 } | 3203 } |
3181 printf(" --------------------------------------\n"); | 3204 printf(" --------------------------------------\n"); |
3182 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3205 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
3183 } | 3206 } |
3184 | 3207 |
3185 #endif // DEBUG | 3208 #endif // DEBUG |
3186 | 3209 |
3187 } } // namespace v8::internal | 3210 } } // namespace v8::internal |
OLD | NEW |