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