OLD | NEW |
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 <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 heap_->RecordData(kStoreBufferEntries, total_count); | 539 heap_->RecordData(kStoreBufferEntries, total_count); |
540 heap_->RecordData(kDataUnused1, 0); | 540 heap_->RecordData(kDataUnused1, 0); |
541 heap_->RecordData(kDataUnused2, 0); | 541 heap_->RecordData(kDataUnused2, 0); |
542 // Done iterating through old objects remembered in the store buffers. | 542 // Done iterating through old objects remembered in the store buffers. |
543 visitor->VisitingOldObject(NULL); | 543 visitor->VisitingOldObject(NULL); |
544 } | 544 } |
545 | 545 |
546 | 546 |
547 void Scavenger::IterateObjectIdTable(Isolate* isolate, | 547 void Scavenger::IterateObjectIdTable(Isolate* isolate, |
548 ScavengerVisitor* visitor) { | 548 ScavengerVisitor* visitor) { |
| 549 #ifndef PRODUCT |
549 ObjectIdRing* ring = isolate->object_id_ring(); | 550 ObjectIdRing* ring = isolate->object_id_ring(); |
550 if (ring == NULL) { | 551 if (ring == NULL) { |
551 // --gc_at_alloc can get us here before the ring has been initialized. | 552 // --gc_at_alloc can get us here before the ring has been initialized. |
552 ASSERT(FLAG_gc_at_alloc); | 553 ASSERT(FLAG_gc_at_alloc); |
553 return; | 554 return; |
554 } | 555 } |
555 ring->VisitPointers(visitor); | 556 ring->VisitPointers(visitor); |
| 557 #endif // !PRODUCT |
556 } | 558 } |
557 | 559 |
558 | 560 |
559 void Scavenger::IterateRoots(Isolate* isolate, ScavengerVisitor* visitor) { | 561 void Scavenger::IterateRoots(Isolate* isolate, ScavengerVisitor* visitor) { |
560 int64_t start = OS::GetCurrentTimeMicros(); | 562 int64_t start = OS::GetCurrentTimeMicros(); |
561 isolate->VisitObjectPointers(visitor, | 563 isolate->VisitObjectPointers(visitor, |
562 StackFrameIterator::kDontValidateFrames); | 564 StackFrameIterator::kDontValidateFrames); |
563 int64_t middle = OS::GetCurrentTimeMicros(); | 565 int64_t middle = OS::GetCurrentTimeMicros(); |
564 IterateStoreBuffers(isolate, visitor); | 566 IterateStoreBuffers(isolate, visitor); |
565 IterateObjectIdTable(isolate, visitor); | 567 IterateObjectIdTable(isolate, visitor); |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
827 } | 829 } |
828 | 830 |
829 | 831 |
830 void Scavenger::WriteProtect(bool read_only) { | 832 void Scavenger::WriteProtect(bool read_only) { |
831 ASSERT(!scavenging_); | 833 ASSERT(!scavenging_); |
832 to_->WriteProtect(read_only); | 834 to_->WriteProtect(read_only); |
833 } | 835 } |
834 | 836 |
835 | 837 |
836 void Scavenger::PrintToJSONObject(JSONObject* object) const { | 838 void Scavenger::PrintToJSONObject(JSONObject* object) const { |
| 839 if (!FLAG_support_service) { |
| 840 return; |
| 841 } |
837 Isolate* isolate = Isolate::Current(); | 842 Isolate* isolate = Isolate::Current(); |
838 ASSERT(isolate != NULL); | 843 ASSERT(isolate != NULL); |
839 JSONObject space(object, "new"); | 844 JSONObject space(object, "new"); |
840 space.AddProperty("type", "HeapSpace"); | 845 space.AddProperty("type", "HeapSpace"); |
841 space.AddProperty("name", "new"); | 846 space.AddProperty("name", "new"); |
842 space.AddProperty("vmName", "Scavenger"); | 847 space.AddProperty("vmName", "Scavenger"); |
843 space.AddProperty("collections", collections()); | 848 space.AddProperty("collections", collections()); |
844 if (collections() > 0) { | 849 if (collections() > 0) { |
845 int64_t run_time = OS::GetCurrentTimeMicros() - isolate->start_time(); | 850 int64_t run_time = OS::GetCurrentTimeMicros() - isolate->start_time(); |
846 run_time = Utils::Maximum(run_time, static_cast<int64_t>(0)); | 851 run_time = Utils::Maximum(run_time, static_cast<int64_t>(0)); |
(...skipping 18 matching lines...) Expand all Loading... |
865 } | 870 } |
866 | 871 |
867 | 872 |
868 void Scavenger::FreeExternal(intptr_t size) { | 873 void Scavenger::FreeExternal(intptr_t size) { |
869 ASSERT(size >= 0); | 874 ASSERT(size >= 0); |
870 external_size_ -= size; | 875 external_size_ -= size; |
871 ASSERT(external_size_ >= 0); | 876 ASSERT(external_size_ >= 0); |
872 } | 877 } |
873 | 878 |
874 } // namespace dart | 879 } // namespace dart |
OLD | NEW |