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

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

Issue 2687113002: [heap] no longer perform GC to make heap iterable. (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « src/heap/heap.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 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/heap/heap.h" 5 #include "src/heap/heap.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/ast/context-slot-cache.h" 9 #include "src/ast/context-slot-cache.h"
10 #include "src/base/bits.h" 10 #include "src/base/bits.h"
(...skipping 4049 matching lines...) Expand 10 before | Expand all | Expand 10 after
4060 Struct* result = nullptr; 4060 Struct* result = nullptr;
4061 { 4061 {
4062 AllocationResult allocation = Allocate(map, OLD_SPACE); 4062 AllocationResult allocation = Allocate(map, OLD_SPACE);
4063 if (!allocation.To(&result)) return allocation; 4063 if (!allocation.To(&result)) return allocation;
4064 } 4064 }
4065 result->InitializeBody(size); 4065 result->InitializeBody(size);
4066 return result; 4066 return result;
4067 } 4067 }
4068 4068
4069 4069
4070 bool Heap::IsHeapIterable() {
4071 // TODO(hpayer): This function is not correct. Allocation folding in old
4072 // space breaks the iterability.
4073 return new_space_top_after_last_gc_ == new_space()->top();
4074 }
4075
4076
4077 void Heap::MakeHeapIterable() { 4070 void Heap::MakeHeapIterable() {
Hannes Payer (out of office) 2017/02/10 07:37:18 FYI: We do not need to wait for sweepers to make t
4078 DCHECK(AllowHeapAllocation::IsAllowed());
4079 if (!IsHeapIterable()) {
4080 CollectAllGarbage(kMakeHeapIterableMask,
4081 GarbageCollectionReason::kMakeHeapIterable);
4082 }
4083 mark_compact_collector()->EnsureSweepingCompleted(); 4071 mark_compact_collector()->EnsureSweepingCompleted();
4084 DCHECK(IsHeapIterable());
4085 } 4072 }
4086 4073
4087 4074
4088 static double ComputeMutatorUtilization(double mutator_speed, double gc_speed) { 4075 static double ComputeMutatorUtilization(double mutator_speed, double gc_speed) {
4089 const double kMinMutatorUtilization = 0.0; 4076 const double kMinMutatorUtilization = 0.0;
4090 const double kConservativeGcSpeedInBytesPerMillisecond = 200000; 4077 const double kConservativeGcSpeedInBytesPerMillisecond = 200000;
4091 if (mutator_speed == 0) return kMinMutatorUtilization; 4078 if (mutator_speed == 0) return kMinMutatorUtilization;
4092 if (gc_speed == 0) gc_speed = kConservativeGcSpeedInBytesPerMillisecond; 4079 if (gc_speed == 0) gc_speed = kConservativeGcSpeedInBytesPerMillisecond;
4093 // Derivation: 4080 // Derivation:
4094 // mutator_utilization = mutator_time / (mutator_time + gc_time) 4081 // mutator_utilization = mutator_time / (mutator_time + gc_time)
(...skipping 2015 matching lines...) Expand 10 before | Expand all | Expand 10 after
6110 void MarkReachableObjects() { 6097 void MarkReachableObjects() {
6111 MarkingVisitor visitor; 6098 MarkingVisitor visitor;
6112 heap_->IterateRoots(&visitor, VISIT_ALL); 6099 heap_->IterateRoots(&visitor, VISIT_ALL);
6113 visitor.TransitiveClosure(); 6100 visitor.TransitiveClosure();
6114 } 6101 }
6115 6102
6116 Heap* heap_; 6103 Heap* heap_;
6117 DisallowHeapAllocation no_allocation_; 6104 DisallowHeapAllocation no_allocation_;
6118 }; 6105 };
6119 6106
6120
6121 HeapIterator::HeapIterator(Heap* heap, 6107 HeapIterator::HeapIterator(Heap* heap,
6122 HeapIterator::HeapObjectsFiltering filtering) 6108 HeapIterator::HeapObjectsFiltering filtering)
6123 : make_heap_iterable_helper_(heap), 6109 : no_heap_allocation_(),
6124 no_heap_allocation_(),
6125 heap_(heap), 6110 heap_(heap),
6126 filtering_(filtering), 6111 filtering_(filtering),
6127 filter_(nullptr), 6112 filter_(nullptr),
6128 space_iterator_(nullptr), 6113 space_iterator_(nullptr),
6129 object_iterator_(nullptr) { 6114 object_iterator_(nullptr) {
6115 heap_->MakeHeapIterable();
6130 heap_->heap_iterator_start(); 6116 heap_->heap_iterator_start();
6131 // Start the iteration. 6117 // Start the iteration.
6132 space_iterator_ = new SpaceIterator(heap_); 6118 space_iterator_ = new SpaceIterator(heap_);
6133 switch (filtering_) { 6119 switch (filtering_) {
6134 case kFilterUnreachable: 6120 case kFilterUnreachable:
6135 filter_ = new UnreachableObjectsFilter(heap_); 6121 filter_ = new UnreachableObjectsFilter(heap_);
6136 break; 6122 break;
6137 default: 6123 default:
6138 break; 6124 break;
6139 } 6125 }
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
6553 } 6539 }
6554 6540
6555 6541
6556 // static 6542 // static
6557 int Heap::GetStaticVisitorIdForMap(Map* map) { 6543 int Heap::GetStaticVisitorIdForMap(Map* map) {
6558 return StaticVisitorBase::GetVisitorId(map); 6544 return StaticVisitorBase::GetVisitorId(map);
6559 } 6545 }
6560 6546
6561 } // namespace internal 6547 } // namespace internal
6562 } // namespace v8 6548 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/heap.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698