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

Unified Diff: dart/runtime/vm/gc_marker.cc

Issue 143153006: Version 1.1.3 (stable) (Closed) Base URL: http://dart.googlecode.com/svn/branches/1.1/
Patch Set: Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « dart/runtime/bin/builtin.dart ('k') | dart/sdk/lib/core/uri.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/runtime/vm/gc_marker.cc
===================================================================
--- dart/runtime/vm/gc_marker.cc (revision 32272)
+++ dart/runtime/vm/gc_marker.cc (working copy)
@@ -6,6 +6,7 @@
#include <map>
#include <utility>
+#include <vector>
#include "vm/allocation.h"
#include "vm/dart_api_state.h"
@@ -192,10 +193,14 @@
std::pair<DelaySet::iterator, DelaySet::iterator> ret;
// Visit all elements with a key equal to raw_obj.
ret = delay_set_.equal_range(raw_obj);
- for (DelaySet::iterator it = ret.first; it != ret.second; ++it) {
+ // Create a copy of the range in a temporary vector to iterate over it
+ // while delay_set_ may be modified.
+ std::vector<DelaySetEntry> temp_copy(ret.first, ret.second);
+ delay_set_.erase(ret.first, ret.second);
+ for (std::vector<DelaySetEntry>::iterator it = temp_copy.begin();
+ it != temp_copy.end(); ++it) {
it->second->VisitPointers(this);
}
- delay_set_.erase(ret.first, ret.second);
raw_obj->ClearWatchedBit();
}
marking_stack_->Push(raw_obj);
@@ -261,6 +266,7 @@
MarkingStack* marking_stack_;
RawObject* visiting_old_object_;
typedef std::multimap<RawObject*, RawWeakProperty*> DelaySet;
+ typedef std::pair<RawObject*, RawWeakProperty*> DelaySetEntry;
DelaySet delay_set_;
const bool visit_function_code_;
GrowableArray<RawFunction*> skipped_code_functions_;
« no previous file with comments | « dart/runtime/bin/builtin.dart ('k') | dart/sdk/lib/core/uri.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698