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

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

Issue 358363002: Move platform abstraction to base library (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: updates Created 6 years, 5 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
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/incremental-marking.h" 7 #include "src/incremental-marking.h"
8 8
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/compilation-cache.h" 10 #include "src/compilation-cache.h"
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 RecordWriteStub::Patch(Code::cast(e), mode); 492 RecordWriteStub::Patch(Code::cast(e), mode);
493 } 493 }
494 } 494 }
495 } 495 }
496 } 496 }
497 } 497 }
498 498
499 499
500 void IncrementalMarking::EnsureMarkingDequeIsCommitted() { 500 void IncrementalMarking::EnsureMarkingDequeIsCommitted() {
501 if (marking_deque_memory_ == NULL) { 501 if (marking_deque_memory_ == NULL) {
502 marking_deque_memory_ = new VirtualMemory(4 * MB); 502 marking_deque_memory_ = new base::VirtualMemory(4 * MB);
503 } 503 }
504 if (!marking_deque_memory_committed_) { 504 if (!marking_deque_memory_committed_) {
505 bool success = marking_deque_memory_->Commit( 505 bool success = marking_deque_memory_->Commit(
506 reinterpret_cast<Address>(marking_deque_memory_->address()), 506 reinterpret_cast<Address>(marking_deque_memory_->address()),
507 marking_deque_memory_->size(), 507 marking_deque_memory_->size(),
508 false); // Not executable. 508 false); // Not executable.
509 CHECK(success); 509 CHECK(success);
510 marking_deque_memory_committed_ = true; 510 marking_deque_memory_committed_ = true;
511 } 511 }
512 } 512 }
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 716
717 VisitObject(map, obj, obj->SizeFromMap(map)); 717 VisitObject(map, obj, obj->SizeFromMap(map));
718 } 718 }
719 } 719 }
720 720
721 721
722 void IncrementalMarking::Hurry() { 722 void IncrementalMarking::Hurry() {
723 if (state() == MARKING) { 723 if (state() == MARKING) {
724 double start = 0.0; 724 double start = 0.0;
725 if (FLAG_trace_incremental_marking || FLAG_print_cumulative_gc_stat) { 725 if (FLAG_trace_incremental_marking || FLAG_print_cumulative_gc_stat) {
726 start = OS::TimeCurrentMillis(); 726 start = base::OS::TimeCurrentMillis();
727 if (FLAG_trace_incremental_marking) { 727 if (FLAG_trace_incremental_marking) {
728 PrintF("[IncrementalMarking] Hurry\n"); 728 PrintF("[IncrementalMarking] Hurry\n");
729 } 729 }
730 } 730 }
731 // TODO(gc) hurry can mark objects it encounters black as mutator 731 // TODO(gc) hurry can mark objects it encounters black as mutator
732 // was stopped. 732 // was stopped.
733 ProcessMarkingDeque(); 733 ProcessMarkingDeque();
734 state_ = COMPLETE; 734 state_ = COMPLETE;
735 if (FLAG_trace_incremental_marking || FLAG_print_cumulative_gc_stat) { 735 if (FLAG_trace_incremental_marking || FLAG_print_cumulative_gc_stat) {
736 double end = OS::TimeCurrentMillis(); 736 double end = base::OS::TimeCurrentMillis();
737 double delta = end - start; 737 double delta = end - start;
738 heap_->AddMarkingTime(delta); 738 heap_->AddMarkingTime(delta);
739 if (FLAG_trace_incremental_marking) { 739 if (FLAG_trace_incremental_marking) {
740 PrintF("[IncrementalMarking] Complete (hurry), spent %d ms.\n", 740 PrintF("[IncrementalMarking] Complete (hurry), spent %d ms.\n",
741 static_cast<int>(delta)); 741 static_cast<int>(delta));
742 } 742 }
743 } 743 }
744 } 744 }
745 745
746 if (FLAG_cleanup_code_caches_at_gc) { 746 if (FLAG_cleanup_code_caches_at_gc) {
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 marking_speed_ * Max(allocated_, write_barriers_invoked_since_last_step_); 869 marking_speed_ * Max(allocated_, write_barriers_invoked_since_last_step_);
870 allocated_ = 0; 870 allocated_ = 0;
871 write_barriers_invoked_since_last_step_ = 0; 871 write_barriers_invoked_since_last_step_ = 0;
872 872
873 bytes_scanned_ += bytes_to_process; 873 bytes_scanned_ += bytes_to_process;
874 874
875 double start = 0; 875 double start = 0;
876 876
877 if (FLAG_trace_incremental_marking || FLAG_trace_gc || 877 if (FLAG_trace_incremental_marking || FLAG_trace_gc ||
878 FLAG_print_cumulative_gc_stat) { 878 FLAG_print_cumulative_gc_stat) {
879 start = OS::TimeCurrentMillis(); 879 start = base::OS::TimeCurrentMillis();
880 } 880 }
881 881
882 if (state_ == SWEEPING) { 882 if (state_ == SWEEPING) {
883 if (heap_->mark_compact_collector()->IsConcurrentSweepingInProgress() && 883 if (heap_->mark_compact_collector()->IsConcurrentSweepingInProgress() &&
884 heap_->mark_compact_collector()->IsSweepingCompleted()) { 884 heap_->mark_compact_collector()->IsSweepingCompleted()) {
885 heap_->mark_compact_collector()->WaitUntilSweepingCompleted(); 885 heap_->mark_compact_collector()->WaitUntilSweepingCompleted();
886 } 886 }
887 if (!heap_->mark_compact_collector()->IsConcurrentSweepingInProgress()) { 887 if (!heap_->mark_compact_collector()->IsConcurrentSweepingInProgress()) {
888 bytes_scanned_ = 0; 888 bytes_scanned_ = 0;
889 StartMarking(PREVENT_COMPACTION); 889 StartMarking(PREVENT_COMPACTION);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
954 Min(kMaxMarkingSpeed, 954 Min(kMaxMarkingSpeed,
955 static_cast<intptr_t>(marking_speed_ * 1.3))); 955 static_cast<intptr_t>(marking_speed_ * 1.3)));
956 if (FLAG_trace_gc) { 956 if (FLAG_trace_gc) {
957 PrintPID("Marking speed increased to %d\n", marking_speed_); 957 PrintPID("Marking speed increased to %d\n", marking_speed_);
958 } 958 }
959 } 959 }
960 } 960 }
961 961
962 if (FLAG_trace_incremental_marking || FLAG_trace_gc || 962 if (FLAG_trace_incremental_marking || FLAG_trace_gc ||
963 FLAG_print_cumulative_gc_stat) { 963 FLAG_print_cumulative_gc_stat) {
964 double end = OS::TimeCurrentMillis(); 964 double end = base::OS::TimeCurrentMillis();
965 double delta = (end - start); 965 double delta = (end - start);
966 longest_step_ = Max(longest_step_, delta); 966 longest_step_ = Max(longest_step_, delta);
967 steps_took_ += delta; 967 steps_took_ += delta;
968 steps_took_since_last_gc_ += delta; 968 steps_took_since_last_gc_ += delta;
969 heap_->AddMarkingTime(delta); 969 heap_->AddMarkingTime(delta);
970 } 970 }
971 } 971 }
972 972
973 973
974 void IncrementalMarking::ResetStepCounters() { 974 void IncrementalMarking::ResetStepCounters() {
(...skipping 11 matching lines...) Expand all
986 bytes_scanned_ = 0; 986 bytes_scanned_ = 0;
987 write_barriers_invoked_since_last_step_ = 0; 987 write_barriers_invoked_since_last_step_ = 0;
988 } 988 }
989 989
990 990
991 int64_t IncrementalMarking::SpaceLeftInOldSpace() { 991 int64_t IncrementalMarking::SpaceLeftInOldSpace() {
992 return heap_->MaxOldGenerationSize() - heap_->PromotedSpaceSizeOfObjects(); 992 return heap_->MaxOldGenerationSize() - heap_->PromotedSpaceSizeOfObjects();
993 } 993 }
994 994
995 } } // namespace v8::internal 995 } } // namespace v8::internal
OLDNEW
« src/base/macros.h ('K') | « src/incremental-marking.h ('k') | src/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698