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

Side by Side Diff: src/heap/heap.cc

Issue 770453003: Use just one marking deque. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « no previous file | src/heap/incremental-marking.h » ('j') | src/heap/mark-compact.cc » ('J')
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/bits.h" 9 #include "src/base/bits.h"
10 #include "src/base/once.h" 10 #include "src/base/once.h"
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 const int kMinNumberOfAttempts = 2; 761 const int kMinNumberOfAttempts = 2;
762 for (int attempt = 0; attempt < kMaxNumberOfAttempts; attempt++) { 762 for (int attempt = 0; attempt < kMaxNumberOfAttempts; attempt++) {
763 if (!CollectGarbage(MARK_COMPACTOR, gc_reason, NULL) && 763 if (!CollectGarbage(MARK_COMPACTOR, gc_reason, NULL) &&
764 attempt + 1 >= kMinNumberOfAttempts) { 764 attempt + 1 >= kMinNumberOfAttempts) {
765 break; 765 break;
766 } 766 }
767 } 767 }
768 mark_compact_collector()->SetFlags(kNoGCFlags); 768 mark_compact_collector()->SetFlags(kNoGCFlags);
769 new_space_.Shrink(); 769 new_space_.Shrink();
770 UncommitFromSpace(); 770 UncommitFromSpace();
771 incremental_marking()->UncommitMarkingDeque();
772 } 771 }
773 772
774 773
775 void Heap::EnsureFillerObjectAtTop() { 774 void Heap::EnsureFillerObjectAtTop() {
776 // There may be an allocation memento behind every object in new space. 775 // There may be an allocation memento behind every object in new space.
777 // If we evacuate a not full new space or if we are on the last page of 776 // If we evacuate a not full new space or if we are on the last page of
778 // the new space, then there may be uninitialized memory behind the top 777 // the new space, then there may be uninitialized memory behind the top
779 // pointer of the new space page. We store a filler object there to 778 // pointer of the new space page. We store a filler object there to
780 // identify the unused space. 779 // identify the unused space.
781 Address from_top = new_space_.top(); 780 Address from_top = new_space_.top();
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
1126 1125
1127 // Update relocatables. 1126 // Update relocatables.
1128 Relocatable::PostGarbageCollectionProcessing(isolate_); 1127 Relocatable::PostGarbageCollectionProcessing(isolate_);
1129 1128
1130 if (collector == MARK_COMPACTOR) { 1129 if (collector == MARK_COMPACTOR) {
1131 // Register the amount of external allocated memory. 1130 // Register the amount of external allocated memory.
1132 amount_of_external_allocated_memory_at_last_global_gc_ = 1131 amount_of_external_allocated_memory_at_last_global_gc_ =
1133 amount_of_external_allocated_memory_; 1132 amount_of_external_allocated_memory_;
1134 old_generation_allocation_limit_ = OldGenerationAllocationLimit( 1133 old_generation_allocation_limit_ = OldGenerationAllocationLimit(
1135 PromotedSpaceSizeOfObjects(), freed_global_handles); 1134 PromotedSpaceSizeOfObjects(), freed_global_handles);
1135 // We finished a marking cycle. We can uncommit the marking deque until
1136 // we start marking again.
1137 mark_compact_collector_.UncommitMarkingDeque();
1136 } 1138 }
1137 1139
1138 { 1140 {
1139 GCCallbacksScope scope(this); 1141 GCCallbacksScope scope(this);
1140 if (scope.CheckReenter()) { 1142 if (scope.CheckReenter()) {
1141 AllowHeapAllocation allow_allocation; 1143 AllowHeapAllocation allow_allocation;
1142 GCTracer::Scope scope(tracer(), GCTracer::Scope::EXTERNAL); 1144 GCTracer::Scope scope(tracer(), GCTracer::Scope::EXTERNAL);
1143 VMState<EXTERNAL> state(isolate_); 1145 VMState<EXTERNAL> state(isolate_);
1144 HandleScope handle_scope(isolate_); 1146 HandleScope handle_scope(isolate_);
1145 CallGCEpilogueCallbacks(gc_type, gc_callback_flags); 1147 CallGCEpilogueCallbacks(gc_type, gc_callback_flags);
(...skipping 3236 matching lines...) Expand 10 before | Expand all | Expand 10 after
4382 new_space_.Shrink(); 4384 new_space_.Shrink();
4383 UncommitFromSpace(); 4385 UncommitFromSpace();
4384 } 4386 }
4385 } 4387 }
4386 4388
4387 4389
4388 void Heap::TryFinalizeIdleIncrementalMarking( 4390 void Heap::TryFinalizeIdleIncrementalMarking(
4389 double idle_time_in_ms, size_t size_of_objects, 4391 double idle_time_in_ms, size_t size_of_objects,
4390 size_t final_incremental_mark_compact_speed_in_bytes_per_ms) { 4392 size_t final_incremental_mark_compact_speed_in_bytes_per_ms) {
4391 if (incremental_marking()->IsComplete() || 4393 if (incremental_marking()->IsComplete() ||
4392 (incremental_marking()->IsMarkingDequeEmpty() && 4394 (mark_compact_collector_.marking_deque()->IsEmpty() &&
4393 gc_idle_time_handler_.ShouldDoFinalIncrementalMarkCompact( 4395 gc_idle_time_handler_.ShouldDoFinalIncrementalMarkCompact(
4394 static_cast<size_t>(idle_time_in_ms), size_of_objects, 4396 static_cast<size_t>(idle_time_in_ms), size_of_objects,
4395 final_incremental_mark_compact_speed_in_bytes_per_ms))) { 4397 final_incremental_mark_compact_speed_in_bytes_per_ms))) {
4396 CollectAllGarbage(kNoGCFlags, "idle notification: finalize incremental"); 4398 CollectAllGarbage(kNoGCFlags, "idle notification: finalize incremental");
4397 } 4399 }
4398 } 4400 }
4399 4401
4400 4402
4401 bool Heap::WorthActivatingIncrementalMarking() { 4403 bool Heap::WorthActivatingIncrementalMarking() {
4402 return incremental_marking()->IsStopped() && 4404 return incremental_marking()->IsStopped() &&
(...skipping 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after
5479 property_cell_space_ = NULL; 5481 property_cell_space_ = NULL;
5480 } 5482 }
5481 5483
5482 if (lo_space_ != NULL) { 5484 if (lo_space_ != NULL) {
5483 lo_space_->TearDown(); 5485 lo_space_->TearDown();
5484 delete lo_space_; 5486 delete lo_space_;
5485 lo_space_ = NULL; 5487 lo_space_ = NULL;
5486 } 5488 }
5487 5489
5488 store_buffer()->TearDown(); 5490 store_buffer()->TearDown();
5489 incremental_marking()->TearDown();
5490 5491
5491 isolate_->memory_allocator()->TearDown(); 5492 isolate_->memory_allocator()->TearDown();
5492 } 5493 }
5493 5494
5494 5495
5495 void Heap::AddGCPrologueCallback(v8::Isolate::GCPrologueCallback callback, 5496 void Heap::AddGCPrologueCallback(v8::Isolate::GCPrologueCallback callback,
5496 GCType gc_type, bool pass_isolate) { 5497 GCType gc_type, bool pass_isolate) {
5497 DCHECK(callback != NULL); 5498 DCHECK(callback != NULL);
5498 GCPrologueCallbackPair pair(callback, gc_type, pass_isolate); 5499 GCPrologueCallbackPair pair(callback, gc_type, pass_isolate);
5499 DCHECK(!gc_prologue_callbacks_.Contains(pair)); 5500 DCHECK(!gc_prologue_callbacks_.Contains(pair));
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after
6347 static_cast<int>(object_sizes_last_time_[index])); 6348 static_cast<int>(object_sizes_last_time_[index]));
6348 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) 6349 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT)
6349 #undef ADJUST_LAST_TIME_OBJECT_COUNT 6350 #undef ADJUST_LAST_TIME_OBJECT_COUNT
6350 6351
6351 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 6352 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
6352 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 6353 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
6353 ClearObjectStats(); 6354 ClearObjectStats();
6354 } 6355 }
6355 } 6356 }
6356 } // namespace v8::internal 6357 } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/heap/incremental-marking.h » ('j') | src/heap/mark-compact.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698