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

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

Issue 2301183003: Move sloppy block function hoisting logic from Parser to Scope. (Closed)
Patch Set: code review (adamk@) Created 4 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
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/ast/ast.h" 8 #include "src/ast/ast.h"
9 #include "src/base/hashmap.h" 9 #include "src/base/hashmap.h"
10 #include "src/globals.h" 10 #include "src/globals.h"
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 // Temporaries are only placed in ClosureScopes. 736 // Temporaries are only placed in ClosureScopes.
737 DCHECK_EQ(GetClosureScope(), this); 737 DCHECK_EQ(GetClosureScope(), this);
738 locals_.Add(var, zone()); 738 locals_.Add(var, zone());
739 } 739 }
740 740
741 void DeclareSloppyBlockFunction(const AstRawString* name, 741 void DeclareSloppyBlockFunction(const AstRawString* name,
742 SloppyBlockFunctionStatement* statement) { 742 SloppyBlockFunctionStatement* statement) {
743 sloppy_block_function_map_.Declare(zone(), name, statement); 743 sloppy_block_function_map_.Declare(zone(), name, statement);
744 } 744 }
745 745
746 // Go through sloppy_block_function_map_ and hoist those (into this scope)
747 // which should be hoisted.
748 void HoistSloppyBlockFunctions(AstNodeFactory* factory, bool* ok);
749
746 SloppyBlockFunctionMap* sloppy_block_function_map() { 750 SloppyBlockFunctionMap* sloppy_block_function_map() {
747 return &sloppy_block_function_map_; 751 return &sloppy_block_function_map_;
748 } 752 }
749 753
750 // Compute top scope and allocate variables. For lazy compilation the top 754 // Compute top scope and allocate variables. For lazy compilation the top
751 // scope only contains the single lazily compiled function, so this 755 // scope only contains the single lazily compiled function, so this
752 // doesn't re-allocate variables repeatedly. 756 // doesn't re-allocate variables repeatedly.
753 static void Analyze(ParseInfo* info, AnalyzeMode mode); 757 static void Analyze(ParseInfo* info, AnalyzeMode mode);
754 758
755 // To be called during parsing. Do just enough scope analysis that we can 759 // To be called during parsing. Do just enough scope analysis that we can
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 void AllocateModuleVariables(); 856 void AllocateModuleVariables();
853 857
854 private: 858 private:
855 ModuleDescriptor* module_descriptor_; 859 ModuleDescriptor* module_descriptor_;
856 }; 860 };
857 861
858 } // namespace internal 862 } // namespace internal
859 } // namespace v8 863 } // namespace v8
860 864
861 #endif // V8_AST_SCOPES_H_ 865 #endif // V8_AST_SCOPES_H_
OLDNEW
« no previous file with comments | « src/ast/ast.h ('k') | src/ast/scopes.cc » ('j') | src/parsing/parser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698