| 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 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 virtual int ContinueId() const = 0; | 433 virtual int ContinueId() const = 0; |
| 434 virtual int StackCheckId() const = 0; | 434 virtual int StackCheckId() const = 0; |
| 435 | 435 |
| 436 // Code generation | 436 // Code generation |
| 437 Label* continue_target() { return &continue_target_; } | 437 Label* continue_target() { return &continue_target_; } |
| 438 | 438 |
| 439 protected: | 439 protected: |
| 440 IterationStatement(Isolate* isolate, ZoneStringList* labels) | 440 IterationStatement(Isolate* isolate, ZoneStringList* labels) |
| 441 : BreakableStatement(isolate, labels, TARGET_FOR_ANONYMOUS), | 441 : BreakableStatement(isolate, labels, TARGET_FOR_ANONYMOUS), |
| 442 body_(NULL), | 442 body_(NULL), |
| 443 continue_target_(), | |
| 444 osr_entry_id_(GetNextId(isolate)) { | 443 osr_entry_id_(GetNextId(isolate)) { |
| 445 } | 444 } |
| 446 | 445 |
| 447 void Initialize(Statement* body) { | 446 void Initialize(Statement* body) { |
| 448 body_ = body; | 447 body_ = body; |
| 449 } | 448 } |
| 450 | 449 |
| 451 private: | 450 private: |
| 452 Statement* body_; | 451 Statement* body_; |
| 453 Label continue_target_; | 452 Label continue_target_; |
| (...skipping 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1640 }; | 1639 }; |
| 1641 | 1640 |
| 1642 FunctionLiteral(Isolate* isolate, | 1641 FunctionLiteral(Isolate* isolate, |
| 1643 Handle<String> name, | 1642 Handle<String> name, |
| 1644 Scope* scope, | 1643 Scope* scope, |
| 1645 ZoneList<Statement*>* body, | 1644 ZoneList<Statement*>* body, |
| 1646 int materialized_literal_count, | 1645 int materialized_literal_count, |
| 1647 int expected_property_count, | 1646 int expected_property_count, |
| 1648 bool has_only_simple_this_property_assignments, | 1647 bool has_only_simple_this_property_assignments, |
| 1649 Handle<FixedArray> this_property_assignments, | 1648 Handle<FixedArray> this_property_assignments, |
| 1650 int num_parameters, | 1649 int parameter_count, |
| 1651 Type type, | 1650 Type type, |
| 1652 bool has_duplicate_parameters) | 1651 bool has_duplicate_parameters) |
| 1653 : Expression(isolate), | 1652 : Expression(isolate), |
| 1654 name_(name), | 1653 name_(name), |
| 1655 scope_(scope), | 1654 scope_(scope), |
| 1656 body_(body), | 1655 body_(body), |
| 1656 this_property_assignments_(this_property_assignments), |
| 1657 inferred_name_(isolate->factory()->empty_string()), |
| 1657 materialized_literal_count_(materialized_literal_count), | 1658 materialized_literal_count_(materialized_literal_count), |
| 1658 expected_property_count_(expected_property_count), | 1659 expected_property_count_(expected_property_count), |
| 1659 has_only_simple_this_property_assignments_( | 1660 parameter_count_(parameter_count), |
| 1660 has_only_simple_this_property_assignments), | 1661 function_token_position_(RelocInfo::kNoPosition) { |
| 1661 this_property_assignments_(this_property_assignments), | 1662 bitfield_ = |
| 1662 num_parameters_(num_parameters), | 1663 HasOnlySimpleThisPropertyAssignments::encode( |
| 1663 function_token_position_(RelocInfo::kNoPosition), | 1664 has_only_simple_this_property_assignments) | |
| 1664 inferred_name_(HEAP->empty_string()), | 1665 IsExpression::encode(type != DECLARATION) | |
| 1665 is_expression_(type != DECLARATION), | 1666 IsAnonymous::encode(type == ANONYMOUS_EXPRESSION) | |
| 1666 is_anonymous_(type == ANONYMOUS_EXPRESSION), | 1667 Pretenure::encode(false) | |
| 1667 pretenure_(false), | 1668 HasDuplicateParameters::encode(has_duplicate_parameters); |
| 1668 has_duplicate_parameters_(has_duplicate_parameters) { | |
| 1669 } | 1669 } |
| 1670 | 1670 |
| 1671 DECLARE_NODE_TYPE(FunctionLiteral) | 1671 DECLARE_NODE_TYPE(FunctionLiteral) |
| 1672 | 1672 |
| 1673 Handle<String> name() const { return name_; } | 1673 Handle<String> name() const { return name_; } |
| 1674 Scope* scope() const { return scope_; } | 1674 Scope* scope() const { return scope_; } |
| 1675 ZoneList<Statement*>* body() const { return body_; } | 1675 ZoneList<Statement*>* body() const { return body_; } |
| 1676 void set_function_token_position(int pos) { function_token_position_ = pos; } | 1676 void set_function_token_position(int pos) { function_token_position_ = pos; } |
| 1677 int function_token_position() const { return function_token_position_; } | 1677 int function_token_position() const { return function_token_position_; } |
| 1678 int start_position() const; | 1678 int start_position() const; |
| 1679 int end_position() const; | 1679 int end_position() const; |
| 1680 bool is_expression() const { return is_expression_; } | 1680 bool is_expression() const { return IsExpression::decode(bitfield_); } |
| 1681 bool is_anonymous() const { return is_anonymous_; } | 1681 bool is_anonymous() const { return IsAnonymous::decode(bitfield_); } |
| 1682 bool strict_mode() const { return strict_mode_flag() == kStrictMode; } | 1682 bool strict_mode() const { return strict_mode_flag() == kStrictMode; } |
| 1683 StrictModeFlag strict_mode_flag() const; | 1683 StrictModeFlag strict_mode_flag() const; |
| 1684 | 1684 |
| 1685 int materialized_literal_count() { return materialized_literal_count_; } | 1685 int materialized_literal_count() { return materialized_literal_count_; } |
| 1686 int expected_property_count() { return expected_property_count_; } | 1686 int expected_property_count() { return expected_property_count_; } |
| 1687 bool has_only_simple_this_property_assignments() { | 1687 bool has_only_simple_this_property_assignments() { |
| 1688 return has_only_simple_this_property_assignments_; | 1688 return HasOnlySimpleThisPropertyAssignments::decode(bitfield_); |
| 1689 } | 1689 } |
| 1690 Handle<FixedArray> this_property_assignments() { | 1690 Handle<FixedArray> this_property_assignments() { |
| 1691 return this_property_assignments_; | 1691 return this_property_assignments_; |
| 1692 } | 1692 } |
| 1693 int num_parameters() { return num_parameters_; } | 1693 int parameter_count() { return parameter_count_; } |
| 1694 | 1694 |
| 1695 bool AllowsLazyCompilation(); | 1695 bool AllowsLazyCompilation(); |
| 1696 | 1696 |
| 1697 Handle<String> debug_name() const { | 1697 Handle<String> debug_name() const { |
| 1698 if (name_->length() > 0) return name_; | 1698 if (name_->length() > 0) return name_; |
| 1699 return inferred_name(); | 1699 return inferred_name(); |
| 1700 } | 1700 } |
| 1701 | 1701 |
| 1702 Handle<String> inferred_name() const { return inferred_name_; } | 1702 Handle<String> inferred_name() const { return inferred_name_; } |
| 1703 void set_inferred_name(Handle<String> inferred_name) { | 1703 void set_inferred_name(Handle<String> inferred_name) { |
| 1704 inferred_name_ = inferred_name; | 1704 inferred_name_ = inferred_name; |
| 1705 } | 1705 } |
| 1706 | 1706 |
| 1707 bool pretenure() { return pretenure_; } | 1707 bool pretenure() { return Pretenure::decode(bitfield_); } |
| 1708 void set_pretenure(bool value) { pretenure_ = value; } | 1708 void set_pretenure() { bitfield_ |= Pretenure::encode(true); } |
| 1709 virtual bool IsInlineable() const; | 1709 virtual bool IsInlineable() const; |
| 1710 | 1710 |
| 1711 bool has_duplicate_parameters() { return has_duplicate_parameters_; } | 1711 bool has_duplicate_parameters() { |
| 1712 return HasDuplicateParameters::decode(bitfield_); |
| 1713 } |
| 1712 | 1714 |
| 1713 private: | 1715 private: |
| 1714 Handle<String> name_; | 1716 Handle<String> name_; |
| 1715 Scope* scope_; | 1717 Scope* scope_; |
| 1716 ZoneList<Statement*>* body_; | 1718 ZoneList<Statement*>* body_; |
| 1719 Handle<FixedArray> this_property_assignments_; |
| 1720 Handle<String> inferred_name_; |
| 1721 |
| 1717 int materialized_literal_count_; | 1722 int materialized_literal_count_; |
| 1718 int expected_property_count_; | 1723 int expected_property_count_; |
| 1719 bool has_only_simple_this_property_assignments_; | 1724 int parameter_count_; |
| 1720 Handle<FixedArray> this_property_assignments_; | |
| 1721 int num_parameters_; | |
| 1722 int start_position_; | |
| 1723 int end_position_; | |
| 1724 int function_token_position_; | 1725 int function_token_position_; |
| 1725 Handle<String> inferred_name_; | 1726 |
| 1726 bool is_expression_; | 1727 unsigned bitfield_; |
| 1727 bool is_anonymous_; | 1728 class HasOnlySimpleThisPropertyAssignments: public BitField<bool, 0, 1> {}; |
| 1728 bool pretenure_; | 1729 class IsExpression: public BitField<bool, 1, 1> {}; |
| 1729 bool has_duplicate_parameters_; | 1730 class IsAnonymous: public BitField<bool, 2, 1> {}; |
| 1731 class Pretenure: public BitField<bool, 3, 1> {}; |
| 1732 class HasDuplicateParameters: public BitField<bool, 4, 1> {}; |
| 1730 }; | 1733 }; |
| 1731 | 1734 |
| 1732 | 1735 |
| 1733 class SharedFunctionInfoLiteral: public Expression { | 1736 class SharedFunctionInfoLiteral: public Expression { |
| 1734 public: | 1737 public: |
| 1735 SharedFunctionInfoLiteral( | 1738 SharedFunctionInfoLiteral( |
| 1736 Isolate* isolate, | 1739 Isolate* isolate, |
| 1737 Handle<SharedFunctionInfo> shared_function_info) | 1740 Handle<SharedFunctionInfo> shared_function_info) |
| 1738 : Expression(isolate), shared_function_info_(shared_function_info) { } | 1741 : Expression(isolate), shared_function_info_(shared_function_info) { } |
| 1739 | 1742 |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2152 | 2155 |
| 2153 private: | 2156 private: |
| 2154 Isolate* isolate_; | 2157 Isolate* isolate_; |
| 2155 bool stack_overflow_; | 2158 bool stack_overflow_; |
| 2156 }; | 2159 }; |
| 2157 | 2160 |
| 2158 | 2161 |
| 2159 } } // namespace v8::internal | 2162 } } // namespace v8::internal |
| 2160 | 2163 |
| 2161 #endif // V8_AST_H_ | 2164 #endif // V8_AST_H_ |
| OLD | NEW |