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 1693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1704 virtual bool IsInlineable() const; | 1704 virtual bool IsInlineable() const; |
1705 | 1705 |
1706 private: | 1706 private: |
1707 Expression* exception_; | 1707 Expression* exception_; |
1708 int pos_; | 1708 int pos_; |
1709 }; | 1709 }; |
1710 | 1710 |
1711 | 1711 |
1712 class FunctionLiteral: public Expression { | 1712 class FunctionLiteral: public Expression { |
1713 public: | 1713 public: |
| 1714 enum Type { |
| 1715 ANONYMOUS_EXPRESSION, |
| 1716 NAMED_EXPRESSION, |
| 1717 DECLARATION |
| 1718 }; |
| 1719 |
1714 FunctionLiteral(Isolate* isolate, | 1720 FunctionLiteral(Isolate* isolate, |
1715 Handle<String> name, | 1721 Handle<String> name, |
1716 Scope* scope, | 1722 Scope* scope, |
1717 ZoneList<Statement*>* body, | 1723 ZoneList<Statement*>* body, |
1718 int materialized_literal_count, | 1724 int materialized_literal_count, |
1719 int expected_property_count, | 1725 int expected_property_count, |
1720 bool has_only_simple_this_property_assignments, | 1726 bool has_only_simple_this_property_assignments, |
1721 Handle<FixedArray> this_property_assignments, | 1727 Handle<FixedArray> this_property_assignments, |
1722 int num_parameters, | 1728 int num_parameters, |
1723 int start_position, | 1729 int start_position, |
1724 int end_position, | 1730 int end_position, |
1725 bool is_expression, | 1731 Type type, |
1726 bool has_duplicate_parameters) | 1732 bool has_duplicate_parameters) |
1727 : Expression(isolate), | 1733 : Expression(isolate), |
1728 name_(name), | 1734 name_(name), |
1729 scope_(scope), | 1735 scope_(scope), |
1730 body_(body), | 1736 body_(body), |
1731 materialized_literal_count_(materialized_literal_count), | 1737 materialized_literal_count_(materialized_literal_count), |
1732 expected_property_count_(expected_property_count), | 1738 expected_property_count_(expected_property_count), |
1733 has_only_simple_this_property_assignments_( | 1739 has_only_simple_this_property_assignments_( |
1734 has_only_simple_this_property_assignments), | 1740 has_only_simple_this_property_assignments), |
1735 this_property_assignments_(this_property_assignments), | 1741 this_property_assignments_(this_property_assignments), |
1736 num_parameters_(num_parameters), | 1742 num_parameters_(num_parameters), |
1737 start_position_(start_position), | 1743 start_position_(start_position), |
1738 end_position_(end_position), | 1744 end_position_(end_position), |
1739 function_token_position_(RelocInfo::kNoPosition), | 1745 function_token_position_(RelocInfo::kNoPosition), |
1740 inferred_name_(HEAP->empty_string()), | 1746 inferred_name_(HEAP->empty_string()), |
1741 is_expression_(is_expression), | 1747 is_expression_(type != DECLARATION), |
| 1748 is_anonymous_(type == ANONYMOUS_EXPRESSION), |
1742 pretenure_(false), | 1749 pretenure_(false), |
1743 has_duplicate_parameters_(has_duplicate_parameters) { | 1750 has_duplicate_parameters_(has_duplicate_parameters) { |
1744 } | 1751 } |
1745 | 1752 |
1746 DECLARE_NODE_TYPE(FunctionLiteral) | 1753 DECLARE_NODE_TYPE(FunctionLiteral) |
1747 | 1754 |
1748 Handle<String> name() const { return name_; } | 1755 Handle<String> name() const { return name_; } |
1749 Scope* scope() const { return scope_; } | 1756 Scope* scope() const { return scope_; } |
1750 ZoneList<Statement*>* body() const { return body_; } | 1757 ZoneList<Statement*>* body() const { return body_; } |
1751 void set_function_token_position(int pos) { function_token_position_ = pos; } | 1758 void set_function_token_position(int pos) { function_token_position_ = pos; } |
1752 int function_token_position() const { return function_token_position_; } | 1759 int function_token_position() const { return function_token_position_; } |
1753 int start_position() const { return start_position_; } | 1760 int start_position() const { return start_position_; } |
1754 int end_position() const { return end_position_; } | 1761 int end_position() const { return end_position_; } |
1755 bool is_expression() const { return is_expression_; } | 1762 bool is_expression() const { return is_expression_; } |
| 1763 bool is_anonymous() const { return is_anonymous_; } |
1756 bool strict_mode() const; | 1764 bool strict_mode() const; |
1757 | 1765 |
1758 int materialized_literal_count() { return materialized_literal_count_; } | 1766 int materialized_literal_count() { return materialized_literal_count_; } |
1759 int expected_property_count() { return expected_property_count_; } | 1767 int expected_property_count() { return expected_property_count_; } |
1760 bool has_only_simple_this_property_assignments() { | 1768 bool has_only_simple_this_property_assignments() { |
1761 return has_only_simple_this_property_assignments_; | 1769 return has_only_simple_this_property_assignments_; |
1762 } | 1770 } |
1763 Handle<FixedArray> this_property_assignments() { | 1771 Handle<FixedArray> this_property_assignments() { |
1764 return this_property_assignments_; | 1772 return this_property_assignments_; |
1765 } | 1773 } |
(...skipping 24 matching lines...) Expand all Loading... |
1790 int materialized_literal_count_; | 1798 int materialized_literal_count_; |
1791 int expected_property_count_; | 1799 int expected_property_count_; |
1792 bool has_only_simple_this_property_assignments_; | 1800 bool has_only_simple_this_property_assignments_; |
1793 Handle<FixedArray> this_property_assignments_; | 1801 Handle<FixedArray> this_property_assignments_; |
1794 int num_parameters_; | 1802 int num_parameters_; |
1795 int start_position_; | 1803 int start_position_; |
1796 int end_position_; | 1804 int end_position_; |
1797 int function_token_position_; | 1805 int function_token_position_; |
1798 Handle<String> inferred_name_; | 1806 Handle<String> inferred_name_; |
1799 bool is_expression_; | 1807 bool is_expression_; |
| 1808 bool is_anonymous_; |
1800 bool pretenure_; | 1809 bool pretenure_; |
1801 bool has_duplicate_parameters_; | 1810 bool has_duplicate_parameters_; |
1802 }; | 1811 }; |
1803 | 1812 |
1804 | 1813 |
1805 class SharedFunctionInfoLiteral: public Expression { | 1814 class SharedFunctionInfoLiteral: public Expression { |
1806 public: | 1815 public: |
1807 SharedFunctionInfoLiteral( | 1816 SharedFunctionInfoLiteral( |
1808 Isolate* isolate, | 1817 Isolate* isolate, |
1809 Handle<SharedFunctionInfo> shared_function_info) | 1818 Handle<SharedFunctionInfo> shared_function_info) |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2227 | 2236 |
2228 private: | 2237 private: |
2229 Isolate* isolate_; | 2238 Isolate* isolate_; |
2230 bool stack_overflow_; | 2239 bool stack_overflow_; |
2231 }; | 2240 }; |
2232 | 2241 |
2233 | 2242 |
2234 } } // namespace v8::internal | 2243 } } // namespace v8::internal |
2235 | 2244 |
2236 #endif // V8_AST_H_ | 2245 #endif // V8_AST_H_ |
OLD | NEW |