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

Unified Diff: runtime/vm/raw_object.h

Issue 673253002: Add missing StorePointer/StoreSmi in ContextScope. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 1 month 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/object.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/raw_object.h
===================================================================
--- runtime/vm/raw_object.h (revision 41399)
+++ runtime/vm/raw_object.h (working copy)
@@ -1211,13 +1211,21 @@
int32_t num_variables_;
RawObject** from() {
- return reinterpret_cast<RawObject**>(&ptr()->data()[0]);
+ VariableDesc* begin = const_cast<VariableDesc*>(ptr()->VariableDescAddr(0));
+ return reinterpret_cast<RawObject**>(begin);
}
// Variable length data follows here.
- RawObject** data() { OPEN_ARRAY_START(RawObject*, RawObject*); }
+ RawObject* const* data() const { OPEN_ARRAY_START(RawObject*, RawObject*); }
+ const VariableDesc* VariableDescAddr(intptr_t index) const {
+ ASSERT((index >= 0) && (index < num_variables_ + 1));
+ // data() points to the first component of the first descriptor.
+ return &(reinterpret_cast<const VariableDesc*>(data())[index]);
+ }
RawObject** to(intptr_t num_vars) {
- const intptr_t data_length = num_vars * (sizeof(VariableDesc)/kWordSize);
- return reinterpret_cast<RawObject**>(&ptr()->data()[data_length - 1]);
+ VariableDesc* end =
+ const_cast<VariableDesc*>(ptr()->VariableDescAddr(num_vars));
+ // 'end' points at the first word beyond the last descriptor, so step back.
+ return reinterpret_cast<RawObject**>(end) - 1;
Ivan Posva 2014/11/07 00:18:12 Pointer arithmetic?
}
};
« no previous file with comments | « runtime/vm/object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698