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

Unified Diff: runtime/vm/raw_object.h

Issue 566053002: Save more memory by compacting LocalVarDescriptors (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 3 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
Index: runtime/vm/raw_object.h
===================================================================
--- runtime/vm/raw_object.h (revision 40213)
+++ runtime/vm/raw_object.h (working copy)
@@ -1097,12 +1097,24 @@
private:
RAW_HEAP_OBJECT_IMPLEMENTATION(LocalVarDescriptors);
- RawArray* names_; // Array of [length_] variable names.
- int32_t length_; // Number of descriptors.
+ int32_t num_entries_; // Number of descriptors.
- // Variable info with [length_] entries.
- VarInfo* data() { OPEN_ARRAY_START(VarInfo, int32_t); }
+ RawObject** from() {
+ return reinterpret_cast<RawObject**>(&ptr()->names()[0]);
+ }
+ RawString** names() {
+ // Array of [num_entries_] variable names.
+ OPEN_ARRAY_START(RawString*, RawString*);
+ }
siva 2014/09/12 22:08:39 For better readability I think it would make sense
hausner 2014/09/12 23:48:04 Added a function to return the address of name[i].
+ RawObject** to(intptr_t num_entries) {
+ return reinterpret_cast<RawObject**>(&ptr()->names()[num_entries - 1]);
siva 2014/09/12 22:08:39 return reinterpret_cast<RawObject**>(&nameAt(num_e
hausner 2014/09/12 23:48:04 You can't take the address of a return value.
+ }
+ // Variable info with [num_entries_] entries.
+ VarInfo* data() {
+ return reinterpret_cast<VarInfo*>(&(names()[num_entries_]));
+ }
+
friend class Object;
};
« runtime/vm/object.cc ('K') | « runtime/vm/object.cc ('k') | runtime/vm/raw_object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698