| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 917 | 917 |
| 918 class ForInStatement V8_FINAL : public ForEachStatement { | 918 class ForInStatement V8_FINAL : public ForEachStatement { |
| 919 public: | 919 public: |
| 920 DECLARE_NODE_TYPE(ForInStatement) | 920 DECLARE_NODE_TYPE(ForInStatement) |
| 921 | 921 |
| 922 Expression* enumerable() const { | 922 Expression* enumerable() const { |
| 923 return subject(); | 923 return subject(); |
| 924 } | 924 } |
| 925 | 925 |
| 926 TypeFeedbackId ForInFeedbackId() const { return reuse(PrepareId()); } | 926 TypeFeedbackId ForInFeedbackId() const { return reuse(PrepareId()); } |
| 927 void RecordTypeFeedback(TypeFeedbackOracle* oracle); | |
| 928 enum ForInType { FAST_FOR_IN, SLOW_FOR_IN }; | 927 enum ForInType { FAST_FOR_IN, SLOW_FOR_IN }; |
| 929 ForInType for_in_type() const { return for_in_type_; } | 928 ForInType for_in_type() const { return for_in_type_; } |
| 929 void set_for_in_type(ForInType type) { for_in_type_ = type; } |
| 930 | 930 |
| 931 BailoutId BodyId() const { return body_id_; } | 931 BailoutId BodyId() const { return body_id_; } |
| 932 BailoutId PrepareId() const { return prepare_id_; } | 932 BailoutId PrepareId() const { return prepare_id_; } |
| 933 virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); } | 933 virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); } |
| 934 virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; } | 934 virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; } |
| 935 | 935 |
| 936 protected: | 936 protected: |
| 937 ForInStatement(Isolate* isolate, ZoneStringList* labels, int pos) | 937 ForInStatement(Isolate* isolate, ZoneStringList* labels, int pos) |
| 938 : ForEachStatement(isolate, labels, pos), | 938 : ForEachStatement(isolate, labels, pos), |
| 939 for_in_type_(SLOW_FOR_IN), | 939 for_in_type_(SLOW_FOR_IN), |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1115 CHECK(!is_default()); | 1115 CHECK(!is_default()); |
| 1116 return label_; | 1116 return label_; |
| 1117 } | 1117 } |
| 1118 Label* body_target() { return &body_target_; } | 1118 Label* body_target() { return &body_target_; } |
| 1119 ZoneList<Statement*>* statements() const { return statements_; } | 1119 ZoneList<Statement*>* statements() const { return statements_; } |
| 1120 | 1120 |
| 1121 BailoutId EntryId() const { return entry_id_; } | 1121 BailoutId EntryId() const { return entry_id_; } |
| 1122 | 1122 |
| 1123 // Type feedback information. | 1123 // Type feedback information. |
| 1124 TypeFeedbackId CompareId() { return compare_id_; } | 1124 TypeFeedbackId CompareId() { return compare_id_; } |
| 1125 void RecordTypeFeedback(TypeFeedbackOracle* oracle); | |
| 1126 Handle<Type> compare_type() { return compare_type_; } | 1125 Handle<Type> compare_type() { return compare_type_; } |
| 1126 void set_compare_type(Handle<Type> type) { compare_type_ = type; } |
| 1127 | 1127 |
| 1128 private: | 1128 private: |
| 1129 CaseClause(Isolate* isolate, | 1129 CaseClause(Isolate* isolate, |
| 1130 Expression* label, | 1130 Expression* label, |
| 1131 ZoneList<Statement*>* statements, | 1131 ZoneList<Statement*>* statements, |
| 1132 int pos); | 1132 int pos); |
| 1133 | 1133 |
| 1134 Expression* label_; | 1134 Expression* label_; |
| 1135 Label body_target_; | 1135 Label body_target_; |
| 1136 ZoneList<Statement*>* statements_; | 1136 ZoneList<Statement*>* statements_; |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1597 ZoneList<Expression*>* values() const { return values_; } | 1597 ZoneList<Expression*>* values() const { return values_; } |
| 1598 | 1598 |
| 1599 // Return an AST id for an element that is used in simulate instructions. | 1599 // Return an AST id for an element that is used in simulate instructions. |
| 1600 BailoutId GetIdForElement(int i) { | 1600 BailoutId GetIdForElement(int i) { |
| 1601 return BailoutId(first_element_id_.ToInt() + i); | 1601 return BailoutId(first_element_id_.ToInt() + i); |
| 1602 } | 1602 } |
| 1603 | 1603 |
| 1604 // Populate the constant elements fixed array. | 1604 // Populate the constant elements fixed array. |
| 1605 void BuildConstantElements(Isolate* isolate); | 1605 void BuildConstantElements(Isolate* isolate); |
| 1606 | 1606 |
| 1607 enum Flags { |
| 1608 kNoFlags = 0, |
| 1609 kShallowElements = 1, |
| 1610 kDisableMementos = 1 << 1 |
| 1611 }; |
| 1612 |
| 1607 protected: | 1613 protected: |
| 1608 ArrayLiteral(Isolate* isolate, | 1614 ArrayLiteral(Isolate* isolate, |
| 1609 ZoneList<Expression*>* values, | 1615 ZoneList<Expression*>* values, |
| 1610 int literal_index, | 1616 int literal_index, |
| 1611 int pos) | 1617 int pos) |
| 1612 : MaterializedLiteral(isolate, literal_index, pos), | 1618 : MaterializedLiteral(isolate, literal_index, pos), |
| 1613 values_(values), | 1619 values_(values), |
| 1614 first_element_id_(ReserveIdRange(isolate, values->length())) {} | 1620 first_element_id_(ReserveIdRange(isolate, values->length())) {} |
| 1615 | 1621 |
| 1616 private: | 1622 private: |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1678 | 1684 |
| 1679 Expression* obj() const { return obj_; } | 1685 Expression* obj() const { return obj_; } |
| 1680 Expression* key() const { return key_; } | 1686 Expression* key() const { return key_; } |
| 1681 | 1687 |
| 1682 BailoutId LoadId() const { return load_id_; } | 1688 BailoutId LoadId() const { return load_id_; } |
| 1683 | 1689 |
| 1684 bool IsStringAccess() const { return is_string_access_; } | 1690 bool IsStringAccess() const { return is_string_access_; } |
| 1685 bool IsFunctionPrototype() const { return is_function_prototype_; } | 1691 bool IsFunctionPrototype() const { return is_function_prototype_; } |
| 1686 | 1692 |
| 1687 // Type feedback information. | 1693 // Type feedback information. |
| 1688 void RecordTypeFeedback(TypeFeedbackOracle* oracle, Zone* zone); | |
| 1689 virtual bool IsMonomorphic() V8_OVERRIDE { return is_monomorphic_; } | 1694 virtual bool IsMonomorphic() V8_OVERRIDE { return is_monomorphic_; } |
| 1690 virtual SmallMapList* GetReceiverTypes() V8_OVERRIDE { | 1695 virtual SmallMapList* GetReceiverTypes() V8_OVERRIDE { |
| 1691 return &receiver_types_; | 1696 return &receiver_types_; |
| 1692 } | 1697 } |
| 1693 virtual KeyedAccessStoreMode GetStoreMode() V8_OVERRIDE { | 1698 virtual KeyedAccessStoreMode GetStoreMode() V8_OVERRIDE { |
| 1694 return STANDARD_STORE; | 1699 return STANDARD_STORE; |
| 1695 } | 1700 } |
| 1696 bool IsUninitialized() { return is_uninitialized_; } | 1701 bool IsUninitialized() { return is_uninitialized_; } |
| 1697 bool IsPreMonomorphic() { return is_pre_monomorphic_; } | 1702 bool IsPreMonomorphic() { return is_pre_monomorphic_; } |
| 1698 bool HasNoTypeInformation() { | 1703 bool HasNoTypeInformation() { |
| 1699 return is_uninitialized_ || is_pre_monomorphic_; | 1704 return is_uninitialized_ || is_pre_monomorphic_; |
| 1700 } | 1705 } |
| 1706 void set_is_uninitialized(bool b) { is_uninitialized_ = b; } |
| 1707 void set_is_monomorphic(bool b) { is_monomorphic_ = b; } |
| 1708 void set_is_pre_monomorphic(bool b) { is_pre_monomorphic_ = b; } |
| 1709 void set_is_string_access(bool b) { is_string_access_ = b; } |
| 1710 void set_is_function_prototype(bool b) { is_function_prototype_ = b; } |
| 1711 |
| 1701 TypeFeedbackId PropertyFeedbackId() { return reuse(id()); } | 1712 TypeFeedbackId PropertyFeedbackId() { return reuse(id()); } |
| 1702 | 1713 |
| 1703 protected: | 1714 protected: |
| 1704 Property(Isolate* isolate, | 1715 Property(Isolate* isolate, |
| 1705 Expression* obj, | 1716 Expression* obj, |
| 1706 Expression* key, | 1717 Expression* key, |
| 1707 int pos) | 1718 int pos) |
| 1708 : Expression(isolate, pos), | 1719 : Expression(isolate, pos), |
| 1709 obj_(obj), | 1720 obj_(obj), |
| 1710 key_(key), | 1721 key_(key), |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1983 bool is_prefix() const { return is_prefix_; } | 1994 bool is_prefix() const { return is_prefix_; } |
| 1984 bool is_postfix() const { return !is_prefix_; } | 1995 bool is_postfix() const { return !is_prefix_; } |
| 1985 | 1996 |
| 1986 Token::Value op() const { return op_; } | 1997 Token::Value op() const { return op_; } |
| 1987 Token::Value binary_op() { | 1998 Token::Value binary_op() { |
| 1988 return (op() == Token::INC) ? Token::ADD : Token::SUB; | 1999 return (op() == Token::INC) ? Token::ADD : Token::SUB; |
| 1989 } | 2000 } |
| 1990 | 2001 |
| 1991 Expression* expression() const { return expression_; } | 2002 Expression* expression() const { return expression_; } |
| 1992 | 2003 |
| 1993 void RecordTypeFeedback(TypeFeedbackOracle* oracle, Zone* zone); | |
| 1994 virtual bool IsMonomorphic() V8_OVERRIDE { return is_monomorphic_; } | 2004 virtual bool IsMonomorphic() V8_OVERRIDE { return is_monomorphic_; } |
| 1995 virtual SmallMapList* GetReceiverTypes() V8_OVERRIDE { | 2005 virtual SmallMapList* GetReceiverTypes() V8_OVERRIDE { |
| 1996 return &receiver_types_; | 2006 return &receiver_types_; |
| 1997 } | 2007 } |
| 1998 virtual KeyedAccessStoreMode GetStoreMode() V8_OVERRIDE { | 2008 virtual KeyedAccessStoreMode GetStoreMode() V8_OVERRIDE { |
| 1999 return store_mode_; | 2009 return store_mode_; |
| 2000 } | 2010 } |
| 2001 Handle<Type> type() const { return type_; } | 2011 Handle<Type> type() const { return type_; } |
| 2012 void set_is_monomorphic(bool b) { is_monomorphic_ = b; } |
| 2013 void set_store_mode(KeyedAccessStoreMode mode) { store_mode_ = mode; } |
| 2014 void set_type(Handle<Type> type) { type_ = type; } |
| 2002 | 2015 |
| 2003 BailoutId AssignmentId() const { return assignment_id_; } | 2016 BailoutId AssignmentId() const { return assignment_id_; } |
| 2004 | 2017 |
| 2005 TypeFeedbackId CountBinOpFeedbackId() const { return count_id_; } | 2018 TypeFeedbackId CountBinOpFeedbackId() const { return count_id_; } |
| 2006 TypeFeedbackId CountStoreFeedbackId() const { return reuse(id()); } | 2019 TypeFeedbackId CountStoreFeedbackId() const { return reuse(id()); } |
| 2007 | 2020 |
| 2008 protected: | 2021 protected: |
| 2009 CountOperation(Isolate* isolate, | 2022 CountOperation(Isolate* isolate, |
| 2010 Token::Value op, | 2023 Token::Value op, |
| 2011 bool is_prefix, | 2024 bool is_prefix, |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2122 Expression* value() const { return value_; } | 2135 Expression* value() const { return value_; } |
| 2123 BinaryOperation* binary_operation() const { return binary_operation_; } | 2136 BinaryOperation* binary_operation() const { return binary_operation_; } |
| 2124 | 2137 |
| 2125 // This check relies on the definition order of token in token.h. | 2138 // This check relies on the definition order of token in token.h. |
| 2126 bool is_compound() const { return op() > Token::ASSIGN; } | 2139 bool is_compound() const { return op() > Token::ASSIGN; } |
| 2127 | 2140 |
| 2128 BailoutId AssignmentId() const { return assignment_id_; } | 2141 BailoutId AssignmentId() const { return assignment_id_; } |
| 2129 | 2142 |
| 2130 // Type feedback information. | 2143 // Type feedback information. |
| 2131 TypeFeedbackId AssignmentFeedbackId() { return reuse(id()); } | 2144 TypeFeedbackId AssignmentFeedbackId() { return reuse(id()); } |
| 2132 void RecordTypeFeedback(TypeFeedbackOracle* oracle, Zone* zone); | |
| 2133 virtual bool IsMonomorphic() V8_OVERRIDE { return is_monomorphic_; } | 2145 virtual bool IsMonomorphic() V8_OVERRIDE { return is_monomorphic_; } |
| 2134 bool IsUninitialized() { return is_uninitialized_; } | 2146 bool IsUninitialized() { return is_uninitialized_; } |
| 2135 bool IsPreMonomorphic() { return is_pre_monomorphic_; } | 2147 bool IsPreMonomorphic() { return is_pre_monomorphic_; } |
| 2136 bool HasNoTypeInformation() { | 2148 bool HasNoTypeInformation() { |
| 2137 return is_uninitialized_ || is_pre_monomorphic_; | 2149 return is_uninitialized_ || is_pre_monomorphic_; |
| 2138 } | 2150 } |
| 2139 virtual SmallMapList* GetReceiverTypes() V8_OVERRIDE { | 2151 virtual SmallMapList* GetReceiverTypes() V8_OVERRIDE { |
| 2140 return &receiver_types_; | 2152 return &receiver_types_; |
| 2141 } | 2153 } |
| 2142 virtual KeyedAccessStoreMode GetStoreMode() V8_OVERRIDE { | 2154 virtual KeyedAccessStoreMode GetStoreMode() V8_OVERRIDE { |
| 2143 return store_mode_; | 2155 return store_mode_; |
| 2144 } | 2156 } |
| 2157 void set_is_uninitialized(bool b) { is_uninitialized_ = b; } |
| 2158 void set_is_monomorphic(bool b) { is_monomorphic_ = b; } |
| 2159 void set_is_pre_monomorphic(bool b) { is_pre_monomorphic_ = b; } |
| 2160 void set_store_mode(KeyedAccessStoreMode mode) { store_mode_ = mode; } |
| 2145 | 2161 |
| 2146 protected: | 2162 protected: |
| 2147 Assignment(Isolate* isolate, | 2163 Assignment(Isolate* isolate, |
| 2148 Token::Value op, | 2164 Token::Value op, |
| 2149 Expression* target, | 2165 Expression* target, |
| 2150 Expression* value, | 2166 Expression* value, |
| 2151 int pos); | 2167 int pos); |
| 2152 | 2168 |
| 2153 template<class Visitor> | 2169 template<class Visitor> |
| 2154 void Init(Isolate* isolate, AstNodeFactory<Visitor>* factory) { | 2170 void Init(Isolate* isolate, AstNodeFactory<Visitor>* factory) { |
| (...skipping 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3285 private: | 3301 private: |
| 3286 Isolate* isolate_; | 3302 Isolate* isolate_; |
| 3287 Zone* zone_; | 3303 Zone* zone_; |
| 3288 Visitor visitor_; | 3304 Visitor visitor_; |
| 3289 }; | 3305 }; |
| 3290 | 3306 |
| 3291 | 3307 |
| 3292 } } // namespace v8::internal | 3308 } } // namespace v8::internal |
| 3293 | 3309 |
| 3294 #endif // V8_AST_H_ | 3310 #endif // V8_AST_H_ |
| OLD | NEW |