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

Side by Side Diff: src/ast/scopes.h

Issue 2352593002: Preparse inner functions (new try) (Closed)
Patch Set: add comment Created 4 years, 2 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 | « no previous file | src/ast/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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_AST_SCOPES_H_ 5 #ifndef V8_AST_SCOPES_H_
6 #define V8_AST_SCOPES_H_ 6 #define V8_AST_SCOPES_H_
7 7
8 #include "src/base/hashmap.h" 8 #include "src/base/hashmap.h"
9 #include "src/globals.h" 9 #include "src/globals.h"
10 #include "src/objects.h" 10 #include "src/objects.h"
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 // --------------------------------------------------------------------------- 335 // ---------------------------------------------------------------------------
336 // Variable allocation. 336 // Variable allocation.
337 337
338 // Result of variable allocation. 338 // Result of variable allocation.
339 int num_stack_slots() const { return num_stack_slots_; } 339 int num_stack_slots() const { return num_stack_slots_; }
340 int num_heap_slots() const { return num_heap_slots_; } 340 int num_heap_slots() const { return num_heap_slots_; }
341 341
342 int StackLocalCount() const; 342 int StackLocalCount() const;
343 int ContextLocalCount() const; 343 int ContextLocalCount() const;
344 344
345 // Determine if we can parse a function literal in this scope lazily. 345 // Determine if we can parse a function literal in this scope lazily without
346 bool AllowsLazyParsing() const; 346 // caring about the unresolved variables within.
347 bool AllowsLazyParsingWithoutUnresolvedVariables() const;
347 348
348 // The number of contexts between this and scope; zero if this == scope. 349 // The number of contexts between this and scope; zero if this == scope.
349 int ContextChainLength(Scope* scope) const; 350 int ContextChainLength(Scope* scope) const;
350 351
351 // The number of contexts between this and the outermost context that has a 352 // The number of contexts between this and the outermost context that has a
352 // sloppy eval call. One if this->calls_sloppy_eval(). 353 // sloppy eval call. One if this->calls_sloppy_eval().
353 int ContextChainLengthUntilOutermostSloppyEval() const; 354 int ContextChainLengthUntilOutermostSloppyEval() const;
354 355
355 // The maximum number of nested contexts required for this scope and any inner 356 // The maximum number of nested contexts required for this scope and any inner
356 // scopes. 357 // scopes.
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 // to the calling context of 'eval'. 532 // to the calling context of 'eval'.
532 Variable* LookupRecursive(VariableProxy* proxy, Scope* outer_scope_end); 533 Variable* LookupRecursive(VariableProxy* proxy, Scope* outer_scope_end);
533 void ResolveTo(ParseInfo* info, VariableProxy* proxy, Variable* var); 534 void ResolveTo(ParseInfo* info, VariableProxy* proxy, Variable* var);
534 void ResolveVariable(ParseInfo* info, VariableProxy* proxy); 535 void ResolveVariable(ParseInfo* info, VariableProxy* proxy);
535 void ResolveVariablesRecursively(ParseInfo* info); 536 void ResolveVariablesRecursively(ParseInfo* info);
536 537
537 // Finds free variables of this scope. This mutates the unresolved variables 538 // Finds free variables of this scope. This mutates the unresolved variables
538 // list along the way, so full resolution cannot be done afterwards. 539 // list along the way, so full resolution cannot be done afterwards.
539 // If a ParseInfo* is passed, non-free variables will be resolved. 540 // If a ParseInfo* is passed, non-free variables will be resolved.
540 VariableProxy* FetchFreeVariables(DeclarationScope* max_outer_scope, 541 VariableProxy* FetchFreeVariables(DeclarationScope* max_outer_scope,
542 bool try_to_resolve = true,
541 ParseInfo* info = nullptr, 543 ParseInfo* info = nullptr,
542 VariableProxy* stack = nullptr); 544 VariableProxy* stack = nullptr);
543 545
544 // Predicates. 546 // Predicates.
545 bool MustAllocate(Variable* var); 547 bool MustAllocate(Variable* var);
546 bool MustAllocateInContext(Variable* var); 548 bool MustAllocateInContext(Variable* var);
547 549
548 // Variable allocation. 550 // Variable allocation.
549 void AllocateStackSlot(Variable* var); 551 void AllocateStackSlot(Variable* var);
550 void AllocateHeapSlot(Variable* var); 552 void AllocateHeapSlot(Variable* var);
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 void AllocateModuleVariables(); 879 void AllocateModuleVariables();
878 880
879 private: 881 private:
880 ModuleDescriptor* module_descriptor_; 882 ModuleDescriptor* module_descriptor_;
881 }; 883 };
882 884
883 } // namespace internal 885 } // namespace internal
884 } // namespace v8 886 } // namespace v8
885 887
886 #endif // V8_AST_SCOPES_H_ 888 #endif // V8_AST_SCOPES_H_
OLDNEW
« no previous file with comments | « no previous file | src/ast/scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698