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

Side by Side Diff: src/variables.h

Issue 147075: Allocate arguments object on-demand instead of at function entry.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 // has been shadowed by an eval-introduced 130 // has been shadowed by an eval-introduced
131 // variable 131 // variable
132 132
133 INTERNAL, // like VAR, but not user-visible (may or may not 133 INTERNAL, // like VAR, but not user-visible (may or may not
134 // be in a context) 134 // be in a context)
135 135
136 TEMPORARY // temporary variables (not user-visible), never 136 TEMPORARY // temporary variables (not user-visible), never
137 // in a context 137 // in a context
138 }; 138 };
139 139
140 enum Kind {
141 NORMAL,
142 THIS,
143 ARGUMENTS
144 };
145
140 // Printing support 146 // Printing support
141 static const char* Mode2String(Mode mode); 147 static const char* Mode2String(Mode mode);
142 148
143 // Type testing & conversion 149 // Type testing & conversion
144 Property* AsProperty(); 150 Property* AsProperty();
145 Variable* AsVariable(); 151 Variable* AsVariable();
146 bool IsValidLeftHandSide() { return is_valid_LHS_; } 152 bool IsValidLeftHandSide() { return is_valid_LHS_; }
147 153
148 // The source code for an eval() call may refer to a variable that is 154 // The source code for an eval() call may refer to a variable that is
149 // in an outer scope about which we don't know anything (it may not 155 // in an outer scope about which we don't know anything (it may not
(...skipping 15 matching lines...) Expand all
165 return !is_this() && name().is_identical_to(n); 171 return !is_this() && name().is_identical_to(n);
166 } 172 }
167 173
168 bool is_dynamic() const { 174 bool is_dynamic() const {
169 return (mode_ == DYNAMIC || 175 return (mode_ == DYNAMIC ||
170 mode_ == DYNAMIC_GLOBAL || 176 mode_ == DYNAMIC_GLOBAL ||
171 mode_ == DYNAMIC_LOCAL); 177 mode_ == DYNAMIC_LOCAL);
172 } 178 }
173 179
174 bool is_global() const; 180 bool is_global() const;
175 bool is_this() const { return is_this_; } 181 bool is_this() const { return kind_ == THIS; }
182 bool is_arguments() const { return kind_ == ARGUMENTS; }
176 183
177 Variable* local_if_not_shadowed() const { 184 Variable* local_if_not_shadowed() const {
178 ASSERT(mode_ == DYNAMIC_LOCAL && local_if_not_shadowed_ != NULL); 185 ASSERT(mode_ == DYNAMIC_LOCAL && local_if_not_shadowed_ != NULL);
179 return local_if_not_shadowed_; 186 return local_if_not_shadowed_;
180 } 187 }
181 188
182 void set_local_if_not_shadowed(Variable* local) { 189 void set_local_if_not_shadowed(Variable* local) {
183 local_if_not_shadowed_ = local; 190 local_if_not_shadowed_ = local;
184 } 191 }
185 192
186 Expression* rewrite() const { return rewrite_; } 193 Expression* rewrite() const { return rewrite_; }
187 Slot* slot() const; 194 Slot* slot() const;
188 195
189 SmiAnalysis* type() { return &type_; } 196 SmiAnalysis* type() { return &type_; }
190 197
191 private: 198 private:
192 Variable(Scope* scope, Handle<String> name, Mode mode, bool is_valid_LHS, 199 Variable(Scope* scope, Handle<String> name, Mode mode, bool is_valid_LHS,
193 bool is_this); 200 Kind kind);
194 201
195 Scope* scope_; 202 Scope* scope_;
196 Handle<String> name_; 203 Handle<String> name_;
197 Mode mode_; 204 Mode mode_;
198 bool is_valid_LHS_; 205 bool is_valid_LHS_;
199 bool is_this_; 206 Kind kind_;
200 207
201 Variable* local_if_not_shadowed_; 208 Variable* local_if_not_shadowed_;
202 209
203 // Usage info. 210 // Usage info.
204 bool is_accessed_from_inner_scope_; // set by variable resolver 211 bool is_accessed_from_inner_scope_; // set by variable resolver
205 UseCount var_uses_; // uses of the variable value 212 UseCount var_uses_; // uses of the variable value
206 UseCount obj_uses_; // uses of the object the variable points to 213 UseCount obj_uses_; // uses of the object the variable points to
207 214
208 // Static type information 215 // Static type information
209 SmiAnalysis type_; 216 SmiAnalysis type_;
210 217
211 // Code generation. 218 // Code generation.
212 // rewrite_ is usually a Slot or a Property, but maybe any expression. 219 // rewrite_ is usually a Slot or a Property, but maybe any expression.
213 Expression* rewrite_; 220 Expression* rewrite_;
214 221
215 friend class VariableProxy; 222 friend class VariableProxy;
216 friend class Scope; 223 friend class Scope;
217 friend class LocalsMap; 224 friend class LocalsMap;
218 friend class AstBuildingParser; 225 friend class AstBuildingParser;
219 }; 226 };
220 227
221 228
222 } } // namespace v8::internal 229 } } // namespace v8::internal
223 230
224 #endif // V8_VARIABLES_H_ 231 #endif // V8_VARIABLES_H_
OLDNEW
« src/ia32/codegen-ia32.cc ('K') | « src/scopes.cc ('k') | src/variables.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698