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

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

Issue 8055029: Add experimental support for tracing the state of the VM heap to a file Base URL: http://v8.googlecode.com/svn/branches/experimental/heap-visualization/
Patch Set: Created 9 years, 2 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/heap.cc ('k') | src/mark-compact.cc » ('j') | src/spaces.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 679
680 intptr_t bytes_to_process = allocated_ * allocation_marking_factor_; 680 intptr_t bytes_to_process = allocated_ * allocation_marking_factor_;
681 681
682 double start = 0; 682 double start = 0;
683 683
684 if (FLAG_trace_incremental_marking || FLAG_trace_gc) { 684 if (FLAG_trace_incremental_marking || FLAG_trace_gc) {
685 start = OS::TimeCurrentMillis(); 685 start = OS::TimeCurrentMillis();
686 } 686 }
687 687
688 if (state_ == SWEEPING) { 688 if (state_ == SWEEPING) {
689 heap_->VisualizerTimeStamp(HeapVisualizer::kSweeping);
689 if (heap_->old_pointer_space()->AdvanceSweeper(bytes_to_process) && 690 if (heap_->old_pointer_space()->AdvanceSweeper(bytes_to_process) &&
690 heap_->old_data_space()->AdvanceSweeper(bytes_to_process)) { 691 heap_->old_data_space()->AdvanceSweeper(bytes_to_process)) {
691 StartMarking(); 692 StartMarking();
692 } 693 }
693 } else if (state_ == MARKING) { 694 } else if (state_ == MARKING) {
695 heap_->VisualizerTimeStamp(HeapVisualizer::kMarking);
694 Map* filler_map = heap_->one_pointer_filler_map(); 696 Map* filler_map = heap_->one_pointer_filler_map();
695 Map* global_context_map = heap_->global_context_map(); 697 Map* global_context_map = heap_->global_context_map();
696 IncrementalMarkingMarkingVisitor marking_visitor(heap_, this); 698 IncrementalMarkingMarkingVisitor marking_visitor(heap_, this);
697 while (!marking_deque_.IsEmpty() && bytes_to_process > 0) { 699 while (!marking_deque_.IsEmpty() && bytes_to_process > 0) {
698 HeapObject* obj = marking_deque_.Pop(); 700 HeapObject* obj = marking_deque_.Pop();
699 701
700 // Explicitly skip one word fillers. Incremental markbit patterns are 702 // Explicitly skip one word fillers. Incremental markbit patterns are
701 // correct only for objects that occupy at least two words. 703 // correct only for objects that occupy at least two words.
702 Map* map = obj->map(); 704 Map* map = obj->map();
703 if (map == filler_map) continue; 705 if (map == filler_map) continue;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 } 773 }
772 } 774 }
773 775
774 if (FLAG_trace_incremental_marking || FLAG_trace_gc) { 776 if (FLAG_trace_incremental_marking || FLAG_trace_gc) {
775 double end = OS::TimeCurrentMillis(); 777 double end = OS::TimeCurrentMillis();
776 double delta = (end - start); 778 double delta = (end - start);
777 longest_step_ = Max(longest_step_, delta); 779 longest_step_ = Max(longest_step_, delta);
778 steps_took_ += delta; 780 steps_took_ += delta;
779 steps_took_since_last_gc_ += delta; 781 steps_took_since_last_gc_ += delta;
780 } 782 }
783 heap_->VisualizerTimeStamp(HeapVisualizer::kRunning);
781 } 784 }
782 785
783 786
784 void IncrementalMarking::ResetStepCounters() { 787 void IncrementalMarking::ResetStepCounters() {
785 steps_count_ = 0; 788 steps_count_ = 0;
786 steps_took_ = 0; 789 steps_took_ = 0;
787 longest_step_ = 0.0; 790 longest_step_ = 0.0;
788 old_generation_space_available_at_start_of_incremental_ = 791 old_generation_space_available_at_start_of_incremental_ =
789 SpaceLeftInOldSpace(); 792 SpaceLeftInOldSpace();
790 old_generation_space_used_at_start_of_incremental_ = 793 old_generation_space_used_at_start_of_incremental_ =
791 heap_->PromotedTotalSize(); 794 heap_->PromotedTotalSize();
792 steps_count_since_last_gc_ = 0; 795 steps_count_since_last_gc_ = 0;
793 steps_took_since_last_gc_ = 0; 796 steps_took_since_last_gc_ = 0;
794 bytes_rescanned_ = 0; 797 bytes_rescanned_ = 0;
795 allocation_marking_factor_ = kInitialAllocationMarkingFactor; 798 allocation_marking_factor_ = kInitialAllocationMarkingFactor;
796 } 799 }
797 800
798 801
799 int64_t IncrementalMarking::SpaceLeftInOldSpace() { 802 int64_t IncrementalMarking::SpaceLeftInOldSpace() {
800 return heap_->MaxOldGenerationSize() - heap_->PromotedSpaceSize(); 803 return heap_->MaxOldGenerationSize() - heap_->PromotedSpaceSize();
801 } 804 }
802 805
803 } } // namespace v8::internal 806 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | src/mark-compact.cc » ('j') | src/spaces.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698