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

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

Issue 2232343002: [ast] Never declare non-lexical variables as kNeedsInitialization. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 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 | « src/ast/scopes.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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_VARIABLES_H_ 5 #ifndef V8_AST_VARIABLES_H_
6 #define V8_AST_VARIABLES_H_ 6 #define V8_AST_VARIABLES_H_
7 7
8 #include "src/ast/ast-value-factory.h" 8 #include "src/ast/ast-value-factory.h"
9 #include "src/zone.h" 9 #include "src/zone.h"
10 10
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 bool IsUnallocatedOrGlobalSlot() const { 66 bool IsUnallocatedOrGlobalSlot() const {
67 return IsUnallocated() || IsGlobalSlot(); 67 return IsUnallocated() || IsGlobalSlot();
68 } 68 }
69 bool IsLookupSlot() const { return location_ == VariableLocation::LOOKUP; } 69 bool IsLookupSlot() const { return location_ == VariableLocation::LOOKUP; }
70 bool IsGlobalObjectProperty() const; 70 bool IsGlobalObjectProperty() const;
71 bool IsStaticGlobalObjectProperty() const; 71 bool IsStaticGlobalObjectProperty() const;
72 72
73 bool is_dynamic() const { return IsDynamicVariableMode(mode_); } 73 bool is_dynamic() const { return IsDynamicVariableMode(mode_); }
74 bool is_const_mode() const { return IsImmutableVariableMode(mode_); } 74 bool is_const_mode() const { return IsImmutableVariableMode(mode_); }
75 bool binding_needs_init() const { 75 bool binding_needs_init() const {
76 DCHECK(initialization_flag_ != kNeedsInitialization ||
77 IsLexicalVariableMode(mode_));
76 return initialization_flag_ == kNeedsInitialization; 78 return initialization_flag_ == kNeedsInitialization;
77 } 79 }
78 80
79 bool is_function() const { return kind_ == FUNCTION; } 81 bool is_function() const { return kind_ == FUNCTION; }
80 bool is_this() const { return kind_ == THIS; } 82 bool is_this() const { return kind_ == THIS; }
81 bool is_arguments() const { return kind_ == ARGUMENTS; } 83 bool is_arguments() const { return kind_ == ARGUMENTS; }
82 84
83 // For script scopes, the "this" binding is provided by a ScriptContext added 85 // For script scopes, the "this" binding is provided by a ScriptContext added
84 // to the global's ScriptContextTable. This binding might not statically 86 // to the global's ScriptContextTable. This binding might not statically
85 // resolve to a Variable::THIS binding, instead being DYNAMIC_LOCAL. However 87 // resolve to a Variable::THIS binding, instead being DYNAMIC_LOCAL. However
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 // Usage info. 163 // Usage info.
162 bool force_context_allocation_; // set by variable resolver 164 bool force_context_allocation_; // set by variable resolver
163 bool is_used_; 165 bool is_used_;
164 InitializationFlag initialization_flag_; 166 InitializationFlag initialization_flag_;
165 MaybeAssignedFlag maybe_assigned_; 167 MaybeAssignedFlag maybe_assigned_;
166 }; 168 };
167 } // namespace internal 169 } // namespace internal
168 } // namespace v8 170 } // namespace v8
169 171
170 #endif // V8_AST_VARIABLES_H_ 172 #endif // V8_AST_VARIABLES_H_
OLDNEW
« no previous file with comments | « src/ast/scopes.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698