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

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

Issue 2316513002: [heap] Cleanup heap.h (Closed)
Patch Set: Created 4 years, 3 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') | src/heap/heap-inl.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/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 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 isolate()->CountUsage(static_cast<v8::Isolate::UseCounterFeature>(i)); 416 isolate()->CountUsage(static_cast<v8::Isolate::UseCounterFeature>(i));
417 } 417 }
418 } 418 }
419 } 419 }
420 420
421 421
422 void Heap::IncrementDeferredCount(v8::Isolate::UseCounterFeature feature) { 422 void Heap::IncrementDeferredCount(v8::Isolate::UseCounterFeature feature) {
423 deferred_counters_[feature]++; 423 deferred_counters_[feature]++;
424 } 424 }
425 425
426 bool Heap::UncommitFromSpace() { return new_space_.UncommitFromSpace(); }
426 427
427 void Heap::GarbageCollectionPrologue() { 428 void Heap::GarbageCollectionPrologue() {
428 { 429 {
429 AllowHeapAllocation for_the_first_part_of_prologue; 430 AllowHeapAllocation for_the_first_part_of_prologue;
430 gc_count_++; 431 gc_count_++;
431 432
432 #ifdef VERIFY_HEAP 433 #ifdef VERIFY_HEAP
433 if (FLAG_verify_heap) { 434 if (FLAG_verify_heap) {
434 Verify(); 435 Verify();
435 } 436 }
(...skipping 4772 matching lines...) Expand 10 before | Expand all | Expand 10 after
5208 intptr_t old_gen_size) { 5209 intptr_t old_gen_size) {
5209 CHECK(factor > 1.0); 5210 CHECK(factor > 1.0);
5210 CHECK(old_gen_size > 0); 5211 CHECK(old_gen_size > 0);
5211 intptr_t limit = static_cast<intptr_t>(old_gen_size * factor); 5212 intptr_t limit = static_cast<intptr_t>(old_gen_size * factor);
5212 limit = Max(limit, old_gen_size + MinimumAllocationLimitGrowingStep()); 5213 limit = Max(limit, old_gen_size + MinimumAllocationLimitGrowingStep());
5213 limit += new_space_.Capacity(); 5214 limit += new_space_.Capacity();
5214 intptr_t halfway_to_the_max = (old_gen_size + max_old_generation_size_) / 2; 5215 intptr_t halfway_to_the_max = (old_gen_size + max_old_generation_size_) / 2;
5215 return Min(limit, halfway_to_the_max); 5216 return Min(limit, halfway_to_the_max);
5216 } 5217 }
5217 5218
5219 intptr_t Heap::MinimumAllocationLimitGrowingStep() {
5220 const double kRegularAllocationLimitGrowingStep = 8;
5221 const double kLowMemoryAllocationLimitGrowingStep = 2;
5222 intptr_t limit = (Page::kPageSize > MB ? Page::kPageSize : MB);
5223 return limit * (ShouldOptimizeForMemoryUsage()
5224 ? kLowMemoryAllocationLimitGrowingStep
5225 : kRegularAllocationLimitGrowingStep);
5226 }
5218 5227
5219 void Heap::SetOldGenerationAllocationLimit(intptr_t old_gen_size, 5228 void Heap::SetOldGenerationAllocationLimit(intptr_t old_gen_size,
5220 double gc_speed, 5229 double gc_speed,
5221 double mutator_speed) { 5230 double mutator_speed) {
5222 double factor = HeapGrowingFactor(gc_speed, mutator_speed); 5231 double factor = HeapGrowingFactor(gc_speed, mutator_speed);
5223 5232
5224 if (FLAG_trace_gc_verbose) { 5233 if (FLAG_trace_gc_verbose) {
5225 isolate_->PrintWithTimestamp( 5234 isolate_->PrintWithTimestamp(
5226 "Heap growing factor %.1f based on mu=%.3f, speed_ratio=%.f " 5235 "Heap growing factor %.1f based on mu=%.3f, speed_ratio=%.f "
5227 "(gc=%.f, mutator=%.f)\n", 5236 "(gc=%.f, mutator=%.f)\n",
(...skipping 1299 matching lines...) Expand 10 before | Expand all | Expand 10 after
6527 } 6536 }
6528 6537
6529 6538
6530 // static 6539 // static
6531 int Heap::GetStaticVisitorIdForMap(Map* map) { 6540 int Heap::GetStaticVisitorIdForMap(Map* map) {
6532 return StaticVisitorBase::GetVisitorId(map); 6541 return StaticVisitorBase::GetVisitorId(map);
6533 } 6542 }
6534 6543
6535 } // namespace internal 6544 } // namespace internal
6536 } // namespace v8 6545 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/heap-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698