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

Side by Side Diff: src/variables.h

Issue 345573002: Infer whether a variable is assigned (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
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_VARIABLES_H_ 5 #ifndef V8_VARIABLES_H_
6 #define V8_VARIABLES_H_ 6 #define V8_VARIABLES_H_
7 7
8 #include "src/zone.h" 8 #include "src/zone.h"
9 #include "src/interface.h" 9 #include "src/interface.h"
10 10
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 Handle<String> name() const { return name_; } 73 Handle<String> name() const { return name_; }
74 VariableMode mode() const { return mode_; } 74 VariableMode mode() const { return mode_; }
75 bool has_forced_context_allocation() const { 75 bool has_forced_context_allocation() const {
76 return force_context_allocation_; 76 return force_context_allocation_;
77 } 77 }
78 void ForceContextAllocation() { 78 void ForceContextAllocation() {
79 ASSERT(mode_ != TEMPORARY); 79 ASSERT(mode_ != TEMPORARY);
80 force_context_allocation_ = true; 80 force_context_allocation_ = true;
81 } 81 }
82 bool is_used() { return is_used_; } 82 bool is_used() { return is_used_; }
83 void set_is_used(bool flag) { is_used_ = flag; } 83 void set_is_used() { is_used_ = true; }
84 bool is_assigned_in_inner_function() {
titzer 2014/06/23 13:03:19 may_be_assigned_in_inner_function() ?
rossberg 2014/06/24 13:40:43 Done.
85 return is_assigned_in_inner_function_;
86 }
87 void set_is_assigned_in_inner_function() {
88 is_assigned_in_inner_function_ = true;
89 }
84 90
85 int initializer_position() { return initializer_position_; } 91 int initializer_position() { return initializer_position_; }
86 void set_initializer_position(int pos) { initializer_position_ = pos; } 92 void set_initializer_position(int pos) { initializer_position_ = pos; }
87 93
88 bool IsVariable(Handle<String> n) const { 94 bool IsVariable(Handle<String> n) const {
89 return !is_this() && name().is_identical_to(n); 95 return !is_this() && name().is_identical_to(n);
90 } 96 }
91 97
92 bool IsUnallocated() const { return location_ == UNALLOCATED; } 98 bool IsUnallocated() const { return location_ == UNALLOCATED; }
93 bool IsParameter() const { return location_ == PARAMETER; } 99 bool IsParameter() const { return location_ == PARAMETER; }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 // sloppy 'eval' calls between the reference scope (inclusive) and the 154 // sloppy 'eval' calls between the reference scope (inclusive) and the
149 // binding scope (exclusive). 155 // binding scope (exclusive).
150 Variable* local_if_not_shadowed_; 156 Variable* local_if_not_shadowed_;
151 157
152 // Valid as a reference? (const and this are not valid, for example) 158 // Valid as a reference? (const and this are not valid, for example)
153 bool is_valid_ref_; 159 bool is_valid_ref_;
154 160
155 // Usage info. 161 // Usage info.
156 bool force_context_allocation_; // set by variable resolver 162 bool force_context_allocation_; // set by variable resolver
157 bool is_used_; 163 bool is_used_;
164 bool is_assigned_in_inner_function_;
158 InitializationFlag initialization_flag_; 165 InitializationFlag initialization_flag_;
159 166
160 // Module type info. 167 // Module type info.
161 Interface* interface_; 168 Interface* interface_;
162 }; 169 };
163 170
164 171
165 } } // namespace v8::internal 172 } } // namespace v8::internal
166 173
167 #endif // V8_VARIABLES_H_ 174 #endif // V8_VARIABLES_H_
OLDNEW
« no previous file with comments | « src/scopes.cc ('k') | src/variables.cc » ('j') | test/cctest/test-parsing.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698