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

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

Issue 148263011: Revert r32064, r32064 to fix Windows build. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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 | 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/gc_marker.h" 5 #include "vm/gc_marker.h"
6 6
7 #include <map> 7 #include <map>
8 #include <utility> 8 #include <utility>
9 #include <vector>
10 9
11 #include "vm/allocation.h" 10 #include "vm/allocation.h"
12 #include "vm/dart_api_state.h" 11 #include "vm/dart_api_state.h"
13 #include "vm/isolate.h" 12 #include "vm/isolate.h"
14 #include "vm/pages.h" 13 #include "vm/pages.h"
15 #include "vm/raw_object.h" 14 #include "vm/raw_object.h"
16 #include "vm/stack_frame.h" 15 #include "vm/stack_frame.h"
17 #include "vm/visitor.h" 16 #include "vm/visitor.h"
18 #include "vm/object_id_ring.h" 17 #include "vm/object_id_ring.h"
19 18
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 152
154 void DelayWeakProperty(RawWeakProperty* raw_weak) { 153 void DelayWeakProperty(RawWeakProperty* raw_weak) {
155 RawObject* raw_key = raw_weak->ptr()->key_; 154 RawObject* raw_key = raw_weak->ptr()->key_;
156 DelaySet::iterator it = delay_set_.find(raw_key); 155 DelaySet::iterator it = delay_set_.find(raw_key);
157 if (it != delay_set_.end()) { 156 if (it != delay_set_.end()) {
158 ASSERT(raw_key->IsWatched()); 157 ASSERT(raw_key->IsWatched());
159 } else { 158 } else {
160 ASSERT(!raw_key->IsWatched()); 159 ASSERT(!raw_key->IsWatched());
161 raw_key->SetWatchedBit(); 160 raw_key->SetWatchedBit();
162 } 161 }
163 delay_set_.insert(DelaySet::value_type(raw_key, raw_weak)); 162 delay_set_.insert(std::make_pair(raw_key, raw_weak));
164 } 163 }
165 164
166 void Finalize() { 165 void Finalize() {
167 DelaySet::iterator it = delay_set_.begin(); 166 DelaySet::iterator it = delay_set_.begin();
168 for (; it != delay_set_.end(); ++it) { 167 for (; it != delay_set_.end(); ++it) {
169 WeakProperty::Clear(it->second); 168 WeakProperty::Clear(it->second);
170 } 169 }
171 if (!visit_function_code_) { 170 if (!visit_function_code_) {
172 DetachCode(); 171 DetachCode();
173 } 172 }
(...skipping 13 matching lines...) Expand all
187 186
188 // Mark the object and push it on the marking stack. 187 // Mark the object and push it on the marking stack.
189 ASSERT(!raw_obj->IsMarked()); 188 ASSERT(!raw_obj->IsMarked());
190 RawClass* raw_class = isolate()->class_table()->At(raw_obj->GetClassId()); 189 RawClass* raw_class = isolate()->class_table()->At(raw_obj->GetClassId());
191 raw_obj->SetMarkBit(); 190 raw_obj->SetMarkBit();
192 raw_obj->ClearRememberedBit(); 191 raw_obj->ClearRememberedBit();
193 if (raw_obj->IsWatched()) { 192 if (raw_obj->IsWatched()) {
194 std::pair<DelaySet::iterator, DelaySet::iterator> ret; 193 std::pair<DelaySet::iterator, DelaySet::iterator> ret;
195 // Visit all elements with a key equal to raw_obj. 194 // Visit all elements with a key equal to raw_obj.
196 ret = delay_set_.equal_range(raw_obj); 195 ret = delay_set_.equal_range(raw_obj);
197 // Create a copy of the range in a temporary vector to iterate over it 196 for (DelaySet::iterator it = ret.first; it != ret.second; ++it) {
198 // while delay_set_ may be modified.
199 std::vector<DelaySet::value_type> temp_copy(ret.first, ret.second);
200 delay_set_.erase(ret.first, ret.second);
201 for (std::vector<DelaySet::value_type>::iterator it = temp_copy.begin();
202 it != temp_copy.end(); ++it) {
203 it->second->VisitPointers(this); 197 it->second->VisitPointers(this);
204 } 198 }
199 delay_set_.erase(ret.first, ret.second);
205 raw_obj->ClearWatchedBit(); 200 raw_obj->ClearWatchedBit();
206 } 201 }
207 marking_stack_->Push(raw_obj); 202 marking_stack_->Push(raw_obj);
208 203
209 // TODO(iposva): Should we mark the classes early? 204 // TODO(iposva): Should we mark the classes early?
210 MarkObject(raw_class, NULL); 205 MarkObject(raw_class, NULL);
211 } 206 }
212 207
213 void MarkObject(RawObject* raw_obj, RawObject** p) { 208 void MarkObject(RawObject* raw_obj, RawObject** p) {
214 // Fast exit if the raw object is a Smi. 209 // Fast exit if the raw object is a Smi.
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 MarkingWeakVisitor mark_weak; 491 MarkingWeakVisitor mark_weak;
497 IterateWeakRoots(isolate, &mark_weak, invoke_api_callbacks); 492 IterateWeakRoots(isolate, &mark_weak, invoke_api_callbacks);
498 mark.Finalize(); 493 mark.Finalize();
499 ProcessWeakTables(page_space); 494 ProcessWeakTables(page_space);
500 ProcessObjectIdTable(isolate); 495 ProcessObjectIdTable(isolate);
501 496
502 Epilogue(isolate, invoke_api_callbacks); 497 Epilogue(isolate, invoke_api_callbacks);
503 } 498 }
504 499
505 } // namespace dart 500 } // 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