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

Unified Diff: runtime/vm/object.h

Issue 396213005: Fix PcDescriptor iteratot to never return a pointer to a memory location since the data can move wi… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 5 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 | « runtime/vm/debugger.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.h
===================================================================
--- runtime/vm/object.h (revision 38336)
+++ runtime/vm/object.h (working copy)
@@ -3042,7 +3042,8 @@
// We would have a VisitPointers function here to traverse the
// pc descriptors table to visit objects if any in the table.
-
+ // Note: never return a reference to a RawPcDescriptors::PcDescriptorRec
+ // as the object can move.
class Iterator : ValueObject {
public:
Iterator(const PcDescriptors& descriptors, intptr_t kind_mask)
@@ -3052,14 +3053,28 @@
bool HasNext() const { return current_ix_ < descriptors_.Length(); }
- const RawPcDescriptors::PcDescriptorRec& Next() {
+ intptr_t NextDeoptId() {
ASSERT(HasNext());
- const RawPcDescriptors::PcDescriptorRec* res =
- descriptors_.recAt(current_ix_++);
+ const intptr_t res = descriptors_.recAt(current_ix_++)->deopt_id();
MoveToMatching();
- return *res;
+ return res;
}
+ uword NextPc() {
+ ASSERT(HasNext());
+ const uword res = descriptors_.recAt(current_ix_++)->pc();
+ MoveToMatching();
+ return res;
+ }
+
+ void NextRec(RawPcDescriptors::PcDescriptorRec* result) {
+ ASSERT(HasNext());
+ const RawPcDescriptors::PcDescriptorRec* r =
+ descriptors_.recAt(current_ix_++);
+ r->CopyTo(result);
+ MoveToMatching();
+ }
+
private:
friend class PcDescriptors;
« no previous file with comments | « runtime/vm/debugger.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698