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

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') | 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/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 3257 matching lines...) Expand 10 before | Expand all | Expand 10 after
4403 new_space_.Shrink(); 4405 new_space_.Shrink();
4404 UncommitFromSpace(); 4406 UncommitFromSpace();
4405 } 4407 }
4406 } 4408 }
4407 4409
4408 4410
4409 void Heap::TryFinalizeIdleIncrementalMarking( 4411 void Heap::TryFinalizeIdleIncrementalMarking(
4410 double idle_time_in_ms, size_t size_of_objects, 4412 double idle_time_in_ms, size_t size_of_objects,
4411 size_t final_incremental_mark_compact_speed_in_bytes_per_ms) { 4413 size_t final_incremental_mark_compact_speed_in_bytes_per_ms) {
4412 if (incremental_marking()->IsComplete() || 4414 if (incremental_marking()->IsComplete() ||
4413 (incremental_marking()->IsMarkingDequeEmpty() && 4415 (mark_compact_collector_.marking_deque()->IsEmpty() &&
4414 gc_idle_time_handler_.ShouldDoFinalIncrementalMarkCompact( 4416 gc_idle_time_handler_.ShouldDoFinalIncrementalMarkCompact(
4415 static_cast<size_t>(idle_time_in_ms), size_of_objects, 4417 static_cast<size_t>(idle_time_in_ms), size_of_objects,
4416 final_incremental_mark_compact_speed_in_bytes_per_ms))) { 4418 final_incremental_mark_compact_speed_in_bytes_per_ms))) {
4417 CollectAllGarbage(kNoGCFlags, "idle notification: finalize incremental"); 4419 CollectAllGarbage(kNoGCFlags, "idle notification: finalize incremental");
4418 } 4420 }
4419 } 4421 }
4420 4422
4421 4423
4422 bool Heap::WorthActivatingIncrementalMarking() { 4424 bool Heap::WorthActivatingIncrementalMarking() {
4423 return incremental_marking()->IsStopped() && 4425 return incremental_marking()->IsStopped() &&
(...skipping 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after
5500 property_cell_space_ = NULL; 5502 property_cell_space_ = NULL;
5501 } 5503 }
5502 5504
5503 if (lo_space_ != NULL) { 5505 if (lo_space_ != NULL) {
5504 lo_space_->TearDown(); 5506 lo_space_->TearDown();
5505 delete lo_space_; 5507 delete lo_space_;
5506 lo_space_ = NULL; 5508 lo_space_ = NULL;
5507 } 5509 }
5508 5510
5509 store_buffer()->TearDown(); 5511 store_buffer()->TearDown();
5510 incremental_marking()->TearDown();
5511 5512
5512 isolate_->memory_allocator()->TearDown(); 5513 isolate_->memory_allocator()->TearDown();
5513 } 5514 }
5514 5515
5515 5516
5516 void Heap::AddGCPrologueCallback(v8::Isolate::GCPrologueCallback callback, 5517 void Heap::AddGCPrologueCallback(v8::Isolate::GCPrologueCallback callback,
5517 GCType gc_type, bool pass_isolate) { 5518 GCType gc_type, bool pass_isolate) {
5518 DCHECK(callback != NULL); 5519 DCHECK(callback != NULL);
5519 GCPrologueCallbackPair pair(callback, gc_type, pass_isolate); 5520 GCPrologueCallbackPair pair(callback, gc_type, pass_isolate);
5520 DCHECK(!gc_prologue_callbacks_.Contains(pair)); 5521 DCHECK(!gc_prologue_callbacks_.Contains(pair));
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after
6368 static_cast<int>(object_sizes_last_time_[index])); 6369 static_cast<int>(object_sizes_last_time_[index]));
6369 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) 6370 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT)
6370 #undef ADJUST_LAST_TIME_OBJECT_COUNT 6371 #undef ADJUST_LAST_TIME_OBJECT_COUNT
6371 6372
6372 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 6373 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
6373 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 6374 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
6374 ClearObjectStats(); 6375 ClearObjectStats();
6375 } 6376 }
6376 } 6377 }
6377 } // namespace v8::internal 6378 } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/heap/incremental-marking.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698