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

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

Issue 2158343002: Fix: Don't use Isolate during scope resolution. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: (streamlined the rebase) Created 4 years, 5 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/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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 DCHECK(is_function_scope()); 150 DCHECK(is_function_scope());
151 // Handle implicit declaration of the function name in named function 151 // Handle implicit declaration of the function name in named function
152 // expressions before other declarations. 152 // expressions before other declarations.
153 decls_.InsertAt(0, declaration, zone()); 153 decls_.InsertAt(0, declaration, zone());
154 function_ = declaration; 154 function_ = declaration;
155 } 155 }
156 156
157 // Declare a parameter in this scope. When there are duplicated 157 // Declare a parameter in this scope. When there are duplicated
158 // parameters the rightmost one 'wins'. However, the implementation 158 // parameters the rightmost one 'wins'. However, the implementation
159 // expects all parameters to be declared and from left to right. 159 // expects all parameters to be declared and from left to right.
160 Variable* DeclareParameter( 160 Variable* DeclareParameter(const AstRawString* name, VariableMode mode,
161 const AstRawString* name, VariableMode mode, 161 bool is_optional, bool is_rest, bool* is_duplicate,
162 bool is_optional, bool is_rest, bool* is_duplicate); 162 AstValueFactory* ast_value_factory);
163 163
164 // Declare a local variable in this scope. If the variable has been 164 // Declare a local variable in this scope. If the variable has been
165 // declared before, the previously declared variable is returned. 165 // declared before, the previously declared variable is returned.
166 Variable* DeclareLocal(const AstRawString* name, VariableMode mode, 166 Variable* DeclareLocal(const AstRawString* name, VariableMode mode,
167 InitializationFlag init_flag, Variable::Kind kind, 167 InitializationFlag init_flag, Variable::Kind kind,
168 MaybeAssignedFlag maybe_assigned_flag = kNotAssigned); 168 MaybeAssignedFlag maybe_assigned_flag = kNotAssigned);
169 169
170 // Declare an implicit global variable in this scope which must be a 170 // Declare an implicit global variable in this scope which must be a
171 // script scope. The variable was introduced (possibly from an inner 171 // script scope. The variable was introduced (possibly from an inner
172 // scope) by a reference to an unresolved variable with no intervening 172 // scope) by a reference to an unresolved variable with no intervening
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 // 658 //
659 // This scope is inside a 'with' of some outer scope. 659 // This scope is inside a 'with' of some outer scope.
660 bool scope_inside_with_; 660 bool scope_inside_with_;
661 // This scope or a nested catch scope or with scope contain an 'eval' call. At 661 // This scope or a nested catch scope or with scope contain an 'eval' call. At
662 // the 'eval' call site this scope is the declaration scope. 662 // the 'eval' call site this scope is the declaration scope.
663 bool scope_calls_eval_; 663 bool scope_calls_eval_;
664 // This scope uses "arguments". 664 // This scope uses "arguments".
665 bool scope_uses_arguments_; 665 bool scope_uses_arguments_;
666 // This scope uses "super" property ('super.foo'). 666 // This scope uses "super" property ('super.foo').
667 bool scope_uses_super_property_; 667 bool scope_uses_super_property_;
668 // This scope has a parameter called "arguments".
669 bool has_arguments_parameter_;
668 // This scope contains an "use asm" annotation. 670 // This scope contains an "use asm" annotation.
669 bool asm_module_; 671 bool asm_module_;
670 // This scope's outer context is an asm module. 672 // This scope's outer context is an asm module.
671 bool asm_function_; 673 bool asm_function_;
672 // This scope's declarations might not be executed in order (e.g., switch). 674 // This scope's declarations might not be executed in order (e.g., switch).
673 bool scope_nonlinear_; 675 bool scope_nonlinear_;
674 // The language mode of this scope. 676 // The language mode of this scope.
675 LanguageMode language_mode_; 677 LanguageMode language_mode_;
676 // Source positions. 678 // Source positions.
677 int start_position_; 679 int start_position_;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 MUST_USE_RESULT 772 MUST_USE_RESULT
771 bool ResolveVariablesRecursively(ParseInfo* info, AstNodeFactory* factory); 773 bool ResolveVariablesRecursively(ParseInfo* info, AstNodeFactory* factory);
772 774
773 // Scope analysis. 775 // Scope analysis.
774 void PropagateScopeInfo(bool outer_scope_calls_sloppy_eval); 776 void PropagateScopeInfo(bool outer_scope_calls_sloppy_eval);
775 bool HasTrivialContext() const; 777 bool HasTrivialContext() const;
776 778
777 // Predicates. 779 // Predicates.
778 bool MustAllocate(Variable* var); 780 bool MustAllocate(Variable* var);
779 bool MustAllocateInContext(Variable* var); 781 bool MustAllocateInContext(Variable* var);
780 bool HasArgumentsParameter(Isolate* isolate);
781 782
782 // Variable allocation. 783 // Variable allocation.
783 void AllocateStackSlot(Variable* var); 784 void AllocateStackSlot(Variable* var);
784 void AllocateHeapSlot(Variable* var); 785 void AllocateHeapSlot(Variable* var);
785 void AllocateParameterLocals(Isolate* isolate); 786 void AllocateParameterLocals();
786 void AllocateNonParameterLocal(Isolate* isolate, Variable* var); 787 void AllocateNonParameterLocal(Variable* var,
787 void AllocateDeclaredGlobal(Isolate* isolate, Variable* var); 788 AstValueFactory* ast_value_factory);
788 void AllocateNonParameterLocalsAndDeclaredGlobals(Isolate* isolate); 789 void AllocateDeclaredGlobal(Variable* var,
789 void AllocateVariablesRecursively(Isolate* isolate); 790 AstValueFactory* ast_value_factory);
791 void AllocateNonParameterLocalsAndDeclaredGlobals(
792 AstValueFactory* ast_value_factory);
793 void AllocateVariablesRecursively(AstValueFactory* ast_value_factory);
790 void AllocateParameter(Variable* var, int index); 794 void AllocateParameter(Variable* var, int index);
791 void AllocateReceiver(); 795 void AllocateReceiver();
792 796
793 // Resolve and fill in the allocation information for all variables 797 // Resolve and fill in the allocation information for all variables
794 // in this scopes. Must be called *after* all scopes have been 798 // in this scopes. Must be called *after* all scopes have been
795 // processed (parsed) to ensure that unresolved variables can be 799 // processed (parsed) to ensure that unresolved variables can be
796 // resolved properly. 800 // resolved properly.
797 // 801 //
798 // In the case of code compiled and run using 'eval', the context 802 // In the case of code compiled and run using 'eval', the context
799 // parameter is the context in which eval was called. In all other 803 // parameter is the context in which eval was called. In all other
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 836
833 Zone* zone_; 837 Zone* zone_;
834 838
835 PendingCompilationErrorHandler pending_error_handler_; 839 PendingCompilationErrorHandler pending_error_handler_;
836 }; 840 };
837 841
838 } // namespace internal 842 } // namespace internal
839 } // namespace v8 843 } // namespace v8
840 844
841 #endif // V8_AST_SCOPES_H_ 845 #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