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

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

Issue 2368313002: Don't use different function scopes when parsing with temp zones (Closed)
Patch Set: 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') | 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/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 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 408
409 // Check that all Scopes in the scope tree use the same Zone. 409 // Check that all Scopes in the scope tree use the same Zone.
410 void CheckZones(); 410 void CheckZones();
411 #endif 411 #endif
412 412
413 // Retrieve `IsSimpleParameterList` of current or outer function. 413 // Retrieve `IsSimpleParameterList` of current or outer function.
414 bool HasSimpleParameters(); 414 bool HasSimpleParameters();
415 void set_is_debug_evaluate_scope() { is_debug_evaluate_scope_ = true; } 415 void set_is_debug_evaluate_scope() { is_debug_evaluate_scope_ = true; }
416 bool is_debug_evaluate_scope() const { return is_debug_evaluate_scope_; } 416 bool is_debug_evaluate_scope() const { return is_debug_evaluate_scope_; }
417 417
418 bool is_lazily_parsed() const { return is_lazily_parsed_; }
418 void set_is_lazily_parsed(bool is_lazily_parsed) { 419 void set_is_lazily_parsed(bool is_lazily_parsed) {
419 is_lazily_parsed_ = is_lazily_parsed; 420 is_lazily_parsed_ = is_lazily_parsed;
420 } 421 }
421 422
422 protected: 423 protected:
423 explicit Scope(Zone* zone); 424 explicit Scope(Zone* zone);
424 425
425 void set_language_mode(LanguageMode language_mode) { 426 void set_language_mode(LanguageMode language_mode) {
426 is_strict_ = is_strict(language_mode); 427 is_strict_ = is_strict(language_mode);
427 } 428 }
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 // Compute top scope and allocate variables. For lazy compilation the top 773 // Compute top scope and allocate variables. For lazy compilation the top
773 // scope only contains the single lazily compiled function, so this 774 // scope only contains the single lazily compiled function, so this
774 // doesn't re-allocate variables repeatedly. 775 // doesn't re-allocate variables repeatedly.
775 static void Analyze(ParseInfo* info, AnalyzeMode mode); 776 static void Analyze(ParseInfo* info, AnalyzeMode mode);
776 777
777 // To be called during parsing. Do just enough scope analysis that we can 778 // To be called during parsing. Do just enough scope analysis that we can
778 // discard the Scope for lazily compiled functions. In particular, this 779 // discard the Scope for lazily compiled functions. In particular, this
779 // records variables which cannot be resolved inside the Scope (we don't yet 780 // records variables which cannot be resolved inside the Scope (we don't yet
780 // know what they will resolve to since the outer Scopes are incomplete) and 781 // know what they will resolve to since the outer Scopes are incomplete) and
781 // migrates them into migrate_to. 782 // migrates them into migrate_to.
782 void AnalyzePartially(DeclarationScope* migrate_to, 783 void AnalyzePartially(AstNodeFactory* ast_node_factory);
783 AstNodeFactory* ast_node_factory);
784 784
785 Handle<StringSet> CollectNonLocals(ParseInfo* info, 785 Handle<StringSet> CollectNonLocals(ParseInfo* info,
786 Handle<StringSet> non_locals); 786 Handle<StringSet> non_locals);
787 787
788 // Determine if we can use lazy compilation for this scope. 788 // Determine if we can use lazy compilation for this scope.
789 bool AllowsLazyCompilation() const; 789 bool AllowsLazyCompilation() const;
790 790
791 // Determine if we can use lazy compilation for this scope without a context. 791 // Determine if we can use lazy compilation for this scope without a context.
792 bool AllowsLazyCompilationWithoutContext() const; 792 bool AllowsLazyCompilationWithoutContext() const;
793 793
(...skipping 19 matching lines...) Expand all
813 decls_.Clear(); 813 decls_.Clear();
814 locals_.Clear(); 814 locals_.Clear();
815 params_.Clear(); 815 params_.Clear();
816 sloppy_block_function_map_.Clear(); 816 sloppy_block_function_map_.Clear();
817 variables_.Clear(); 817 variables_.Clear();
818 // Make sure we won't walk the scope tree from here on. 818 // Make sure we won't walk the scope tree from here on.
819 inner_scope_ = nullptr; 819 inner_scope_ = nullptr;
820 // Make sure we won't try to allocate the rest parameter. {params_} was 820 // Make sure we won't try to allocate the rest parameter. {params_} was
821 // cleared above. 821 // cleared above.
822 has_rest_ = false; 822 has_rest_ = false;
823 unresolved_ = nullptr;
823 } 824 }
824 825
825 private: 826 private:
826 void AllocateParameter(Variable* var, int index); 827 void AllocateParameter(Variable* var, int index);
827 828
828 // Resolve and fill in the allocation information for all variables 829 // Resolve and fill in the allocation information for all variables
829 // in this scopes. Must be called *after* all scopes have been 830 // in this scopes. Must be called *after* all scopes have been
830 // processed (parsed) to ensure that unresolved variables can be 831 // processed (parsed) to ensure that unresolved variables can be
831 // resolved properly. 832 // resolved properly.
832 // 833 //
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
893 void AllocateModuleVariables(); 894 void AllocateModuleVariables();
894 895
895 private: 896 private:
896 ModuleDescriptor* module_descriptor_; 897 ModuleDescriptor* module_descriptor_;
897 }; 898 };
898 899
899 } // namespace internal 900 } // namespace internal
900 } // namespace v8 901 } // namespace v8
901 902
902 #endif // V8_AST_SCOPES_H_ 903 #endif // V8_AST_SCOPES_H_
OLDNEW
« no previous file with comments | « no previous file | src/ast/scopes.cc » ('j') | src/ast/scopes.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698