| 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 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 chunk->area_start_ = area_start; | 476 chunk->area_start_ = area_start; |
| 477 chunk->area_end_ = area_end; | 477 chunk->area_end_ = area_end; |
| 478 chunk->flags_ = 0; | 478 chunk->flags_ = 0; |
| 479 chunk->set_owner(owner); | 479 chunk->set_owner(owner); |
| 480 chunk->InitializeReservedMemory(); | 480 chunk->InitializeReservedMemory(); |
| 481 chunk->slots_buffer_ = NULL; | 481 chunk->slots_buffer_ = NULL; |
| 482 chunk->skip_list_ = NULL; | 482 chunk->skip_list_ = NULL; |
| 483 chunk->write_barrier_counter_ = kWriteBarrierCounterGranularity; | 483 chunk->write_barrier_counter_ = kWriteBarrierCounterGranularity; |
| 484 chunk->progress_bar_ = 0; | 484 chunk->progress_bar_ = 0; |
| 485 chunk->high_water_mark_ = static_cast<int>(area_start - base); | 485 chunk->high_water_mark_ = static_cast<int>(area_start - base); |
| 486 chunk->parallel_sweeping_ = 0; | 486 chunk->set_parallel_sweeping(PARALLEL_SWEEPING_DONE); |
| 487 chunk->available_in_small_free_list_ = 0; | 487 chunk->available_in_small_free_list_ = 0; |
| 488 chunk->available_in_medium_free_list_ = 0; | 488 chunk->available_in_medium_free_list_ = 0; |
| 489 chunk->available_in_large_free_list_ = 0; | 489 chunk->available_in_large_free_list_ = 0; |
| 490 chunk->available_in_huge_free_list_ = 0; | 490 chunk->available_in_huge_free_list_ = 0; |
| 491 chunk->non_available_small_blocks_ = 0; | 491 chunk->non_available_small_blocks_ = 0; |
| 492 chunk->ResetLiveBytes(); | 492 chunk->ResetLiveBytes(); |
| 493 Bitmap::Clear(chunk); | 493 Bitmap::Clear(chunk); |
| 494 chunk->initialize_scan_on_scavenge(false); | 494 chunk->initialize_scan_on_scavenge(false); |
| 495 chunk->SetFlag(WAS_SWEPT_PRECISELY); | 495 chunk->SetFlag(WAS_SWEPT_PRECISELY); |
| 496 | 496 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 if (!code_range->UncommitRawMemory(start, length)) return false; | 553 if (!code_range->UncommitRawMemory(start, length)) return false; |
| 554 } | 554 } |
| 555 } | 555 } |
| 556 | 556 |
| 557 area_end_ = area_start_ + requested; | 557 area_end_ = area_start_ + requested; |
| 558 return true; | 558 return true; |
| 559 } | 559 } |
| 560 | 560 |
| 561 | 561 |
| 562 void MemoryChunk::InsertAfter(MemoryChunk* other) { | 562 void MemoryChunk::InsertAfter(MemoryChunk* other) { |
| 563 next_chunk_ = other->next_chunk_; | 563 MemoryChunk* other_next = other->next_chunk(); |
| 564 prev_chunk_ = other; | |
| 565 | 564 |
| 566 // This memory barrier is needed since concurrent sweeper threads may iterate | 565 set_next_chunk(other_next); |
| 567 // over the list of pages while a new page is inserted. | 566 set_prev_chunk(other); |
| 568 // TODO(hpayer): find a cleaner way to guarantee that the page list can be | 567 other_next->set_prev_chunk(this); |
| 569 // expanded concurrently | 568 other->set_next_chunk(this); |
| 570 MemoryBarrier(); | |
| 571 | |
| 572 // The following two write operations can take effect in arbitrary order | |
| 573 // since pages are always iterated by the sweeper threads in LIFO order, i.e, | |
| 574 // the inserted page becomes visible for the sweeper threads after | |
| 575 // other->next_chunk_ = this; | |
| 576 other->next_chunk_->prev_chunk_ = this; | |
| 577 other->next_chunk_ = this; | |
| 578 } | 569 } |
| 579 | 570 |
| 580 | 571 |
| 581 void MemoryChunk::Unlink() { | 572 void MemoryChunk::Unlink() { |
| 582 if (!InNewSpace() && IsFlagSet(SCAN_ON_SCAVENGE)) { | 573 if (!InNewSpace() && IsFlagSet(SCAN_ON_SCAVENGE)) { |
| 583 heap_->decrement_scan_on_scavenge_pages(); | 574 heap_->decrement_scan_on_scavenge_pages(); |
| 584 ClearFlag(SCAN_ON_SCAVENGE); | 575 ClearFlag(SCAN_ON_SCAVENGE); |
| 585 } | 576 } |
| 586 next_chunk_->prev_chunk_ = prev_chunk_; | 577 MemoryChunk* next_element = next_chunk(); |
| 587 prev_chunk_->next_chunk_ = next_chunk_; | 578 MemoryChunk* prev_element = prev_chunk(); |
| 588 prev_chunk_ = NULL; | 579 next_element->set_prev_chunk(prev_element); |
| 589 next_chunk_ = NULL; | 580 prev_element->set_next_chunk(next_element); |
| 581 set_prev_chunk(NULL); |
| 582 set_next_chunk(NULL); |
| 590 } | 583 } |
| 591 | 584 |
| 592 | 585 |
| 593 MemoryChunk* MemoryAllocator::AllocateChunk(intptr_t reserve_area_size, | 586 MemoryChunk* MemoryAllocator::AllocateChunk(intptr_t reserve_area_size, |
| 594 intptr_t commit_area_size, | 587 intptr_t commit_area_size, |
| 595 Executability executable, | 588 Executability executable, |
| 596 Space* owner) { | 589 Space* owner) { |
| 597 ASSERT(commit_area_size <= reserve_area_size); | 590 ASSERT(commit_area_size <= reserve_area_size); |
| 598 | 591 |
| 599 size_t chunk_size; | 592 size_t chunk_size; |
| (...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1135 } | 1128 } |
| 1136 | 1129 |
| 1137 if (page->WasSwept()) { | 1130 if (page->WasSwept()) { |
| 1138 intptr_t size = free_list_.EvictFreeListItems(page); | 1131 intptr_t size = free_list_.EvictFreeListItems(page); |
| 1139 accounting_stats_.AllocateBytes(size); | 1132 accounting_stats_.AllocateBytes(size); |
| 1140 ASSERT_EQ(AreaSize(), static_cast<int>(size)); | 1133 ASSERT_EQ(AreaSize(), static_cast<int>(size)); |
| 1141 } else { | 1134 } else { |
| 1142 DecreaseUnsweptFreeBytes(page); | 1135 DecreaseUnsweptFreeBytes(page); |
| 1143 } | 1136 } |
| 1144 | 1137 |
| 1138 // TODO(hpayer): This check is just used for debugging purpose and |
| 1139 // should be removed or turned into an assert after investigating the |
| 1140 // crash in concurrent sweeping. |
| 1141 CHECK(!free_list_.ContainsPageFreeListItems(page)); |
| 1142 |
| 1145 if (Page::FromAllocationTop(allocation_info_.top()) == page) { | 1143 if (Page::FromAllocationTop(allocation_info_.top()) == page) { |
| 1146 allocation_info_.set_top(NULL); | 1144 allocation_info_.set_top(NULL); |
| 1147 allocation_info_.set_limit(NULL); | 1145 allocation_info_.set_limit(NULL); |
| 1148 } | 1146 } |
| 1149 | 1147 |
| 1150 if (unlink) { | 1148 if (unlink) { |
| 1151 page->Unlink(); | 1149 page->Unlink(); |
| 1152 } | 1150 } |
| 1153 if (page->IsFlagSet(MemoryChunk::CONTAINS_ONLY_DATA)) { | 1151 if (page->IsFlagSet(MemoryChunk::CONTAINS_ONLY_DATA)) { |
| 1154 heap()->isolate()->memory_allocator()->Free(page); | 1152 heap()->isolate()->memory_allocator()->Free(page); |
| (...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2070 reinterpret_cast<Address>(next); | 2068 reinterpret_cast<Address>(next); |
| 2071 } else { | 2069 } else { |
| 2072 Memory::Address_at(address() + kPointerSize) = | 2070 Memory::Address_at(address() + kPointerSize) = |
| 2073 reinterpret_cast<Address>(next); | 2071 reinterpret_cast<Address>(next); |
| 2074 } | 2072 } |
| 2075 } | 2073 } |
| 2076 | 2074 |
| 2077 | 2075 |
| 2078 intptr_t FreeListCategory::Concatenate(FreeListCategory* category) { | 2076 intptr_t FreeListCategory::Concatenate(FreeListCategory* category) { |
| 2079 intptr_t free_bytes = 0; | 2077 intptr_t free_bytes = 0; |
| 2080 if (category->top_ != NULL) { | 2078 if (category->top() != NULL) { |
| 2081 ASSERT(category->end_ != NULL); | |
| 2082 // This is safe (not going to deadlock) since Concatenate operations | 2079 // This is safe (not going to deadlock) since Concatenate operations |
| 2083 // are never performed on the same free lists at the same time in | 2080 // are never performed on the same free lists at the same time in |
| 2084 // reverse order. | 2081 // reverse order. |
| 2085 LockGuard<Mutex> target_lock_guard(mutex()); | 2082 LockGuard<Mutex> target_lock_guard(mutex()); |
| 2086 LockGuard<Mutex> source_lock_guard(category->mutex()); | 2083 LockGuard<Mutex> source_lock_guard(category->mutex()); |
| 2084 ASSERT(category->end_ != NULL); |
| 2087 free_bytes = category->available(); | 2085 free_bytes = category->available(); |
| 2088 if (end_ == NULL) { | 2086 if (end_ == NULL) { |
| 2089 end_ = category->end(); | 2087 end_ = category->end(); |
| 2090 } else { | 2088 } else { |
| 2091 category->end()->set_next(top_); | 2089 category->end()->set_next(top()); |
| 2092 } | 2090 } |
| 2093 top_ = category->top(); | 2091 set_top(category->top()); |
| 2092 NoBarrier_Store(&top_, category->top_); |
| 2094 available_ += category->available(); | 2093 available_ += category->available(); |
| 2095 category->Reset(); | 2094 category->Reset(); |
| 2096 } | 2095 } |
| 2097 return free_bytes; | 2096 return free_bytes; |
| 2098 } | 2097 } |
| 2099 | 2098 |
| 2100 | 2099 |
| 2101 void FreeListCategory::Reset() { | 2100 void FreeListCategory::Reset() { |
| 2102 top_ = NULL; | 2101 set_top(NULL); |
| 2103 end_ = NULL; | 2102 set_end(NULL); |
| 2104 available_ = 0; | 2103 set_available(0); |
| 2105 } | 2104 } |
| 2106 | 2105 |
| 2107 | 2106 |
| 2108 intptr_t FreeListCategory::EvictFreeListItemsInList(Page* p) { | 2107 intptr_t FreeListCategory::EvictFreeListItemsInList(Page* p) { |
| 2109 int sum = 0; | 2108 int sum = 0; |
| 2110 FreeListNode** n = &top_; | 2109 FreeListNode* t = top(); |
| 2110 FreeListNode** n = &t; |
| 2111 while (*n != NULL) { | 2111 while (*n != NULL) { |
| 2112 if (Page::FromAddress((*n)->address()) == p) { | 2112 if (Page::FromAddress((*n)->address()) == p) { |
| 2113 FreeSpace* free_space = reinterpret_cast<FreeSpace*>(*n); | 2113 FreeSpace* free_space = reinterpret_cast<FreeSpace*>(*n); |
| 2114 sum += free_space->Size(); | 2114 sum += free_space->Size(); |
| 2115 *n = (*n)->next(); | 2115 *n = (*n)->next(); |
| 2116 } else { | 2116 } else { |
| 2117 n = (*n)->next_address(); | 2117 n = (*n)->next_address(); |
| 2118 } | 2118 } |
| 2119 } | 2119 } |
| 2120 if (top_ == NULL) { | 2120 set_top(t); |
| 2121 end_ = NULL; | 2121 if (top() == NULL) { |
| 2122 set_end(NULL); |
| 2122 } | 2123 } |
| 2123 available_ -= sum; | 2124 available_ -= sum; |
| 2124 return sum; | 2125 return sum; |
| 2125 } | 2126 } |
| 2126 | 2127 |
| 2127 | 2128 |
| 2129 bool FreeListCategory::ContainsPageFreeListItemsInList(Page* p) { |
| 2130 FreeListNode* node = top(); |
| 2131 while (node != NULL) { |
| 2132 if (Page::FromAddress(node->address()) == p) return true; |
| 2133 node = node->next(); |
| 2134 } |
| 2135 return false; |
| 2136 } |
| 2137 |
| 2138 |
| 2128 FreeListNode* FreeListCategory::PickNodeFromList(int *node_size) { | 2139 FreeListNode* FreeListCategory::PickNodeFromList(int *node_size) { |
| 2129 FreeListNode* node = top_; | 2140 FreeListNode* node = top(); |
| 2130 | 2141 |
| 2131 if (node == NULL) return NULL; | 2142 if (node == NULL) return NULL; |
| 2132 | 2143 |
| 2133 while (node != NULL && | 2144 while (node != NULL && |
| 2134 Page::FromAddress(node->address())->IsEvacuationCandidate()) { | 2145 Page::FromAddress(node->address())->IsEvacuationCandidate()) { |
| 2135 available_ -= reinterpret_cast<FreeSpace*>(node)->Size(); | 2146 available_ -= reinterpret_cast<FreeSpace*>(node)->Size(); |
| 2136 node = node->next(); | 2147 node = node->next(); |
| 2137 } | 2148 } |
| 2138 | 2149 |
| 2139 if (node != NULL) { | 2150 if (node != NULL) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 2158 if (node != NULL && *node_size < size_in_bytes) { | 2169 if (node != NULL && *node_size < size_in_bytes) { |
| 2159 Free(node, *node_size); | 2170 Free(node, *node_size); |
| 2160 *node_size = 0; | 2171 *node_size = 0; |
| 2161 return NULL; | 2172 return NULL; |
| 2162 } | 2173 } |
| 2163 return node; | 2174 return node; |
| 2164 } | 2175 } |
| 2165 | 2176 |
| 2166 | 2177 |
| 2167 void FreeListCategory::Free(FreeListNode* node, int size_in_bytes) { | 2178 void FreeListCategory::Free(FreeListNode* node, int size_in_bytes) { |
| 2168 node->set_next(top_); | 2179 node->set_next(top()); |
| 2169 top_ = node; | 2180 set_top(node); |
| 2170 if (end_ == NULL) { | 2181 if (end_ == NULL) { |
| 2171 end_ = node; | 2182 end_ = node; |
| 2172 } | 2183 } |
| 2173 available_ += size_in_bytes; | 2184 available_ += size_in_bytes; |
| 2174 } | 2185 } |
| 2175 | 2186 |
| 2176 | 2187 |
| 2177 void FreeListCategory::RepairFreeList(Heap* heap) { | 2188 void FreeListCategory::RepairFreeList(Heap* heap) { |
| 2178 FreeListNode* n = top_; | 2189 FreeListNode* n = top(); |
| 2179 while (n != NULL) { | 2190 while (n != NULL) { |
| 2180 Map** map_location = reinterpret_cast<Map**>(n->address()); | 2191 Map** map_location = reinterpret_cast<Map**>(n->address()); |
| 2181 if (*map_location == NULL) { | 2192 if (*map_location == NULL) { |
| 2182 *map_location = heap->free_space_map(); | 2193 *map_location = heap->free_space_map(); |
| 2183 } else { | 2194 } else { |
| 2184 ASSERT(*map_location == heap->free_space_map()); | 2195 ASSERT(*map_location == heap->free_space_map()); |
| 2185 } | 2196 } |
| 2186 n = n->next(); | 2197 n = n->next(); |
| 2187 } | 2198 } |
| 2188 } | 2199 } |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2277 if (node != NULL) { | 2288 if (node != NULL) { |
| 2278 ASSERT(size_in_bytes <= *node_size); | 2289 ASSERT(size_in_bytes <= *node_size); |
| 2279 page = Page::FromAddress(node->address()); | 2290 page = Page::FromAddress(node->address()); |
| 2280 page->add_available_in_large_free_list(-(*node_size)); | 2291 page->add_available_in_large_free_list(-(*node_size)); |
| 2281 ASSERT(IsVeryLong() || available() == SumFreeLists()); | 2292 ASSERT(IsVeryLong() || available() == SumFreeLists()); |
| 2282 return node; | 2293 return node; |
| 2283 } | 2294 } |
| 2284 } | 2295 } |
| 2285 | 2296 |
| 2286 int huge_list_available = huge_list_.available(); | 2297 int huge_list_available = huge_list_.available(); |
| 2287 for (FreeListNode** cur = huge_list_.GetTopAddress(); | 2298 FreeListNode* top_node = huge_list_.top(); |
| 2299 for (FreeListNode** cur = &top_node; |
| 2288 *cur != NULL; | 2300 *cur != NULL; |
| 2289 cur = (*cur)->next_address()) { | 2301 cur = (*cur)->next_address()) { |
| 2290 FreeListNode* cur_node = *cur; | 2302 FreeListNode* cur_node = *cur; |
| 2291 while (cur_node != NULL && | 2303 while (cur_node != NULL && |
| 2292 Page::FromAddress(cur_node->address())->IsEvacuationCandidate()) { | 2304 Page::FromAddress(cur_node->address())->IsEvacuationCandidate()) { |
| 2293 int size = reinterpret_cast<FreeSpace*>(cur_node)->Size(); | 2305 int size = reinterpret_cast<FreeSpace*>(cur_node)->Size(); |
| 2294 huge_list_available -= size; | 2306 huge_list_available -= size; |
| 2295 page = Page::FromAddress(cur_node->address()); | 2307 page = Page::FromAddress(cur_node->address()); |
| 2296 page->add_available_in_huge_free_list(-size); | 2308 page->add_available_in_huge_free_list(-size); |
| 2297 cur_node = cur_node->next(); | 2309 cur_node = cur_node->next(); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 2311 node = *cur; | 2323 node = *cur; |
| 2312 *cur = node->next(); | 2324 *cur = node->next(); |
| 2313 *node_size = size; | 2325 *node_size = size; |
| 2314 huge_list_available -= size; | 2326 huge_list_available -= size; |
| 2315 page = Page::FromAddress(node->address()); | 2327 page = Page::FromAddress(node->address()); |
| 2316 page->add_available_in_huge_free_list(-size); | 2328 page->add_available_in_huge_free_list(-size); |
| 2317 break; | 2329 break; |
| 2318 } | 2330 } |
| 2319 } | 2331 } |
| 2320 | 2332 |
| 2333 huge_list_.set_top(top_node); |
| 2321 if (huge_list_.top() == NULL) { | 2334 if (huge_list_.top() == NULL) { |
| 2322 huge_list_.set_end(NULL); | 2335 huge_list_.set_end(NULL); |
| 2323 } | 2336 } |
| 2324 huge_list_.set_available(huge_list_available); | 2337 huge_list_.set_available(huge_list_available); |
| 2325 | 2338 |
| 2326 if (node != NULL) { | 2339 if (node != NULL) { |
| 2327 ASSERT(IsVeryLong() || available() == SumFreeLists()); | 2340 ASSERT(IsVeryLong() || available() == SumFreeLists()); |
| 2328 return node; | 2341 return node; |
| 2329 } | 2342 } |
| 2330 | 2343 |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2445 large_list_.EvictFreeListItemsInList(p); | 2458 large_list_.EvictFreeListItemsInList(p); |
| 2446 p->set_available_in_small_free_list(0); | 2459 p->set_available_in_small_free_list(0); |
| 2447 p->set_available_in_medium_free_list(0); | 2460 p->set_available_in_medium_free_list(0); |
| 2448 p->set_available_in_large_free_list(0); | 2461 p->set_available_in_large_free_list(0); |
| 2449 } | 2462 } |
| 2450 | 2463 |
| 2451 return sum; | 2464 return sum; |
| 2452 } | 2465 } |
| 2453 | 2466 |
| 2454 | 2467 |
| 2468 bool FreeList::ContainsPageFreeListItems(Page* p) { |
| 2469 return huge_list_.EvictFreeListItemsInList(p) || |
| 2470 small_list_.EvictFreeListItemsInList(p) || |
| 2471 medium_list_.EvictFreeListItemsInList(p) || |
| 2472 large_list_.EvictFreeListItemsInList(p); |
| 2473 } |
| 2474 |
| 2475 |
| 2455 void FreeList::RepairLists(Heap* heap) { | 2476 void FreeList::RepairLists(Heap* heap) { |
| 2456 small_list_.RepairFreeList(heap); | 2477 small_list_.RepairFreeList(heap); |
| 2457 medium_list_.RepairFreeList(heap); | 2478 medium_list_.RepairFreeList(heap); |
| 2458 large_list_.RepairFreeList(heap); | 2479 large_list_.RepairFreeList(heap); |
| 2459 huge_list_.RepairFreeList(heap); | 2480 huge_list_.RepairFreeList(heap); |
| 2460 } | 2481 } |
| 2461 | 2482 |
| 2462 | 2483 |
| 2463 #ifdef DEBUG | 2484 #ifdef DEBUG |
| 2464 intptr_t FreeListCategory::SumFreeList() { | 2485 intptr_t FreeListCategory::SumFreeList() { |
| 2465 intptr_t sum = 0; | 2486 intptr_t sum = 0; |
| 2466 FreeListNode* cur = top_; | 2487 FreeListNode* cur = top(); |
| 2467 while (cur != NULL) { | 2488 while (cur != NULL) { |
| 2468 ASSERT(cur->map() == cur->GetHeap()->raw_unchecked_free_space_map()); | 2489 ASSERT(cur->map() == cur->GetHeap()->raw_unchecked_free_space_map()); |
| 2469 FreeSpace* cur_as_free_space = reinterpret_cast<FreeSpace*>(cur); | 2490 FreeSpace* cur_as_free_space = reinterpret_cast<FreeSpace*>(cur); |
| 2470 sum += cur_as_free_space->Size(); | 2491 sum += cur_as_free_space->Size(); |
| 2471 cur = cur->next(); | 2492 cur = cur->next(); |
| 2472 } | 2493 } |
| 2473 return sum; | 2494 return sum; |
| 2474 } | 2495 } |
| 2475 | 2496 |
| 2476 | 2497 |
| 2477 static const int kVeryLongFreeList = 500; | 2498 static const int kVeryLongFreeList = 500; |
| 2478 | 2499 |
| 2479 | 2500 |
| 2480 int FreeListCategory::FreeListLength() { | 2501 int FreeListCategory::FreeListLength() { |
| 2481 int length = 0; | 2502 int length = 0; |
| 2482 FreeListNode* cur = top_; | 2503 FreeListNode* cur = top(); |
| 2483 while (cur != NULL) { | 2504 while (cur != NULL) { |
| 2484 length++; | 2505 length++; |
| 2485 cur = cur->next(); | 2506 cur = cur->next(); |
| 2486 if (length == kVeryLongFreeList) return length; | 2507 if (length == kVeryLongFreeList) return length; |
| 2487 } | 2508 } |
| 2488 return length; | 2509 return length; |
| 2489 } | 2510 } |
| 2490 | 2511 |
| 2491 | 2512 |
| 2492 bool FreeList::IsVeryLong() { | 2513 bool FreeList::IsVeryLong() { |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2605 allocation_info_.set_top(NULL); | 2626 allocation_info_.set_top(NULL); |
| 2606 allocation_info_.set_limit(NULL); | 2627 allocation_info_.set_limit(NULL); |
| 2607 } | 2628 } |
| 2608 } | 2629 } |
| 2609 | 2630 |
| 2610 | 2631 |
| 2611 bool PagedSpace::EnsureSweeperProgress(intptr_t size_in_bytes) { | 2632 bool PagedSpace::EnsureSweeperProgress(intptr_t size_in_bytes) { |
| 2612 MarkCompactCollector* collector = heap()->mark_compact_collector(); | 2633 MarkCompactCollector* collector = heap()->mark_compact_collector(); |
| 2613 if (collector->AreSweeperThreadsActivated()) { | 2634 if (collector->AreSweeperThreadsActivated()) { |
| 2614 if (collector->IsConcurrentSweepingInProgress()) { | 2635 if (collector->IsConcurrentSweepingInProgress()) { |
| 2615 if (collector->StealMemoryFromSweeperThreads(this) < size_in_bytes) { | 2636 if (collector->RefillFreeLists(this) < size_in_bytes) { |
| 2616 if (!collector->sequential_sweeping()) { | 2637 if (!collector->sequential_sweeping()) { |
| 2617 collector->WaitUntilSweepingCompleted(); | 2638 collector->WaitUntilSweepingCompleted(); |
| 2618 return true; | 2639 return true; |
| 2619 } | 2640 } |
| 2620 } | 2641 } |
| 2621 return false; | 2642 return false; |
| 2622 } | 2643 } |
| 2623 return true; | 2644 return true; |
| 2624 } else { | 2645 } else { |
| 2625 return AdvanceSweeper(size_in_bytes); | 2646 return AdvanceSweeper(size_in_bytes); |
| (...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3178 object->ShortPrint(); | 3199 object->ShortPrint(); |
| 3179 PrintF("\n"); | 3200 PrintF("\n"); |
| 3180 } | 3201 } |
| 3181 printf(" --------------------------------------\n"); | 3202 printf(" --------------------------------------\n"); |
| 3182 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3203 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
| 3183 } | 3204 } |
| 3184 | 3205 |
| 3185 #endif // DEBUG | 3206 #endif // DEBUG |
| 3186 | 3207 |
| 3187 } } // namespace v8::internal | 3208 } } // namespace v8::internal |
| OLD | NEW |