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

Side by Side Diff: runtime/vm/raw_object.h

Issue 577443003: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/raw_object.cc » ('j') | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 #ifndef VM_RAW_OBJECT_H_ 5 #ifndef VM_RAW_OBJECT_H_
6 #define VM_RAW_OBJECT_H_ 6 #define VM_RAW_OBJECT_H_
7 7
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/atomic.h" 9 #include "vm/atomic.h"
10 #include "vm/globals.h" 10 #include "vm/globals.h"
(...skipping 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after
1090 int32_t index() const { 1090 int32_t index() const {
1091 return IndexBits::decode(index_kind) - kIndexBias; 1091 return IndexBits::decode(index_kind) - kIndexBias;
1092 } 1092 }
1093 void set_index(int32_t index) { 1093 void set_index(int32_t index) {
1094 index_kind = IndexBits::update(index + kIndexBias, index_kind); 1094 index_kind = IndexBits::update(index + kIndexBias, index_kind);
1095 } 1095 }
1096 }; 1096 };
1097 1097
1098 private: 1098 private:
1099 RAW_HEAP_OBJECT_IMPLEMENTATION(LocalVarDescriptors); 1099 RAW_HEAP_OBJECT_IMPLEMENTATION(LocalVarDescriptors);
1100 RawArray* names_; // Array of [length_] variable names. 1100 int32_t num_entries_; // Number of descriptors.
1101 int32_t length_; // Number of descriptors.
1102 1101
1103 // Variable info with [length_] entries. 1102 RawObject** from() {
1104 VarInfo* data() { OPEN_ARRAY_START(VarInfo, int32_t); } 1103 return reinterpret_cast<RawObject**>(&ptr()->names()[0]);
1104 }
1105 RawString** names() {
1106 // Array of [num_entries_] variable names.
1107 OPEN_ARRAY_START(RawString*, RawString*);
1108 }
1109 RawString** nameAddrAt(intptr_t i) {
1110 return &(ptr()->names()[i]);
1111 }
1112
1113 RawObject** to(intptr_t num_entries) {
1114 return reinterpret_cast<RawObject**>(nameAddrAt(num_entries - 1));
1115 }
1116
1117 // Variable info with [num_entries_] entries.
1118 VarInfo* data() {
1119 return reinterpret_cast<VarInfo*>(nameAddrAt(ptr()->num_entries_));
1120 }
1105 1121
1106 friend class Object; 1122 friend class Object;
1107 }; 1123 };
1108 1124
1109 1125
1110 class RawExceptionHandlers : public RawObject { 1126 class RawExceptionHandlers : public RawObject {
1111 public: 1127 public:
1112 // The index into the ExceptionHandlers table corresponds to 1128 // The index into the ExceptionHandlers table corresponds to
1113 // the try_index of the handler. 1129 // the try_index of the handler.
1114 struct HandlerInfo { 1130 struct HandlerInfo {
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after
2036 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == 2052 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid ==
2037 kTypedDataInt8ArrayViewCid + 15); 2053 kTypedDataInt8ArrayViewCid + 15);
2038 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); 2054 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14);
2039 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); 2055 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1);
2040 return (kNullCid - kTypedDataInt8ArrayCid); 2056 return (kNullCid - kTypedDataInt8ArrayCid);
2041 } 2057 }
2042 2058
2043 } // namespace dart 2059 } // namespace dart
2044 2060
2045 #endif // VM_RAW_OBJECT_H_ 2061 #endif // VM_RAW_OBJECT_H_
OLDNEW
« no previous file with comments | « 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