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

Unified Diff: runtime/vm/scopes.cc

Issue 565513002: Optimize LocalVarDescriptor objects for functions that have no local variables (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
« no previous file with comments | « runtime/vm/raw_object.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/scopes.cc
===================================================================
--- runtime/vm/scopes.cc (revision 40154)
+++ runtime/vm/scopes.cc (working copy)
@@ -266,6 +266,9 @@
int16_t scope_id = 0;
CollectLocalVariables(&vars, &scope_id);
+ if (vars.length() == 0) {
+ return Object::empty_var_descriptors().raw();
+ }
const LocalVarDescriptors& var_desc =
LocalVarDescriptors::Handle(LocalVarDescriptors::New(vars.length()));
for (int i = 0; i < vars.length(); i++) {
@@ -294,7 +297,7 @@
// This is the outermost scope with a context level or this scope's
// context level differs from its parent's level.
VarDesc desc;
- desc.name = &String::Handle(); // No name.
+ desc.name = &Object::null_string(); // No name.
desc.info.set_kind(RawLocalVarDescriptors::kContextLevel);
desc.info.scope_id = *scope_id;
desc.info.begin_pos = begin_token_pos();
« no previous file with comments | « runtime/vm/raw_object.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698