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

Side by Side Diff: src/variables.h

Issue 7890031: Mark variables as being accessed from any inner scope, not only function scopes (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 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 | 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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 bool IsValidLeftHandSide() { return is_valid_LHS_; } 113 bool IsValidLeftHandSide() { return is_valid_LHS_; }
114 114
115 // The source code for an eval() call may refer to a variable that is 115 // The source code for an eval() call may refer to a variable that is
116 // in an outer scope about which we don't know anything (it may not 116 // in an outer scope about which we don't know anything (it may not
117 // be the global scope). scope() is NULL in that case. Currently the 117 // be the global scope). scope() is NULL in that case. Currently the
118 // scope is only used to follow the context chain length. 118 // scope is only used to follow the context chain length.
119 Scope* scope() const { return scope_; } 119 Scope* scope() const { return scope_; }
120 120
121 Handle<String> name() const { return name_; } 121 Handle<String> name() const { return name_; }
122 Mode mode() const { return mode_; } 122 Mode mode() const { return mode_; }
123 bool is_accessed_from_inner_function_scope() const { 123 bool is_accessed_from_inner_scope() const {
124 return is_accessed_from_inner_function_scope_; 124 return is_accessed_from_inner_scope_;
125 } 125 }
126 void MarkAsAccessedFromInnerFunctionScope() { 126 void MarkAsAccessedFromInnerScope() {
127 ASSERT(mode_ != TEMPORARY); 127 ASSERT(mode_ != TEMPORARY);
128 is_accessed_from_inner_function_scope_ = true; 128 is_accessed_from_inner_scope_ = true;
129 } 129 }
130 bool is_used() { return is_used_; } 130 bool is_used() { return is_used_; }
131 void set_is_used(bool flag) { is_used_ = flag; } 131 void set_is_used(bool flag) { is_used_ = flag; }
132 132
133 bool IsVariable(Handle<String> n) const { 133 bool IsVariable(Handle<String> n) const {
134 return !is_this() && name().is_identical_to(n); 134 return !is_this() && name().is_identical_to(n);
135 } 135 }
136 136
137 bool IsUnallocated() const { return location_ == UNALLOCATED; } 137 bool IsUnallocated() const { return location_ == UNALLOCATED; }
138 bool IsParameter() const { return location_ == PARAMETER; } 138 bool IsParameter() const { return location_ == PARAMETER; }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 Kind kind_; 181 Kind kind_;
182 Location location_; 182 Location location_;
183 int index_; 183 int index_;
184 184
185 Variable* local_if_not_shadowed_; 185 Variable* local_if_not_shadowed_;
186 186
187 // Valid as a LHS? (const and this are not valid LHS, for example) 187 // Valid as a LHS? (const and this are not valid LHS, for example)
188 bool is_valid_LHS_; 188 bool is_valid_LHS_;
189 189
190 // Usage info. 190 // Usage info.
191 bool is_accessed_from_inner_function_scope_; // set by variable resolver 191 bool is_accessed_from_inner_scope_; // set by variable resolver
192 bool is_used_; 192 bool is_used_;
193 }; 193 };
194 194
195 195
196 } } // namespace v8::internal 196 } } // namespace v8::internal
197 197
198 #endif // V8_VARIABLES_H_ 198 #endif // V8_VARIABLES_H_
OLDNEW
« src/scopes.cc ('K') | « src/scopes.cc ('k') | src/variables.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698