Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/spaces.cc

Issue 12499004: Unlink evacuation candidates from list of pages before starting sweeper threads. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/spaces.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 963 matching lines...) Expand 10 before | Expand all | Expand 10 after
974 if (Capacity() == max_capacity_) return false; 974 if (Capacity() == max_capacity_) return false;
975 975
976 ASSERT(Capacity() < max_capacity_); 976 ASSERT(Capacity() < max_capacity_);
977 977
978 // Are we going to exceed capacity for this space? 978 // Are we going to exceed capacity for this space?
979 if ((Capacity() + Page::kPageSize) > max_capacity_) return false; 979 if ((Capacity() + Page::kPageSize) > max_capacity_) return false;
980 980
981 return true; 981 return true;
982 } 982 }
983 983
984
984 bool PagedSpace::Expand() { 985 bool PagedSpace::Expand() {
985 if (!CanExpand()) return false; 986 if (!CanExpand()) return false;
986 987
987 intptr_t size = AreaSize(); 988 intptr_t size = AreaSize();
988 989
989 if (anchor_.next_page() == &anchor_) { 990 if (anchor_.next_page() == &anchor_) {
990 size = SizeOfFirstPage(); 991 size = SizeOfFirstPage();
991 } 992 }
992 993
993 Page* p = heap()->isolate()->memory_allocator()->AllocatePage( 994 Page* p = heap()->isolate()->memory_allocator()->AllocatePage(
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1038 PageIterator it(this); 1039 PageIterator it(this);
1039 int count = 0; 1040 int count = 0;
1040 while (it.has_next()) { 1041 while (it.has_next()) {
1041 it.next(); 1042 it.next();
1042 count++; 1043 count++;
1043 } 1044 }
1044 return count; 1045 return count;
1045 } 1046 }
1046 1047
1047 1048
1048 void PagedSpace::ReleasePage(Page* page) { 1049 void PagedSpace::ReleasePage(Page* page, bool unlink) {
1049 ASSERT(page->LiveBytes() == 0); 1050 ASSERT(page->LiveBytes() == 0);
1050 ASSERT(AreaSize() == page->area_size()); 1051 ASSERT(AreaSize() == page->area_size());
1051 1052
1052 // Adjust list of unswept pages if the page is the head of the list. 1053 // Adjust list of unswept pages if the page is the head of the list.
1053 if (first_unswept_page_ == page) { 1054 if (first_unswept_page_ == page) {
1054 first_unswept_page_ = page->next_page(); 1055 first_unswept_page_ = page->next_page();
1055 if (first_unswept_page_ == anchor()) { 1056 if (first_unswept_page_ == anchor()) {
1056 first_unswept_page_ = Page::FromAddress(NULL); 1057 first_unswept_page_ = Page::FromAddress(NULL);
1057 } 1058 }
1058 } 1059 }
1059 1060
1060 if (page->WasSwept()) { 1061 if (page->WasSwept()) {
1061 intptr_t size = free_list_.EvictFreeListItems(page); 1062 intptr_t size = free_list_.EvictFreeListItems(page);
1062 accounting_stats_.AllocateBytes(size); 1063 accounting_stats_.AllocateBytes(size);
1063 ASSERT_EQ(AreaSize(), static_cast<int>(size)); 1064 ASSERT_EQ(AreaSize(), static_cast<int>(size));
1064 } else { 1065 } else {
1065 DecreaseUnsweptFreeBytes(page); 1066 DecreaseUnsweptFreeBytes(page);
1066 } 1067 }
1067 1068
1068 if (Page::FromAllocationTop(allocation_info_.top) == page) { 1069 if (Page::FromAllocationTop(allocation_info_.top) == page) {
1069 allocation_info_.top = allocation_info_.limit = NULL; 1070 allocation_info_.top = allocation_info_.limit = NULL;
1070 } 1071 }
1071 1072
1072 page->Unlink(); 1073 if (unlink) {
1074 page->Unlink();
1075 }
1073 if (page->IsFlagSet(MemoryChunk::CONTAINS_ONLY_DATA)) { 1076 if (page->IsFlagSet(MemoryChunk::CONTAINS_ONLY_DATA)) {
1074 heap()->isolate()->memory_allocator()->Free(page); 1077 heap()->isolate()->memory_allocator()->Free(page);
1075 } else { 1078 } else {
1076 heap()->QueueMemoryChunkForFree(page); 1079 heap()->QueueMemoryChunkForFree(page);
1077 } 1080 }
1078 1081
1079 ASSERT(Capacity() > 0); 1082 ASSERT(Capacity() > 0);
1080 accounting_stats_.ShrinkSpace(AreaSize()); 1083 accounting_stats_.ShrinkSpace(AreaSize());
1081 } 1084 }
1082 1085
(...skipping 1465 matching lines...) Expand 10 before | Expand all | Expand 10 after
2548 } 2551 }
2549 2552
2550 2553
2551 bool PagedSpace::EnsureSweeperProgress(intptr_t size_in_bytes) { 2554 bool PagedSpace::EnsureSweeperProgress(intptr_t size_in_bytes) {
2552 MarkCompactCollector* collector = heap()->mark_compact_collector(); 2555 MarkCompactCollector* collector = heap()->mark_compact_collector();
2553 if (collector->AreSweeperThreadsActivated()) { 2556 if (collector->AreSweeperThreadsActivated()) {
2554 if (collector->IsConcurrentSweepingInProgress()) { 2557 if (collector->IsConcurrentSweepingInProgress()) {
2555 if (collector->StealMemoryFromSweeperThreads(this) < size_in_bytes) { 2558 if (collector->StealMemoryFromSweeperThreads(this) < size_in_bytes) {
2556 if (!collector->sequential_sweeping()) { 2559 if (!collector->sequential_sweeping()) {
2557 collector->WaitUntilSweepingCompleted(); 2560 collector->WaitUntilSweepingCompleted();
2558 collector->FinalizeSweeping();
2559 return true; 2561 return true;
2560 } 2562 }
2561 } 2563 }
2562 return false; 2564 return false;
2563 } 2565 }
2564 return true; 2566 return true;
2565 } else { 2567 } else {
2566 return AdvanceSweeper(size_in_bytes); 2568 return AdvanceSweeper(size_in_bytes);
2567 } 2569 }
2568 } 2570 }
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
3130 object->ShortPrint(); 3132 object->ShortPrint();
3131 PrintF("\n"); 3133 PrintF("\n");
3132 } 3134 }
3133 printf(" --------------------------------------\n"); 3135 printf(" --------------------------------------\n");
3134 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); 3136 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes());
3135 } 3137 }
3136 3138
3137 #endif // DEBUG 3139 #endif // DEBUG
3138 3140
3139 } } // namespace v8::internal 3141 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/spaces.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698