OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_SCOPES_H_ | 5 #ifndef V8_SCOPES_H_ |
6 #define V8_SCOPES_H_ | 6 #define V8_SCOPES_H_ |
7 | 7 |
8 #include "src/ast.h" | 8 #include "src/ast.h" |
9 #include "src/pending-compilation-error-handler.h" | 9 #include "src/pending-compilation-error-handler.h" |
10 #include "src/zone.h" | 10 #include "src/zone.h" |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 Variable* rest_parameter(int* index) const { | 382 Variable* rest_parameter(int* index) const { |
383 *index = rest_index_; | 383 *index = rest_index_; |
384 if (rest_index_ < 0) return NULL; | 384 if (rest_index_ < 0) return NULL; |
385 return rest_parameter_; | 385 return rest_parameter_; |
386 } | 386 } |
387 | 387 |
388 bool has_rest_parameter() const { | 388 bool has_rest_parameter() const { |
389 return rest_index_ >= 0; | 389 return rest_index_ >= 0; |
390 } | 390 } |
391 | 391 |
392 bool is_simple_parameter_list() const { | 392 bool has_simple_parameters() const { |
393 DCHECK(is_function_scope()); | 393 DCHECK(is_function_scope()); |
394 if (rest_index_ >= 0) return false; | 394 return has_simple_parameters_; |
395 return true; | |
396 } | 395 } |
397 | 396 |
398 // The local variable 'arguments' if we need to allocate it; NULL otherwise. | 397 // The local variable 'arguments' if we need to allocate it; NULL otherwise. |
399 Variable* arguments() const { | 398 Variable* arguments() const { |
400 DCHECK(!is_arrow_scope() || arguments_ == nullptr); | 399 DCHECK(!is_arrow_scope() || arguments_ == nullptr); |
401 return arguments_; | 400 return arguments_; |
402 } | 401 } |
403 | 402 |
404 Variable* this_function_var() const { | 403 Variable* this_function_var() const { |
405 // This is only used in derived constructors atm. | 404 // This is only used in derived constructors atm. |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 int num_stack_slots_; | 624 int num_stack_slots_; |
626 int num_heap_slots_; | 625 int num_heap_slots_; |
627 int num_global_slots_; | 626 int num_global_slots_; |
628 | 627 |
629 // The number of modules (including nested ones). | 628 // The number of modules (including nested ones). |
630 int num_modules_; | 629 int num_modules_; |
631 | 630 |
632 // For module scopes, the host scope's temporary variable binding this module. | 631 // For module scopes, the host scope's temporary variable binding this module. |
633 Variable* module_var_; | 632 Variable* module_var_; |
634 | 633 |
635 // Rest parameter | 634 // Info about the parameter list of a function. |
| 635 bool has_simple_parameters_; |
636 Variable* rest_parameter_; | 636 Variable* rest_parameter_; |
637 int rest_index_; | 637 int rest_index_; |
638 | 638 |
639 // Serialized scope info support. | 639 // Serialized scope info support. |
640 Handle<ScopeInfo> scope_info_; | 640 Handle<ScopeInfo> scope_info_; |
641 bool already_resolved() { return already_resolved_; } | 641 bool already_resolved() { return already_resolved_; } |
642 | 642 |
643 // Create a non-local variable with a given name. | 643 // Create a non-local variable with a given name. |
644 // These variables are looked up dynamically at runtime. | 644 // These variables are looked up dynamically at runtime. |
645 Variable* NonLocal(const AstRawString* name, VariableMode mode); | 645 Variable* NonLocal(const AstRawString* name, VariableMode mode); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 PendingCompilationErrorHandler pending_error_handler_; | 765 PendingCompilationErrorHandler pending_error_handler_; |
766 | 766 |
767 // For tracking which classes are declared consecutively. Needed for strong | 767 // For tracking which classes are declared consecutively. Needed for strong |
768 // mode. | 768 // mode. |
769 int class_declaration_group_start_; | 769 int class_declaration_group_start_; |
770 }; | 770 }; |
771 | 771 |
772 } } // namespace v8::internal | 772 } } // namespace v8::internal |
773 | 773 |
774 #endif // V8_SCOPES_H_ | 774 #endif // V8_SCOPES_H_ |
OLD | NEW |