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

Side by Side Diff: src/heap/heap.cc

Issue 894703002: Add a flag to over approximate the weak closure during GC (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 5 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.h ('k') | src/heap/incremental-marking.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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api.h" 8 #include "src/api.h"
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/base/once.h" 10 #include "src/base/once.h"
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 #ifdef DEBUG 727 #ifdef DEBUG
728 ReportStatisticsAfterGC(); 728 ReportStatisticsAfterGC();
729 #endif // DEBUG 729 #endif // DEBUG
730 730
731 // Remember the last top pointer so that we can later find out 731 // Remember the last top pointer so that we can later find out
732 // whether we allocated in new space since the last GC. 732 // whether we allocated in new space since the last GC.
733 new_space_top_after_last_gc_ = new_space()->top(); 733 new_space_top_after_last_gc_ = new_space()->top();
734 } 734 }
735 735
736 736
737 void Heap::HandleGCRequest() {
738 if (incremental_marking()->request_type() ==
739 IncrementalMarking::COMPLETE_MARKING) {
740 CollectAllGarbage(Heap::kNoGCFlags, "GC interrupt");
741 return;
742 }
743 DCHECK(FLAG_overapproximate_weak_closure);
744 DCHECK(!incremental_marking()->weak_closure_was_overapproximated());
745 OverApproximateWeakClosure("GC interrupt");
746 }
747
748
749 void Heap::OverApproximateWeakClosure(const char* gc_reason) {
750 if (FLAG_trace_incremental_marking) {
751 PrintF("[IncrementalMarking] Overapproximate weak closure (%s).\n",
752 gc_reason);
753 }
754 {
755 GCCallbacksScope scope(this);
756 if (scope.CheckReenter()) {
757 AllowHeapAllocation allow_allocation;
758 GCTracer::Scope scope(tracer(), GCTracer::Scope::EXTERNAL);
759 VMState<EXTERNAL> state(isolate_);
760 HandleScope handle_scope(isolate_);
761 CallGCPrologueCallbacks(kGCTypeMarkSweepCompact, kNoGCCallbackFlags);
762 }
763 }
764 mark_compact_collector()->OverApproximateWeakClosure();
765 incremental_marking()->set_should_hurry(false);
766 incremental_marking()->set_weak_closure_was_overapproximated(true);
767 {
768 GCCallbacksScope scope(this);
769 if (scope.CheckReenter()) {
770 AllowHeapAllocation allow_allocation;
771 GCTracer::Scope scope(tracer(), GCTracer::Scope::EXTERNAL);
772 VMState<EXTERNAL> state(isolate_);
773 HandleScope handle_scope(isolate_);
774 CallGCEpilogueCallbacks(kGCTypeMarkSweepCompact, kNoGCCallbackFlags);
775 }
776 }
777 }
778
779
737 void Heap::CollectAllGarbage(int flags, const char* gc_reason, 780 void Heap::CollectAllGarbage(int flags, const char* gc_reason,
738 const v8::GCCallbackFlags gc_callback_flags) { 781 const v8::GCCallbackFlags gc_callback_flags) {
739 // Since we are ignoring the return value, the exact choice of space does 782 // Since we are ignoring the return value, the exact choice of space does
740 // not matter, so long as we do not specify NEW_SPACE, which would not 783 // not matter, so long as we do not specify NEW_SPACE, which would not
741 // cause a full GC. 784 // cause a full GC.
742 mark_compact_collector_.SetFlags(flags); 785 mark_compact_collector_.SetFlags(flags);
743 CollectGarbage(OLD_POINTER_SPACE, gc_reason, gc_callback_flags); 786 CollectGarbage(OLD_POINTER_SPACE, gc_reason, gc_callback_flags);
744 mark_compact_collector_.SetFlags(kNoGCFlags); 787 mark_compact_collector_.SetFlags(kNoGCFlags);
745 } 788 }
746 789
(...skipping 5742 matching lines...) Expand 10 before | Expand all | Expand 10 after
6489 static_cast<int>(object_sizes_last_time_[index])); 6532 static_cast<int>(object_sizes_last_time_[index]));
6490 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) 6533 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT)
6491 #undef ADJUST_LAST_TIME_OBJECT_COUNT 6534 #undef ADJUST_LAST_TIME_OBJECT_COUNT
6492 6535
6493 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 6536 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
6494 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 6537 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
6495 ClearObjectStats(); 6538 ClearObjectStats();
6496 } 6539 }
6497 } 6540 }
6498 } // namespace v8::internal 6541 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/incremental-marking.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698