OLD | NEW |
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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 // Parameters. The left-most parameter has index 0. | 244 // Parameters. The left-most parameter has index 0. |
245 // Only valid for function scopes. | 245 // Only valid for function scopes. |
246 Variable* parameter(int index) const { | 246 Variable* parameter(int index) const { |
247 ASSERT(is_function_scope()); | 247 ASSERT(is_function_scope()); |
248 return params_[index]; | 248 return params_[index]; |
249 } | 249 } |
250 | 250 |
251 int num_parameters() const { return params_.length(); } | 251 int num_parameters() const { return params_.length(); } |
252 | 252 |
253 // The local variable 'arguments' if we need to allocate it; NULL otherwise. | 253 // The local variable 'arguments' if we need to allocate it; NULL otherwise. |
| 254 // If arguments() exist, arguments_shadow() exists, too. |
254 Variable* arguments() const { return arguments_; } | 255 Variable* arguments() const { return arguments_; } |
255 | 256 |
| 257 // The '.arguments' shadow variable if we need to allocate it; NULL otherwise. |
| 258 // If arguments_shadow() exist, arguments() exists, too. |
| 259 Variable* arguments_shadow() const { return arguments_shadow_; } |
| 260 |
256 // Declarations list. | 261 // Declarations list. |
257 ZoneList<Declaration*>* declarations() { return &decls_; } | 262 ZoneList<Declaration*>* declarations() { return &decls_; } |
258 | 263 |
259 | 264 |
260 // --------------------------------------------------------------------------- | 265 // --------------------------------------------------------------------------- |
261 // Variable allocation. | 266 // Variable allocation. |
262 | 267 |
263 // Collect all used locals in this scope. | 268 // Collect all used locals in this scope. |
264 template<class Allocator> | 269 template<class Allocator> |
265 void CollectUsedVariables(List<Variable*, Allocator>* locals); | 270 void CollectUsedVariables(List<Variable*, Allocator>* locals); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 // Unresolved variables referred to from this scope. | 348 // Unresolved variables referred to from this scope. |
344 ZoneList<VariableProxy*> unresolved_; | 349 ZoneList<VariableProxy*> unresolved_; |
345 // Declarations. | 350 // Declarations. |
346 ZoneList<Declaration*> decls_; | 351 ZoneList<Declaration*> decls_; |
347 // Convenience variable. | 352 // Convenience variable. |
348 Variable* receiver_; | 353 Variable* receiver_; |
349 // Function variable, if any; function scopes only. | 354 // Function variable, if any; function scopes only. |
350 Variable* function_; | 355 Variable* function_; |
351 // Convenience variable; function scopes only. | 356 // Convenience variable; function scopes only. |
352 Variable* arguments_; | 357 Variable* arguments_; |
| 358 // Convenience variable; function scopes only. |
| 359 Variable* arguments_shadow_; |
353 | 360 |
354 // Illegal redeclaration. | 361 // Illegal redeclaration. |
355 Expression* illegal_redecl_; | 362 Expression* illegal_redecl_; |
356 | 363 |
357 // Scope-specific information. | 364 // Scope-specific information. |
358 bool scope_inside_with_; // this scope is inside a 'with' of some outer scope | 365 bool scope_inside_with_; // this scope is inside a 'with' of some outer scope |
359 bool scope_contains_with_; // this scope contains a 'with' statement | 366 bool scope_contains_with_; // this scope contains a 'with' statement |
360 bool scope_calls_eval_; // this scope contains an 'eval' call | 367 bool scope_calls_eval_; // this scope contains an 'eval' call |
361 bool strict_mode_; // this scope is a strict mode scope | 368 bool strict_mode_; // this scope is a strict mode scope |
362 | 369 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 } | 429 } |
423 | 430 |
424 void SetDefaults(Type type, | 431 void SetDefaults(Type type, |
425 Scope* outer_scope, | 432 Scope* outer_scope, |
426 Handle<SerializedScopeInfo> scope_info); | 433 Handle<SerializedScopeInfo> scope_info); |
427 }; | 434 }; |
428 | 435 |
429 } } // namespace v8::internal | 436 } } // namespace v8::internal |
430 | 437 |
431 #endif // V8_SCOPES_H_ | 438 #endif // V8_SCOPES_H_ |
OLD | NEW |