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

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

Issue 14714004: Fix incremental marking speed accelleration and start incremental marking when old space is almost … (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « src/incremental-marking.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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 marking_deque_memory_committed_ = false; 559 marking_deque_memory_committed_ = false;
560 } 560 }
561 } 561 }
562 562
563 563
564 void IncrementalMarking::Start() { 564 void IncrementalMarking::Start() {
565 if (FLAG_trace_incremental_marking) { 565 if (FLAG_trace_incremental_marking) {
566 PrintF("[IncrementalMarking] Start\n"); 566 PrintF("[IncrementalMarking] Start\n");
567 } 567 }
568 ASSERT(FLAG_incremental_marking); 568 ASSERT(FLAG_incremental_marking);
569 ASSERT(FLAG_incremental_marking_steps);
569 ASSERT(state_ == STOPPED); 570 ASSERT(state_ == STOPPED);
571 ASSERT(heap_->gc_state() == Heap::NOT_IN_GC);
572 ASSERT(!Serializer::enabled());
573 ASSERT(heap_->isolate()->IsInitialized());
570 574
571 ResetStepCounters(); 575 ResetStepCounters();
572 576
573 if (heap_->IsSweepingComplete()) { 577 if (heap_->IsSweepingComplete()) {
574 StartMarking(ALLOW_COMPACTION); 578 StartMarking(ALLOW_COMPACTION);
575 } else { 579 } else {
576 if (FLAG_trace_incremental_marking) { 580 if (FLAG_trace_incremental_marking) {
577 PrintF("[IncrementalMarking] Start sweeping.\n"); 581 PrintF("[IncrementalMarking] Start sweeping.\n");
578 } 582 }
579 state_ = SWEEPING; 583 state_ = SWEEPING;
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 set_should_hurry(true); 857 set_should_hurry(true);
854 if (FLAG_trace_incremental_marking) { 858 if (FLAG_trace_incremental_marking) {
855 PrintF("[IncrementalMarking] Complete (normal).\n"); 859 PrintF("[IncrementalMarking] Complete (normal).\n");
856 } 860 }
857 if (action == GC_VIA_STACK_GUARD) { 861 if (action == GC_VIA_STACK_GUARD) {
858 heap_->isolate()->stack_guard()->RequestGC(); 862 heap_->isolate()->stack_guard()->RequestGC();
859 } 863 }
860 } 864 }
861 865
862 866
867 void IncrementalMarking::OldSpaceStep(intptr_t allocated) {
868 if (IsStopped() && WorthActivating() && heap_->NextGCIsLikelyToBeFull()) {
869 // Only start incremental marking in a save state: 1) when we are not in
870 // a GC, 2) when we turned-on incremental marking, 3) when we are
871 // currently not serializing or deserializing the heap.
872 if (heap_->gc_state() != Heap::NOT_IN_GC ||
873 !FLAG_incremental_marking ||
874 !FLAG_incremental_marking_steps ||
875 Serializer::enabled() ||
876 !heap_->isolate()->IsInitialized()) {
877 return;
878 }
879 Start();
880 } else {
881 Step(allocated * kFastMarking / kInitialMarkingSpeed, GC_VIA_STACK_GUARD);
882 }
883 }
884
885
863 void IncrementalMarking::Step(intptr_t allocated_bytes, 886 void IncrementalMarking::Step(intptr_t allocated_bytes,
864 CompletionAction action) { 887 CompletionAction action) {
865 if (heap_->gc_state() != Heap::NOT_IN_GC || 888 if (heap_->gc_state() != Heap::NOT_IN_GC ||
866 !FLAG_incremental_marking || 889 !FLAG_incremental_marking ||
867 !FLAG_incremental_marking_steps || 890 !FLAG_incremental_marking_steps ||
868 (state_ != SWEEPING && state_ != MARKING)) { 891 (state_ != SWEEPING && state_ != MARKING)) {
869 return; 892 return;
870 } 893 }
871 894
872 allocated_ += allocated_bytes; 895 allocated_ += allocated_bytes;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
958 } 981 }
959 speed_up = true; 982 speed_up = true;
960 } 983 }
961 984
962 if (speed_up) { 985 if (speed_up) {
963 if (state_ != MARKING) { 986 if (state_ != MARKING) {
964 if (FLAG_trace_gc) { 987 if (FLAG_trace_gc) {
965 PrintPID("Postponing speeding up marking until marking starts\n"); 988 PrintPID("Postponing speeding up marking until marking starts\n");
966 } 989 }
967 } else { 990 } else {
968 marking_speed_ += kMarkingSpeedAccellerationInterval; 991 marking_speed_ += kMarkingSpeedAccelleration;
969 marking_speed_ = static_cast<int>( 992 marking_speed_ = static_cast<int>(
970 Min(kMaxMarkingSpeed, 993 Min(kMaxMarkingSpeed,
971 static_cast<intptr_t>(marking_speed_ * 1.3))); 994 static_cast<intptr_t>(marking_speed_ * 1.3)));
972 if (FLAG_trace_gc) { 995 if (FLAG_trace_gc) {
973 PrintPID("Marking speed increased to %d\n", marking_speed_); 996 PrintPID("Marking speed increased to %d\n", marking_speed_);
974 } 997 }
975 } 998 }
976 } 999 }
977 1000
978 if (FLAG_trace_incremental_marking || FLAG_trace_gc || 1001 if (FLAG_trace_incremental_marking || FLAG_trace_gc ||
(...skipping 23 matching lines...) Expand all
1002 bytes_scanned_ = 0; 1025 bytes_scanned_ = 0;
1003 write_barriers_invoked_since_last_step_ = 0; 1026 write_barriers_invoked_since_last_step_ = 0;
1004 } 1027 }
1005 1028
1006 1029
1007 int64_t IncrementalMarking::SpaceLeftInOldSpace() { 1030 int64_t IncrementalMarking::SpaceLeftInOldSpace() {
1008 return heap_->MaxOldGenerationSize() - heap_->PromotedSpaceSizeOfObjects(); 1031 return heap_->MaxOldGenerationSize() - heap_->PromotedSpaceSizeOfObjects();
1009 } 1032 }
1010 1033
1011 } } // namespace v8::internal 1034 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/incremental-marking.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698