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

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

Issue 1308163006: Reduce the number of captured variables in async code, by only capturing local (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: address comments Created 5 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
« no previous file with comments | « runtime/vm/parser.cc ('k') | runtime/vm/scopes.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_SCOPES_H_ 5 #ifndef VM_SCOPES_H_
6 #define VM_SCOPES_H_ 6 #define VM_SCOPES_H_
7 7
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "platform/globals.h" 9 #include "platform/globals.h"
10 #include "vm/allocation.h" 10 #include "vm/allocation.h"
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 bool* found_captured_variables); 320 bool* found_captured_variables);
321 321
322 // Creates variable info for the scope and all its nested scopes. 322 // Creates variable info for the scope and all its nested scopes.
323 // Must be called after AllocateVariables() has been called. 323 // Must be called after AllocateVariables() has been called.
324 RawLocalVarDescriptors* GetVarDescriptors(const Function& func); 324 RawLocalVarDescriptors* GetVarDescriptors(const Function& func);
325 325
326 // Create a ContextScope object describing all captured variables referenced 326 // Create a ContextScope object describing all captured variables referenced
327 // from this scope and belonging to outer scopes. 327 // from this scope and belonging to outer scopes.
328 RawContextScope* PreserveOuterScope(int current_context_level) const; 328 RawContextScope* PreserveOuterScope(int current_context_level) const;
329 329
330 // Recursively traverses all siblings and children and marks all variables as 330 // Mark all local variables that are accessible from this scope up to
331 // captured. 331 // top_scope (included) as captured.
332 void RecursivelyCaptureAllVariables(); 332 void CaptureLocalVariables(LocalScope* top_scope);
333 333
334 // Creates a LocalScope representing the outer scope of a local function to be 334 // Creates a LocalScope representing the outer scope of a local function to be
335 // compiled. This outer scope contains the variables captured by the function 335 // compiled. This outer scope contains the variables captured by the function
336 // as specified by the given ContextScope, which was created during the 336 // as specified by the given ContextScope, which was created during the
337 // compilation of the enclosing function. 337 // compilation of the enclosing function.
338 static LocalScope* RestoreOuterScope(const ContextScope& context_scope); 338 static LocalScope* RestoreOuterScope(const ContextScope& context_scope);
339 339
340 // Create a ContextScope object which will capture "this" for an implicit 340 // Create a ContextScope object which will capture "this" for an implicit
341 // closure object. 341 // closure object.
342 static RawContextScope* CreateImplicitClosureScope(const Function& func); 342 static RawContextScope* CreateImplicitClosureScope(const Function& func);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 // List of names referenced in this scope and its children that 375 // List of names referenced in this scope and its children that
376 // are not resolved to local variables. 376 // are not resolved to local variables.
377 GrowableArray<NameReference*> referenced_; 377 GrowableArray<NameReference*> referenced_;
378 378
379 DISALLOW_COPY_AND_ASSIGN(LocalScope); 379 DISALLOW_COPY_AND_ASSIGN(LocalScope);
380 }; 380 };
381 381
382 } // namespace dart 382 } // namespace dart
383 383
384 #endif // VM_SCOPES_H_ 384 #endif // VM_SCOPES_H_
OLDNEW
« no previous file with comments | « runtime/vm/parser.cc ('k') | runtime/vm/scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698