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

Side by Side Diff: src/heap.cc

Issue 361983003: Wait for sweeper threads only if we have to. (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 | « no previous file | 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 1279 matching lines...) Expand 10 before | Expand all | Expand 10 after
1290 // Verify that there are no pointers to new space in spaces where we 1290 // Verify that there are no pointers to new space in spaces where we
1291 // do not expect them. 1291 // do not expect them.
1292 VerifyNonPointerSpacePointersVisitor v(heap); 1292 VerifyNonPointerSpacePointersVisitor v(heap);
1293 HeapObjectIterator code_it(heap->code_space()); 1293 HeapObjectIterator code_it(heap->code_space());
1294 for (HeapObject* object = code_it.Next(); 1294 for (HeapObject* object = code_it.Next();
1295 object != NULL; object = code_it.Next()) 1295 object != NULL; object = code_it.Next())
1296 object->Iterate(&v); 1296 object->Iterate(&v);
1297 1297
1298 // The old data space was normally swept conservatively so that the iterator 1298 // The old data space was normally swept conservatively so that the iterator
1299 // doesn't work, so we normally skip the next bit. 1299 // doesn't work, so we normally skip the next bit.
1300 if (!heap->old_data_space()->was_swept_conservatively()) { 1300 if (heap->old_data_space()->is_iterable()) {
1301 HeapObjectIterator data_it(heap->old_data_space()); 1301 HeapObjectIterator data_it(heap->old_data_space());
1302 for (HeapObject* object = data_it.Next(); 1302 for (HeapObject* object = data_it.Next();
1303 object != NULL; object = data_it.Next()) 1303 object != NULL; object = data_it.Next())
1304 object->Iterate(&v); 1304 object->Iterate(&v);
1305 } 1305 }
1306 } 1306 }
1307 #endif // VERIFY_HEAP 1307 #endif // VERIFY_HEAP
1308 1308
1309 1309
1310 void Heap::CheckNewSpaceExpansionCriteria() { 1310 void Heap::CheckNewSpaceExpansionCriteria() {
(...skipping 2928 matching lines...) Expand 10 before | Expand all | Expand 10 after
4239 Struct* result; 4239 Struct* result;
4240 { AllocationResult allocation = Allocate(map, space); 4240 { AllocationResult allocation = Allocate(map, space);
4241 if (!allocation.To(&result)) return allocation; 4241 if (!allocation.To(&result)) return allocation;
4242 } 4242 }
4243 result->InitializeBody(size); 4243 result->InitializeBody(size);
4244 return result; 4244 return result;
4245 } 4245 }
4246 4246
4247 4247
4248 bool Heap::IsHeapIterable() { 4248 bool Heap::IsHeapIterable() {
4249 return (!old_pointer_space()->was_swept_conservatively() && 4249 return (old_pointer_space()->is_iterable() &&
4250 !old_data_space()->was_swept_conservatively() && 4250 old_data_space()->is_iterable() &&
4251 new_space_top_after_last_gc_ == new_space()->top()); 4251 new_space_top_after_last_gc_ == new_space()->top());
4252 } 4252 }
4253 4253
4254 4254
4255 void Heap::MakeHeapIterable() { 4255 void Heap::MakeHeapIterable() {
4256 ASSERT(AllowHeapAllocation::IsAllowed()); 4256 ASSERT(AllowHeapAllocation::IsAllowed());
4257 if (!IsHeapIterable()) { 4257 if (!IsHeapIterable()) {
4258 CollectAllGarbage(kMakeHeapIterableMask, "Heap::MakeHeapIterable"); 4258 CollectAllGarbage(kMakeHeapIterableMask, "Heap::MakeHeapIterable");
4259 } 4259 }
4260 ASSERT(IsHeapIterable()); 4260 ASSERT(IsHeapIterable());
(...skipping 2182 matching lines...) Expand 10 before | Expand all | Expand 10 after
6443 static_cast<int>(object_sizes_last_time_[index])); 6443 static_cast<int>(object_sizes_last_time_[index]));
6444 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) 6444 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT)
6445 #undef ADJUST_LAST_TIME_OBJECT_COUNT 6445 #undef ADJUST_LAST_TIME_OBJECT_COUNT
6446 6446
6447 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 6447 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
6448 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 6448 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
6449 ClearObjectStats(); 6449 ClearObjectStats();
6450 } 6450 }
6451 6451
6452 } } // namespace v8::internal 6452 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/heap-snapshot-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698