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

Side by Side Diff: src/heap.cc

Issue 398333002: Concurrent/parallel precise sweeping. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 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/flag-definitions.h ('k') | src/heap-snapshot-generator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api.h" 8 #include "src/api.h"
9 #include "src/base/once.h" 9 #include "src/base/once.h"
10 #include "src/base/utils/random-number-generator.h" 10 #include "src/base/utils/random-number-generator.h"
(...skipping 1283 matching lines...) Expand 10 before | Expand all | Expand 10 after
1294 // Verify that there are no pointers to new space in spaces where we 1294 // Verify that there are no pointers to new space in spaces where we
1295 // do not expect them. 1295 // do not expect them.
1296 VerifyNonPointerSpacePointersVisitor v(heap); 1296 VerifyNonPointerSpacePointersVisitor v(heap);
1297 HeapObjectIterator code_it(heap->code_space()); 1297 HeapObjectIterator code_it(heap->code_space());
1298 for (HeapObject* object = code_it.Next(); 1298 for (HeapObject* object = code_it.Next();
1299 object != NULL; object = code_it.Next()) 1299 object != NULL; object = code_it.Next())
1300 object->Iterate(&v); 1300 object->Iterate(&v);
1301 1301
1302 // The old data space was normally swept conservatively so that the iterator 1302 // The old data space was normally swept conservatively so that the iterator
1303 // doesn't work, so we normally skip the next bit. 1303 // doesn't work, so we normally skip the next bit.
1304 if (heap->old_data_space()->is_iterable()) { 1304 if (heap->old_data_space()->swept_precisely()) {
1305 HeapObjectIterator data_it(heap->old_data_space()); 1305 HeapObjectIterator data_it(heap->old_data_space());
1306 for (HeapObject* object = data_it.Next(); 1306 for (HeapObject* object = data_it.Next();
1307 object != NULL; object = data_it.Next()) 1307 object != NULL; object = data_it.Next())
1308 object->Iterate(&v); 1308 object->Iterate(&v);
1309 } 1309 }
1310 } 1310 }
1311 #endif // VERIFY_HEAP 1311 #endif // VERIFY_HEAP
1312 1312
1313 1313
1314 void Heap::CheckNewSpaceExpansionCriteria() { 1314 void Heap::CheckNewSpaceExpansionCriteria() {
(...skipping 1990 matching lines...) Expand 10 before | Expand all | Expand 10 after
3305 3305
3306 Page* page = Page::FromAddress(address); 3306 Page* page = Page::FromAddress(address);
3307 // We can move the object start if: 3307 // We can move the object start if:
3308 // (1) the object is not in old pointer or old data space, 3308 // (1) the object is not in old pointer or old data space,
3309 // (2) the page of the object was already swept, 3309 // (2) the page of the object was already swept,
3310 // (3) the page was already concurrently swept. This case is an optimization 3310 // (3) the page was already concurrently swept. This case is an optimization
3311 // for concurrent sweeping. The WasSwept predicate for concurrently swept 3311 // for concurrent sweeping. The WasSwept predicate for concurrently swept
3312 // pages is set after sweeping all pages. 3312 // pages is set after sweeping all pages.
3313 return (!is_in_old_pointer_space && !is_in_old_data_space) || 3313 return (!is_in_old_pointer_space && !is_in_old_data_space) ||
3314 page->WasSwept() || 3314 page->WasSwept() ||
3315 (page->parallel_sweeping() <= 3315 (page->parallel_sweeping() <= MemoryChunk::SWEEPING_FINALIZE);
3316 MemoryChunk::PARALLEL_SWEEPING_FINALIZE);
3317 } 3316 }
3318 3317
3319 3318
3320 void Heap::AdjustLiveBytes(Address address, int by, InvocationMode mode) { 3319 void Heap::AdjustLiveBytes(Address address, int by, InvocationMode mode) {
3321 if (incremental_marking()->IsMarking() && 3320 if (incremental_marking()->IsMarking() &&
3322 Marking::IsBlack(Marking::MarkBitFrom(address))) { 3321 Marking::IsBlack(Marking::MarkBitFrom(address))) {
3323 if (mode == FROM_GC) { 3322 if (mode == FROM_GC) {
3324 MemoryChunk::IncrementLiveBytesFromGC(address, by); 3323 MemoryChunk::IncrementLiveBytesFromGC(address, by);
3325 } else { 3324 } else {
3326 MemoryChunk::IncrementLiveBytesFromMutator(address, by); 3325 MemoryChunk::IncrementLiveBytesFromMutator(address, by);
(...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after
4210 Struct* result; 4209 Struct* result;
4211 { AllocationResult allocation = Allocate(map, space); 4210 { AllocationResult allocation = Allocate(map, space);
4212 if (!allocation.To(&result)) return allocation; 4211 if (!allocation.To(&result)) return allocation;
4213 } 4212 }
4214 result->InitializeBody(size); 4213 result->InitializeBody(size);
4215 return result; 4214 return result;
4216 } 4215 }
4217 4216
4218 4217
4219 bool Heap::IsHeapIterable() { 4218 bool Heap::IsHeapIterable() {
4220 return (old_pointer_space()->is_iterable() && 4219 return (old_pointer_space()->swept_precisely() &&
4221 old_data_space()->is_iterable() && 4220 old_data_space()->swept_precisely() &&
4222 new_space_top_after_last_gc_ == new_space()->top()); 4221 new_space_top_after_last_gc_ == new_space()->top());
4223 } 4222 }
4224 4223
4225 4224
4226 void Heap::MakeHeapIterable() { 4225 void Heap::MakeHeapIterable() {
4227 ASSERT(AllowHeapAllocation::IsAllowed()); 4226 ASSERT(AllowHeapAllocation::IsAllowed());
4228 if (!IsHeapIterable()) { 4227 if (!IsHeapIterable()) {
4229 CollectAllGarbage(kMakeHeapIterableMask, "Heap::MakeHeapIterable"); 4228 CollectAllGarbage(kMakeHeapIterableMask, "Heap::MakeHeapIterable");
4230 } 4229 }
4231 ASSERT(IsHeapIterable()); 4230 ASSERT(IsHeapIterable());
(...skipping 2182 matching lines...) Expand 10 before | Expand all | Expand 10 after
6414 static_cast<int>(object_sizes_last_time_[index])); 6413 static_cast<int>(object_sizes_last_time_[index]));
6415 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) 6414 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT)
6416 #undef ADJUST_LAST_TIME_OBJECT_COUNT 6415 #undef ADJUST_LAST_TIME_OBJECT_COUNT
6417 6416
6418 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 6417 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
6419 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 6418 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
6420 ClearObjectStats(); 6419 ClearObjectStats();
6421 } 6420 }
6422 6421
6423 } } // namespace v8::internal 6422 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/flag-definitions.h ('k') | src/heap-snapshot-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698