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

Side by Side Diff: runtime/vm/scavenger.cc

Issue 2010673002: Add timeline event for weak handle processing. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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
« runtime/vm/gc_marker.cc ('K') | « runtime/vm/gc_marker.cc ('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 (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/scavenger.h" 5 #include "vm/scavenger.h"
6 6
7 #include "vm/dart.h" 7 #include "vm/dart.h"
8 #include "vm/dart_api_state.h" 8 #include "vm/dart_api_state.h"
9 #include "vm/isolate.h" 9 #include "vm/isolate.h"
10 #include "vm/lockers.h" 10 #include "vm/lockers.h"
11 #include "vm/object.h" 11 #include "vm/object.h"
12 #include "vm/object_id_ring.h" 12 #include "vm/object_id_ring.h"
13 #include "vm/safepoint.h" 13 #include "vm/safepoint.h"
14 #include "vm/stack_frame.h" 14 #include "vm/stack_frame.h"
15 #include "vm/store_buffer.h" 15 #include "vm/store_buffer.h"
16 #include "vm/thread_registry.h" 16 #include "vm/thread_registry.h"
17 #include "vm/timeline.h"
17 #include "vm/verified_memory.h" 18 #include "vm/verified_memory.h"
18 #include "vm/verifier.h" 19 #include "vm/verifier.h"
19 #include "vm/visitor.h" 20 #include "vm/visitor.h"
20 #include "vm/weak_table.h" 21 #include "vm/weak_table.h"
21 22
22 namespace dart { 23 namespace dart {
23 24
24 DEFINE_FLAG(int, early_tenuring_threshold, 66, 25 DEFINE_FLAG(int, early_tenuring_threshold, 66,
25 "When more than this percentage of promotion candidates survive, " 26 "When more than this percentage of promotion candidates survive, "
26 "promote all survivors of next scavenge."); 27 "promote all survivors of next scavenge.");
(...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 } 796 }
796 797
797 // Prepare for a scavenge. 798 // Prepare for a scavenge.
798 SpaceUsage usage_before = GetCurrentUsage(); 799 SpaceUsage usage_before = GetCurrentUsage();
799 intptr_t promo_candidate_words = 800 intptr_t promo_candidate_words =
800 (survivor_end_ - FirstObjectStart()) / kWordSize; 801 (survivor_end_ - FirstObjectStart()) / kWordSize;
801 SemiSpace* from = Prologue(isolate, invoke_api_callbacks); 802 SemiSpace* from = Prologue(isolate, invoke_api_callbacks);
802 // The API prologue/epilogue may create/destroy zones, so we must not 803 // The API prologue/epilogue may create/destroy zones, so we must not
803 // depend on zone allocations surviving beyond the epilogue callback. 804 // depend on zone allocations surviving beyond the epilogue callback.
804 { 805 {
805 StackZone zone(Thread::Current()); 806 Thread* thread = Thread::Current();
siva 2016/05/25 17:39:12 There is a Thread::Current() above in SafepointOpe
rmacnak 2016/05/25 17:53:26 Hoisted.
807 StackZone zone(thread);
806 // Setup the visitor and run the scavenge. 808 // Setup the visitor and run the scavenge.
807 ScavengerVisitor visitor(isolate, this, from); 809 ScavengerVisitor visitor(isolate, this, from);
808 page_space->AcquireDataLock(); 810 page_space->AcquireDataLock();
809 IterateRoots(isolate, &visitor); 811 IterateRoots(isolate, &visitor);
810 int64_t start = OS::GetCurrentTimeMicros(); 812 int64_t start = OS::GetCurrentTimeMicros();
811 ProcessToSpace(&visitor); 813 ProcessToSpace(&visitor);
812 int64_t middle = OS::GetCurrentTimeMicros(); 814 int64_t middle = OS::GetCurrentTimeMicros();
813 ScavengerWeakVisitor weak_visitor(this); 815 {
814 IterateWeakRoots(isolate, &weak_visitor); 816 TIMELINE_FUNCTION_GC_DURATION(thread, "WeakHandleProcessing");
817 ScavengerWeakVisitor weak_visitor(this);
818 IterateWeakRoots(isolate, &weak_visitor);
819 }
815 ProcessWeakReferences(); 820 ProcessWeakReferences();
816 page_space->ReleaseDataLock(); 821 page_space->ReleaseDataLock();
817 822
818 // Scavenge finished. Run accounting. 823 // Scavenge finished. Run accounting.
819 int64_t end = OS::GetCurrentTimeMicros(); 824 int64_t end = OS::GetCurrentTimeMicros();
820 heap_->RecordTime(kProcessToSpace, middle - start); 825 heap_->RecordTime(kProcessToSpace, middle - start);
821 heap_->RecordTime(kIterateWeaks, end - middle); 826 heap_->RecordTime(kIterateWeaks, end - middle);
822 stats_history_.Add( 827 stats_history_.Add(
823 ScavengeStats(start, end, 828 ScavengeStats(start, end,
824 usage_before, GetCurrentUsage(), 829 usage_before, GetCurrentUsage(),
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 } 886 }
882 887
883 888
884 void Scavenger::FreeExternal(intptr_t size) { 889 void Scavenger::FreeExternal(intptr_t size) {
885 ASSERT(size >= 0); 890 ASSERT(size >= 0);
886 external_size_ -= size; 891 external_size_ -= size;
887 ASSERT(external_size_ >= 0); 892 ASSERT(external_size_ >= 0);
888 } 893 }
889 894
890 } // namespace dart 895 } // namespace dart
OLDNEW
« runtime/vm/gc_marker.cc ('K') | « runtime/vm/gc_marker.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698