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

Side by Side Diff: runtime/vm/scopes.cc

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/raw_object.cc ('k') | no next file » | 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 #include "vm/scopes.h" 5 #include "vm/scopes.h"
6 6
7 #include "vm/object.h" 7 #include "vm/object.h"
8 #include "vm/stack_frame.h" 8 #include "vm/stack_frame.h"
9 #include "vm/symbols.h" 9 #include "vm/symbols.h"
10 10
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 void LocalScope::CollectLocalVariables(GrowableArray<VarDesc>* vars, 290 void LocalScope::CollectLocalVariables(GrowableArray<VarDesc>* vars,
291 int16_t* scope_id) { 291 int16_t* scope_id) {
292 (*scope_id)++; 292 (*scope_id)++;
293 if (HasContextLevel() && 293 if (HasContextLevel() &&
294 ((parent() == NULL) || 294 ((parent() == NULL) ||
295 (!parent()->HasContextLevel()) || 295 (!parent()->HasContextLevel()) ||
296 (parent()->context_level() != context_level()))) { 296 (parent()->context_level() != context_level()))) {
297 // This is the outermost scope with a context level or this scope's 297 // This is the outermost scope with a context level or this scope's
298 // context level differs from its parent's level. 298 // context level differs from its parent's level.
299 VarDesc desc; 299 VarDesc desc;
300 desc.name = &Object::null_string(); // No name. 300 desc.name = &Symbols::Empty(); // No name.
301 desc.info.set_kind(RawLocalVarDescriptors::kContextLevel); 301 desc.info.set_kind(RawLocalVarDescriptors::kContextLevel);
302 desc.info.scope_id = *scope_id; 302 desc.info.scope_id = *scope_id;
303 desc.info.begin_pos = begin_token_pos(); 303 desc.info.begin_pos = begin_token_pos();
304 desc.info.end_pos = end_token_pos(); 304 desc.info.end_pos = end_token_pos();
305 desc.info.set_index(context_level()); 305 desc.info.set_index(context_level());
306 vars->Add(desc); 306 vars->Add(desc);
307 } 307 }
308 for (int i = 0; i < this->variables_.length(); i++) { 308 for (int i = 0; i < this->variables_.length(); i++) {
309 LocalVariable* var = variables_[i]; 309 LocalVariable* var = variables_[i];
310 if ((var->owner() == this) && !var->is_invisible()) { 310 if ((var->owner() == this) && !var->is_invisible()) {
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 return fixed_parameter_count - (index() - kParamEndSlotFromFp); 672 return fixed_parameter_count - (index() - kParamEndSlotFromFp);
673 } else { 673 } else {
674 // Shift negative indexes so that the lowest one is 0 (they are still 674 // Shift negative indexes so that the lowest one is 0 (they are still
675 // non-positive). 675 // non-positive).
676 return fixed_parameter_count - (index() - kFirstLocalSlotFromFp); 676 return fixed_parameter_count - (index() - kFirstLocalSlotFromFp);
677 } 677 }
678 } 678 }
679 679
680 680
681 } // namespace dart 681 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/raw_object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698