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

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

Issue 12754003: Remove some assertion code in the GC from the release build. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 9 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 | « 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 (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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 class ScavengerVisitor : public ObjectPointerVisitor { 68 class ScavengerVisitor : public ObjectPointerVisitor {
69 public: 69 public:
70 explicit ScavengerVisitor(Isolate* isolate, Scavenger* scavenger) 70 explicit ScavengerVisitor(Isolate* isolate, Scavenger* scavenger)
71 : ObjectPointerVisitor(isolate), 71 : ObjectPointerVisitor(isolate),
72 scavenger_(scavenger), 72 scavenger_(scavenger),
73 heap_(scavenger->heap_), 73 heap_(scavenger->heap_),
74 vm_heap_(Dart::vm_isolate()->heap()), 74 vm_heap_(Dart::vm_isolate()->heap()),
75 delayed_weak_stack_(), 75 delayed_weak_stack_(),
76 growth_policy_(PageSpace::kControlGrowth), 76 growth_policy_(PageSpace::kControlGrowth),
77 bytes_promoted_(0), 77 bytes_promoted_(0),
78 visiting_old_pointers_(false), 78 #ifdef DEBUG
79 in_scavenge_pointer_(false) {} 79 in_scavenge_pointer_(false),
80 #endif
81 visiting_old_pointers_(false) { }
80 82
81 void VisitPointers(RawObject** first, RawObject** last) { 83 void VisitPointers(RawObject** first, RawObject** last) {
82 for (RawObject** current = first; current <= last; current++) { 84 for (RawObject** current = first; current <= last; current++) {
83 ScavengePointer(current); 85 ScavengePointer(current);
84 } 86 }
85 } 87 }
86 88
87 GrowableArray<RawObject*>* DelayedWeakStack() { 89 GrowableArray<RawObject*>* DelayedWeakStack() {
88 return &delayed_weak_stack_; 90 return &delayed_weak_stack_;
89 } 91 }
(...skipping 28 matching lines...) Expand all
118 ASSERT(!scavenger_->Contains(ptr)); 120 ASSERT(!scavenger_->Contains(ptr));
119 ASSERT(!heap_->CodeContains(ptr)); 121 ASSERT(!heap_->CodeContains(ptr));
120 ASSERT(heap_->Contains(ptr)); 122 ASSERT(heap_->Contains(ptr));
121 // If the newly written object is not a new object, drop it immediately. 123 // If the newly written object is not a new object, drop it immediately.
122 if (!obj->IsNewObject()) return; 124 if (!obj->IsNewObject()) return;
123 isolate()->store_buffer()->AddPointer(ptr); 125 isolate()->store_buffer()->AddPointer(ptr);
124 } 126 }
125 127
126 void ScavengePointer(RawObject** p) { 128 void ScavengePointer(RawObject** p) {
127 // ScavengePointer cannot be called recursively. 129 // ScavengePointer cannot be called recursively.
130 #ifdef DEBUG
128 ASSERT(!in_scavenge_pointer_); 131 ASSERT(!in_scavenge_pointer_);
129 BoolScope bs(&in_scavenge_pointer_, true); 132 BoolScope bs(&in_scavenge_pointer_, true);
133 #endif
130 134
131 RawObject* raw_obj = *p; 135 RawObject* raw_obj = *p;
132 136
133 // Fast exit if the raw object is a Smi or an old object. 137 // Fast exit if the raw object is a Smi or an old object.
134 if (!raw_obj->IsHeapObject() || raw_obj->IsOldObject()) { 138 if (!raw_obj->IsHeapObject() || raw_obj->IsOldObject()) {
135 return; 139 return;
136 } 140 }
137 141
138 uword raw_addr = RawObject::ToAddr(raw_obj); 142 uword raw_addr = RawObject::ToAddr(raw_obj);
139 // Objects should be contained in the heap. 143 // Objects should be contained in the heap.
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 Heap* heap_; 248 Heap* heap_;
245 Heap* vm_heap_; 249 Heap* vm_heap_;
246 typedef std::multimap<RawObject*, RawWeakProperty*> DelaySet; 250 typedef std::multimap<RawObject*, RawWeakProperty*> DelaySet;
247 DelaySet delay_set_; 251 DelaySet delay_set_;
248 GrowableArray<RawObject*> delayed_weak_stack_; 252 GrowableArray<RawObject*> delayed_weak_stack_;
249 PageSpace::GrowthPolicy growth_policy_; 253 PageSpace::GrowthPolicy growth_policy_;
250 // TODO(cshapiro): use this value to compute survival statistics for 254 // TODO(cshapiro): use this value to compute survival statistics for
251 // new space growth policy. 255 // new space growth policy.
252 intptr_t bytes_promoted_; 256 intptr_t bytes_promoted_;
253 257
258 #ifdef DEBUG
259 bool in_scavenge_pointer_;
260 #endif
254 bool visiting_old_pointers_; 261 bool visiting_old_pointers_;
255 bool in_scavenge_pointer_;
256 262
257 DISALLOW_COPY_AND_ASSIGN(ScavengerVisitor); 263 DISALLOW_COPY_AND_ASSIGN(ScavengerVisitor);
258 }; 264 };
259 265
260 266
261 class ScavengerWeakVisitor : public HandleVisitor { 267 class ScavengerWeakVisitor : public HandleVisitor {
262 public: 268 public:
263 explicit ScavengerWeakVisitor(Scavenger* scavenger) : scavenger_(scavenger) { 269 explicit ScavengerWeakVisitor(Scavenger* scavenger) : scavenger_(scavenger) {
264 } 270 }
265 271
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 PeerTable::iterator it = peer_table_.find(raw_obj); 710 PeerTable::iterator it = peer_table_.find(raw_obj);
705 return (it == peer_table_.end()) ? NULL : it->second; 711 return (it == peer_table_.end()) ? NULL : it->second;
706 } 712 }
707 713
708 714
709 int64_t Scavenger::PeerCount() const { 715 int64_t Scavenger::PeerCount() const {
710 return static_cast<int64_t>(peer_table_.size()); 716 return static_cast<int64_t>(peer_table_.size());
711 } 717 }
712 718
713 } // namespace dart 719 } // namespace dart
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