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

Side by Side Diff: runtime/vm/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 | « no previous file | runtime/vm/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_OBJECT_H_ 5 #ifndef VM_OBJECT_H_
6 #define VM_OBJECT_H_ 6 #define VM_OBJECT_H_
7 7
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "platform/utils.h" 10 #include "platform/utils.h"
(...skipping 3073 matching lines...) Expand 10 before | Expand all | Expand 10 after
3084 RawLocalVarDescriptors::VarInfo* info) const; 3084 RawLocalVarDescriptors::VarInfo* info) const;
3085 3085
3086 void GetInfo(intptr_t var_index, RawLocalVarDescriptors::VarInfo* info) const; 3086 void GetInfo(intptr_t var_index, RawLocalVarDescriptors::VarInfo* info) const;
3087 3087
3088 static const intptr_t kBytesPerElement = 3088 static const intptr_t kBytesPerElement =
3089 sizeof(RawLocalVarDescriptors::VarInfo); 3089 sizeof(RawLocalVarDescriptors::VarInfo);
3090 static const intptr_t kMaxElements = RawLocalVarDescriptors::kMaxIndex; 3090 static const intptr_t kMaxElements = RawLocalVarDescriptors::kMaxIndex;
3091 3091
3092 static intptr_t InstanceSize() { 3092 static intptr_t InstanceSize() {
3093 ASSERT(sizeof(RawLocalVarDescriptors) == 3093 ASSERT(sizeof(RawLocalVarDescriptors) ==
3094 OFFSET_OF_RETURNED_VALUE(RawLocalVarDescriptors, data)); 3094 OFFSET_OF_RETURNED_VALUE(RawLocalVarDescriptors, names));
3095 return 0; 3095 return 0;
3096 } 3096 }
3097 static intptr_t InstanceSize(intptr_t len) { 3097 static intptr_t InstanceSize(intptr_t len) {
3098 ASSERT(0 <= len && len <= kMaxElements); 3098 ASSERT(0 <= len && len <= kMaxElements);
3099 return RoundedAllocationSize( 3099 return RoundedAllocationSize(sizeof(RawLocalVarDescriptors)
3100 sizeof(RawLocalVarDescriptors) + (len * kBytesPerElement)); 3100 + (len * kWordSize) // RawStrings for names.
3101 + (len * sizeof(RawLocalVarDescriptors::VarInfo)));
3101 } 3102 }
3102 3103
3103 static RawLocalVarDescriptors* New(intptr_t num_variables); 3104 static RawLocalVarDescriptors* New(intptr_t num_variables);
3104 3105
3105 static const char* KindToStr(intptr_t kind); 3106 static const char* KindToStr(intptr_t kind);
3106 3107
3107 private: 3108 private:
3108 FINAL_HEAP_OBJECT_IMPLEMENTATION(LocalVarDescriptors, Object); 3109 FINAL_HEAP_OBJECT_IMPLEMENTATION(LocalVarDescriptors, Object);
3109 friend class Class; 3110 friend class Class;
3110 friend class Object; 3111 friend class Object;
(...skipping 4340 matching lines...) Expand 10 before | Expand all | Expand 10 after
7451 7452
7452 7453
7453 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 7454 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
7454 intptr_t index) { 7455 intptr_t index) {
7455 return array.At((index * kEntryLength) + kTargetFunctionIndex); 7456 return array.At((index * kEntryLength) + kTargetFunctionIndex);
7456 } 7457 }
7457 7458
7458 } // namespace dart 7459 } // namespace dart
7459 7460
7460 #endif // VM_OBJECT_H_ 7461 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698