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

Side by Side Diff: src/heap/incremental-marking.cc

Issue 1705183003: Activate memory reducer for small heaps in background tabs. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: typo Created 4 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.cc ('k') | src/heap/memory-reducer.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/incremental-marking.h" 5 #include "src/heap/incremental-marking.h"
6 6
7 #include "src/code-stubs.h" 7 #include "src/code-stubs.h"
8 #include "src/compilation-cache.h" 8 #include "src/compilation-cache.h"
9 #include "src/conversions.h" 9 #include "src/conversions.h"
10 #include "src/heap/gc-idle-time-handler.h" 10 #include "src/heap/gc-idle-time-handler.h"
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 436
437 LargePage* lop = heap_->lo_space()->first_page(); 437 LargePage* lop = heap_->lo_space()->first_page();
438 while (lop->is_valid()) { 438 while (lop->is_valid()) {
439 SetOldSpacePageFlags(lop, true, is_compacting_); 439 SetOldSpacePageFlags(lop, true, is_compacting_);
440 lop = lop->next_page(); 440 lop = lop->next_page();
441 } 441 }
442 } 442 }
443 443
444 444
445 bool IncrementalMarking::ShouldActivateEvenWithoutIdleNotification() { 445 bool IncrementalMarking::ShouldActivateEvenWithoutIdleNotification() {
446 #ifndef DEBUG
447 static const intptr_t kActivationThreshold = 8 * MB;
448 #else
449 // TODO(gc) consider setting this to some low level so that some
450 // debug tests run with incremental marking and some without.
451 static const intptr_t kActivationThreshold = 0;
452 #endif
453 // Don't switch on for very small heaps.
446 return CanBeActivated() && 454 return CanBeActivated() &&
455 heap_->PromotedSpaceSizeOfObjects() > kActivationThreshold &&
447 heap_->HeapIsFullEnoughToStartIncrementalMarking( 456 heap_->HeapIsFullEnoughToStartIncrementalMarking(
448 heap_->old_generation_allocation_limit()); 457 heap_->old_generation_allocation_limit());
449 } 458 }
450 459
451 460
452 bool IncrementalMarking::WasActivated() { return was_activated_; } 461 bool IncrementalMarking::WasActivated() { return was_activated_; }
453 462
454 463
455 bool IncrementalMarking::CanBeActivated() { 464 bool IncrementalMarking::CanBeActivated() {
456 #ifndef DEBUG
457 static const intptr_t kActivationThreshold = 8 * MB;
458 #else
459 // TODO(gc) consider setting this to some low level so that some
460 // debug tests run with incremental marking and some without.
461 static const intptr_t kActivationThreshold = 0;
462 #endif
463 // Only start incremental marking in a safe state: 1) when incremental 465 // Only start incremental marking in a safe state: 1) when incremental
464 // marking is turned on, 2) when we are currently not in a GC, and 466 // marking is turned on, 2) when we are currently not in a GC, and
465 // 3) when we are currently not serializing or deserializing the heap. 467 // 3) when we are currently not serializing or deserializing the heap.
466 // Don't switch on for very small heaps.
467 return FLAG_incremental_marking && heap_->gc_state() == Heap::NOT_IN_GC && 468 return FLAG_incremental_marking && heap_->gc_state() == Heap::NOT_IN_GC &&
468 heap_->deserialization_complete() && 469 heap_->deserialization_complete() &&
469 !heap_->isolate()->serializer_enabled() && 470 !heap_->isolate()->serializer_enabled();
470 heap_->PromotedSpaceSizeOfObjects() > kActivationThreshold;
471 } 471 }
472 472
473 473
474 void IncrementalMarking::ActivateGeneratedStub(Code* stub) { 474 void IncrementalMarking::ActivateGeneratedStub(Code* stub) {
475 DCHECK(RecordWriteStub::GetMode(stub) == RecordWriteStub::STORE_BUFFER_ONLY); 475 DCHECK(RecordWriteStub::GetMode(stub) == RecordWriteStub::STORE_BUFFER_ONLY);
476 476
477 if (!IsMarking()) { 477 if (!IsMarking()) {
478 // Initially stub is generated in STORE_BUFFER_ONLY mode thus 478 // Initially stub is generated in STORE_BUFFER_ONLY mode thus
479 // we don't need to do anything if incremental marking is 479 // we don't need to do anything if incremental marking is
480 // not active. 480 // not active.
(...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after
1238 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { 1238 void IncrementalMarking::IncrementIdleMarkingDelayCounter() {
1239 idle_marking_delay_counter_++; 1239 idle_marking_delay_counter_++;
1240 } 1240 }
1241 1241
1242 1242
1243 void IncrementalMarking::ClearIdleMarkingDelayCounter() { 1243 void IncrementalMarking::ClearIdleMarkingDelayCounter() {
1244 idle_marking_delay_counter_ = 0; 1244 idle_marking_delay_counter_ = 0;
1245 } 1245 }
1246 } // namespace internal 1246 } // namespace internal
1247 } // namespace v8 1247 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/heap.cc ('k') | src/heap/memory-reducer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698