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

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: A few more tests 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
« no previous file with comments | « src/scopes.cc ('k') | src/variables.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 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 maybe_assigned() { return maybe_assigned_; }
85 void set_maybe_assigned() { maybe_assigned_ = true; }
84 86
85 int initializer_position() { return initializer_position_; } 87 int initializer_position() { return initializer_position_; }
86 void set_initializer_position(int pos) { initializer_position_ = pos; } 88 void set_initializer_position(int pos) { initializer_position_ = pos; }
87 89
88 bool IsVariable(Handle<String> n) const { 90 bool IsVariable(Handle<String> n) const {
89 return !is_this() && name().is_identical_to(n); 91 return !is_this() && name().is_identical_to(n);
90 } 92 }
91 93
92 bool IsUnallocated() const { return location_ == UNALLOCATED; } 94 bool IsUnallocated() const { return location_ == UNALLOCATED; }
93 bool IsParameter() const { return location_ == PARAMETER; } 95 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 150 // sloppy 'eval' calls between the reference scope (inclusive) and the
149 // binding scope (exclusive). 151 // binding scope (exclusive).
150 Variable* local_if_not_shadowed_; 152 Variable* local_if_not_shadowed_;
151 153
152 // Valid as a reference? (const and this are not valid, for example) 154 // Valid as a reference? (const and this are not valid, for example)
153 bool is_valid_ref_; 155 bool is_valid_ref_;
154 156
155 // Usage info. 157 // Usage info.
156 bool force_context_allocation_; // set by variable resolver 158 bool force_context_allocation_; // set by variable resolver
157 bool is_used_; 159 bool is_used_;
160 bool maybe_assigned_;
158 InitializationFlag initialization_flag_; 161 InitializationFlag initialization_flag_;
159 162
160 // Module type info. 163 // Module type info.
161 Interface* interface_; 164 Interface* interface_;
162 }; 165 };
163 166
164 167
165 } } // namespace v8::internal 168 } } // namespace v8::internal
166 169
167 #endif // V8_VARIABLES_H_ 170 #endif // V8_VARIABLES_H_
OLDNEW
« no previous file with comments | « src/scopes.cc ('k') | src/variables.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698