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

Side by Side Diff: src/heap.cc

Issue 2665001: Count Mark-Compact/Mark-Sweep collections only after compaction decision was made (Closed)
Patch Set: set full gc count to a correct value Created 10 years, 6 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 | « no previous file | 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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 ASSERT(!allocation_allowed_); 650 ASSERT(!allocation_allowed_);
651 GCTracer::Scope scope(tracer, GCTracer::Scope::EXTERNAL); 651 GCTracer::Scope scope(tracer, GCTracer::Scope::EXTERNAL);
652 global_gc_epilogue_callback_(); 652 global_gc_epilogue_callback_();
653 } 653 }
654 VerifySymbolTable(); 654 VerifySymbolTable();
655 } 655 }
656 656
657 657
658 void Heap::MarkCompact(GCTracer* tracer) { 658 void Heap::MarkCompact(GCTracer* tracer) {
659 gc_state_ = MARK_COMPACT; 659 gc_state_ = MARK_COMPACT;
660 if (MarkCompactCollector::IsCompacting()) {
661 mc_count_++;
662 } else {
663 ms_count_++;
664 }
665 tracer->set_full_gc_count(mc_count_);
666 LOG(ResourceEvent("markcompact", "begin")); 660 LOG(ResourceEvent("markcompact", "begin"));
667 661
668 MarkCompactCollector::Prepare(tracer); 662 MarkCompactCollector::Prepare(tracer);
669 663
670 bool is_compacting = MarkCompactCollector::IsCompacting(); 664 bool is_compacting = MarkCompactCollector::IsCompacting();
671 665
666 if (is_compacting) {
667 mc_count_++;
668 } else {
669 ms_count_++;
670 }
671 tracer->set_full_gc_count(mc_count_ + ms_count_);
672
672 MarkCompactPrologue(is_compacting); 673 MarkCompactPrologue(is_compacting);
673 674
674 MarkCompactCollector::CollectGarbage(); 675 MarkCompactCollector::CollectGarbage();
675 676
676 MarkCompactEpilogue(is_compacting); 677 MarkCompactEpilogue(is_compacting);
677 678
678 LOG(ResourceEvent("markcompact", "end")); 679 LOG(ResourceEvent("markcompact", "end"));
679 680
680 gc_state_ = NOT_IN_GC; 681 gc_state_ = NOT_IN_GC;
681 682
(...skipping 3971 matching lines...) Expand 10 before | Expand all | Expand 10 after
4653 void ExternalStringTable::TearDown() { 4654 void ExternalStringTable::TearDown() {
4654 new_space_strings_.Free(); 4655 new_space_strings_.Free();
4655 old_space_strings_.Free(); 4656 old_space_strings_.Free();
4656 } 4657 }
4657 4658
4658 4659
4659 List<Object*> ExternalStringTable::new_space_strings_; 4660 List<Object*> ExternalStringTable::new_space_strings_;
4660 List<Object*> ExternalStringTable::old_space_strings_; 4661 List<Object*> ExternalStringTable::old_space_strings_;
4661 4662
4662 } } // namespace v8::internal 4663 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698