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

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

Issue 2650703003: [parser]: Skipping inner funcs / initial implemetation of storing scope analysis data from preparse… (Closed)
Patch Set: bugfixes + tests Created 3 years, 11 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 | « BUILD.gn ('k') | src/ast/scopes.cc » ('j') | src/ast/scopes.cc » ('J')
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/compiler-specific.h" 8 #include "src/base/compiler-specific.h"
9 #include "src/base/hashmap.h" 9 #include "src/base/hashmap.h"
10 #include "src/globals.h" 10 #include "src/globals.h"
11 #include "src/objects.h" 11 #include "src/objects.h"
12 #include "src/objects/scope-info.h" 12 #include "src/objects/scope-info.h"
13 #include "src/zone/zone.h" 13 #include "src/zone/zone.h"
14 14
15 namespace v8 { 15 namespace v8 {
16 namespace internal { 16 namespace internal {
17 17
18 class AstNodeFactory; 18 class AstNodeFactory;
19 class AstValueFactory; 19 class AstValueFactory;
20 class AstRawString; 20 class AstRawString;
21 class Declaration; 21 class Declaration;
22 class ParseInfo; 22 class ParseInfo;
23 class PreParsedScopeData;
23 class SloppyBlockFunctionStatement; 24 class SloppyBlockFunctionStatement;
24 class Statement; 25 class Statement;
25 class StringSet; 26 class StringSet;
26 class VariableProxy; 27 class VariableProxy;
27 28
28 // A hash map to support fast variable declaration and lookup. 29 // A hash map to support fast variable declaration and lookup.
29 class VariableMap: public ZoneHashMap { 30 class VariableMap: public ZoneHashMap {
30 public: 31 public:
31 explicit VariableMap(Zone* zone); 32 explicit VariableMap(Zone* zone);
32 33
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 void AllocateNonParameterLocal(Variable* var); 580 void AllocateNonParameterLocal(Variable* var);
580 void AllocateDeclaredGlobal(Variable* var); 581 void AllocateDeclaredGlobal(Variable* var);
581 void AllocateNonParameterLocalsAndDeclaredGlobals(); 582 void AllocateNonParameterLocalsAndDeclaredGlobals();
582 void AllocateVariablesRecursively(); 583 void AllocateVariablesRecursively();
583 584
584 void AllocateScopeInfosRecursively(Isolate* isolate, 585 void AllocateScopeInfosRecursively(Isolate* isolate,
585 MaybeHandle<ScopeInfo> outer_scope); 586 MaybeHandle<ScopeInfo> outer_scope);
586 void AllocateDebuggerScopeInfos(Isolate* isolate, 587 void AllocateDebuggerScopeInfos(Isolate* isolate,
587 MaybeHandle<ScopeInfo> outer_scope); 588 MaybeHandle<ScopeInfo> outer_scope);
588 589
590 void GetAllocationData(PreParsedScopeData* data);
591
589 // Construct a scope based on the scope info. 592 // Construct a scope based on the scope info.
590 Scope(Zone* zone, ScopeType type, Handle<ScopeInfo> scope_info); 593 Scope(Zone* zone, ScopeType type, Handle<ScopeInfo> scope_info);
591 594
592 // Construct a catch scope with a binding for the name. 595 // Construct a catch scope with a binding for the name.
593 Scope(Zone* zone, const AstRawString* catch_variable_name, 596 Scope(Zone* zone, const AstRawString* catch_variable_name,
594 Handle<ScopeInfo> scope_info); 597 Handle<ScopeInfo> scope_info);
595 598
596 void AddInnerScope(Scope* inner_scope) { 599 void AddInnerScope(Scope* inner_scope) {
597 inner_scope->sibling_ = inner_scope_; 600 inner_scope->sibling_ = inner_scope_;
598 inner_scope_ = inner_scope; 601 inner_scope_ = inner_scope;
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 // Compute top scope and allocate variables. For lazy compilation the top 785 // Compute top scope and allocate variables. For lazy compilation the top
783 // scope only contains the single lazily compiled function, so this 786 // scope only contains the single lazily compiled function, so this
784 // doesn't re-allocate variables repeatedly. 787 // doesn't re-allocate variables repeatedly.
785 static void Analyze(ParseInfo* info, AnalyzeMode mode); 788 static void Analyze(ParseInfo* info, AnalyzeMode mode);
786 789
787 // To be called during parsing. Do just enough scope analysis that we can 790 // To be called during parsing. Do just enough scope analysis that we can
788 // discard the Scope for lazily compiled functions. In particular, this 791 // discard the Scope for lazily compiled functions. In particular, this
789 // records variables which cannot be resolved inside the Scope (we don't yet 792 // records variables which cannot be resolved inside the Scope (we don't yet
790 // know what they will resolve to since the outer Scopes are incomplete) and 793 // know what they will resolve to since the outer Scopes are incomplete) and
791 // migrates them into migrate_to. 794 // migrates them into migrate_to.
792 void AnalyzePartially(AstNodeFactory* ast_node_factory); 795 void AnalyzePartially(AstNodeFactory* ast_node_factory,
796 PreParsedScopeData* preparsed_scope_data);
793 797
794 Handle<StringSet> CollectNonLocals(ParseInfo* info, 798 Handle<StringSet> CollectNonLocals(ParseInfo* info,
795 Handle<StringSet> non_locals); 799 Handle<StringSet> non_locals);
796 800
797 // Determine if we can use lazy compilation for this scope. 801 // Determine if we can use lazy compilation for this scope.
798 bool AllowsLazyCompilation() const; 802 bool AllowsLazyCompilation() const;
799 803
800 // Make sure this closure and all outer closures are eagerly compiled. 804 // Make sure this closure and all outer closures are eagerly compiled.
801 void ForceEagerCompilation() { 805 void ForceEagerCompilation() {
802 DCHECK_EQ(this, GetClosureScope()); 806 DCHECK_EQ(this, GetClosureScope());
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
893 void AllocateModuleVariables(); 897 void AllocateModuleVariables();
894 898
895 private: 899 private:
896 ModuleDescriptor* module_descriptor_; 900 ModuleDescriptor* module_descriptor_;
897 }; 901 };
898 902
899 } // namespace internal 903 } // namespace internal
900 } // namespace v8 904 } // namespace v8
901 905
902 #endif // V8_AST_SCOPES_H_ 906 #endif // V8_AST_SCOPES_H_
OLDNEW
« no previous file with comments | « BUILD.gn ('k') | src/ast/scopes.cc » ('j') | src/ast/scopes.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698