Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(411)

Side by Side Diff: src/ast.h

Issue 157503002: A64: Synchronize with r18444. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/assembler.cc ('k') | src/ast.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 21 matching lines...) Expand all
32 32
33 #include "assembler.h" 33 #include "assembler.h"
34 #include "factory.h" 34 #include "factory.h"
35 #include "isolate.h" 35 #include "isolate.h"
36 #include "jsregexp.h" 36 #include "jsregexp.h"
37 #include "list-inl.h" 37 #include "list-inl.h"
38 #include "runtime.h" 38 #include "runtime.h"
39 #include "small-pointer-list.h" 39 #include "small-pointer-list.h"
40 #include "smart-pointers.h" 40 #include "smart-pointers.h"
41 #include "token.h" 41 #include "token.h"
42 #include "type-info.h" // TODO(rossberg): this should eventually be removed
43 #include "types.h" 42 #include "types.h"
44 #include "utils.h" 43 #include "utils.h"
45 #include "variables.h" 44 #include "variables.h"
46 #include "interface.h" 45 #include "interface.h"
47 #include "zone-inl.h" 46 #include "zone-inl.h"
48 47
49 namespace v8 { 48 namespace v8 {
50 namespace internal { 49 namespace internal {
51 50
52 // The abstract syntax tree is an intermediate, light-weight 51 // The abstract syntax tree is an intermediate, light-weight
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 V(Yield) \ 107 V(Yield) \
109 V(Throw) \ 108 V(Throw) \
110 V(Property) \ 109 V(Property) \
111 V(Call) \ 110 V(Call) \
112 V(CallNew) \ 111 V(CallNew) \
113 V(CallRuntime) \ 112 V(CallRuntime) \
114 V(UnaryOperation) \ 113 V(UnaryOperation) \
115 V(CountOperation) \ 114 V(CountOperation) \
116 V(BinaryOperation) \ 115 V(BinaryOperation) \
117 V(CompareOperation) \ 116 V(CompareOperation) \
118 V(ThisFunction) 117 V(ThisFunction) \
119
120 #define AUXILIARY_NODE_LIST(V) \
121 V(CaseClause) 118 V(CaseClause)
122 119
123 #define AST_NODE_LIST(V) \ 120 #define AST_NODE_LIST(V) \
124 DECLARATION_NODE_LIST(V) \ 121 DECLARATION_NODE_LIST(V) \
125 MODULE_NODE_LIST(V) \ 122 MODULE_NODE_LIST(V) \
126 STATEMENT_NODE_LIST(V) \ 123 STATEMENT_NODE_LIST(V) \
127 EXPRESSION_NODE_LIST(V) \ 124 EXPRESSION_NODE_LIST(V)
128 AUXILIARY_NODE_LIST(V)
129 125
130 // Forward declarations 126 // Forward declarations
131 class AstConstructionVisitor; 127 class AstConstructionVisitor;
132 template<class> class AstNodeFactory; 128 template<class> class AstNodeFactory;
133 class AstVisitor; 129 class AstVisitor;
134 class Declaration; 130 class Declaration;
135 class Module; 131 class Module;
136 class BreakableStatement; 132 class BreakableStatement;
137 class Expression; 133 class Expression;
138 class IterationStatement; 134 class IterationStatement;
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 SmallMapList(int capacity, Zone* zone) : list_(capacity, zone) {} 268 SmallMapList(int capacity, Zone* zone) : list_(capacity, zone) {}
273 269
274 void Reserve(int capacity, Zone* zone) { list_.Reserve(capacity, zone); } 270 void Reserve(int capacity, Zone* zone) { list_.Reserve(capacity, zone); }
275 void Clear() { list_.Clear(); } 271 void Clear() { list_.Clear(); }
276 void Sort() { list_.Sort(); } 272 void Sort() { list_.Sort(); }
277 273
278 bool is_empty() const { return list_.is_empty(); } 274 bool is_empty() const { return list_.is_empty(); }
279 int length() const { return list_.length(); } 275 int length() const { return list_.length(); }
280 276
281 void AddMapIfMissing(Handle<Map> map, Zone* zone) { 277 void AddMapIfMissing(Handle<Map> map, Zone* zone) {
282 Map* updated = map->CurrentMapForDeprecated(); 278 map = Map::CurrentMapForDeprecated(map);
283 if (updated == NULL) return; 279 if (map.is_null()) return;
284 map = Handle<Map>(updated);
285 for (int i = 0; i < length(); ++i) { 280 for (int i = 0; i < length(); ++i) {
286 if (at(i).is_identical_to(map)) return; 281 if (at(i).is_identical_to(map)) return;
287 } 282 }
288 Add(map, zone); 283 Add(map, zone);
289 } 284 }
290 285
291 void FilterForPossibleTransitions(Map* root_map) { 286 void FilterForPossibleTransitions(Map* root_map) {
292 for (int i = list_.length() - 1; i >= 0; i--) { 287 for (int i = list_.length() - 1; i >= 0; i--) {
293 if (at(i)->FindRootMap() != root_map) { 288 if (at(i)->FindRootMap() != root_map) {
294 list_.RemoveElement(list_.at(i)); 289 list_.RemoveElement(list_.at(i));
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after
1099 expression_(expression), 1094 expression_(expression),
1100 statement_(statement) { } 1095 statement_(statement) { }
1101 1096
1102 private: 1097 private:
1103 Scope* scope_; 1098 Scope* scope_;
1104 Expression* expression_; 1099 Expression* expression_;
1105 Statement* statement_; 1100 Statement* statement_;
1106 }; 1101 };
1107 1102
1108 1103
1109 class CaseClause V8_FINAL : public AstNode { 1104 class CaseClause V8_FINAL : public Expression {
1110 public: 1105 public:
1111 DECLARE_NODE_TYPE(CaseClause) 1106 DECLARE_NODE_TYPE(CaseClause)
1112 1107
1113 bool is_default() const { return label_ == NULL; } 1108 bool is_default() const { return label_ == NULL; }
1114 Expression* label() const { 1109 Expression* label() const {
1115 CHECK(!is_default()); 1110 CHECK(!is_default());
1116 return label_; 1111 return label_;
1117 } 1112 }
1118 Label* body_target() { return &body_target_; } 1113 Label* body_target() { return &body_target_; }
1119 ZoneList<Statement*>* statements() const { return statements_; } 1114 ZoneList<Statement*>* statements() const { return statements_; }
(...skipping 21 matching lines...) Expand all
1141 }; 1136 };
1142 1137
1143 1138
1144 class SwitchStatement V8_FINAL : public BreakableStatement { 1139 class SwitchStatement V8_FINAL : public BreakableStatement {
1145 public: 1140 public:
1146 DECLARE_NODE_TYPE(SwitchStatement) 1141 DECLARE_NODE_TYPE(SwitchStatement)
1147 1142
1148 void Initialize(Expression* tag, ZoneList<CaseClause*>* cases) { 1143 void Initialize(Expression* tag, ZoneList<CaseClause*>* cases) {
1149 tag_ = tag; 1144 tag_ = tag;
1150 cases_ = cases; 1145 cases_ = cases;
1151 switch_type_ = UNKNOWN_SWITCH;
1152 } 1146 }
1153 1147
1154 Expression* tag() const { return tag_; } 1148 Expression* tag() const { return tag_; }
1155 ZoneList<CaseClause*>* cases() const { return cases_; } 1149 ZoneList<CaseClause*>* cases() const { return cases_; }
1156 1150
1157 enum SwitchType { UNKNOWN_SWITCH, SMI_SWITCH, STRING_SWITCH, GENERIC_SWITCH };
1158 SwitchType switch_type() const { return switch_type_; }
1159 void set_switch_type(SwitchType switch_type) { switch_type_ = switch_type; }
1160
1161 protected: 1151 protected:
1162 SwitchStatement(Isolate* isolate, ZoneStringList* labels, int pos) 1152 SwitchStatement(Isolate* isolate, ZoneStringList* labels, int pos)
1163 : BreakableStatement(isolate, labels, TARGET_FOR_ANONYMOUS, pos), 1153 : BreakableStatement(isolate, labels, TARGET_FOR_ANONYMOUS, pos),
1164 tag_(NULL), 1154 tag_(NULL),
1165 cases_(NULL) { } 1155 cases_(NULL) { }
1166 1156
1167 private: 1157 private:
1168 Expression* tag_; 1158 Expression* tag_;
1169 ZoneList<CaseClause*>* cases_; 1159 ZoneList<CaseClause*>* cases_;
1170 SwitchType switch_type_;
1171 }; 1160 };
1172 1161
1173 1162
1174 // If-statements always have non-null references to their then- and 1163 // If-statements always have non-null references to their then- and
1175 // else-parts. When parsing if-statements with no explicit else-part, 1164 // else-parts. When parsing if-statements with no explicit else-part,
1176 // the parser implicitly creates an empty statement. Use the 1165 // the parser implicitly creates an empty statement. Use the
1177 // HasThenStatement() and HasElseStatement() functions to check if a 1166 // HasThenStatement() and HasElseStatement() functions to check if a
1178 // given if-statement has a then- or an else-part containing code. 1167 // given if-statement has a then- or an else-part containing code.
1179 class IfStatement V8_FINAL : public Statement { 1168 class IfStatement V8_FINAL : public Statement {
1180 public: 1169 public:
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
1684 1673
1685 Expression* obj() const { return obj_; } 1674 Expression* obj() const { return obj_; }
1686 Expression* key() const { return key_; } 1675 Expression* key() const { return key_; }
1687 1676
1688 BailoutId LoadId() const { return load_id_; } 1677 BailoutId LoadId() const { return load_id_; }
1689 1678
1690 bool IsStringAccess() const { return is_string_access_; } 1679 bool IsStringAccess() const { return is_string_access_; }
1691 bool IsFunctionPrototype() const { return is_function_prototype_; } 1680 bool IsFunctionPrototype() const { return is_function_prototype_; }
1692 1681
1693 // Type feedback information. 1682 // Type feedback information.
1694 virtual bool IsMonomorphic() V8_OVERRIDE { return is_monomorphic_; } 1683 virtual bool IsMonomorphic() V8_OVERRIDE {
1684 return receiver_types_.length() == 1;
1685 }
1695 virtual SmallMapList* GetReceiverTypes() V8_OVERRIDE { 1686 virtual SmallMapList* GetReceiverTypes() V8_OVERRIDE {
1696 return &receiver_types_; 1687 return &receiver_types_;
1697 } 1688 }
1698 virtual KeyedAccessStoreMode GetStoreMode() V8_OVERRIDE { 1689 virtual KeyedAccessStoreMode GetStoreMode() V8_OVERRIDE {
1699 return STANDARD_STORE; 1690 return STANDARD_STORE;
1700 } 1691 }
1701 bool IsUninitialized() { return is_uninitialized_; } 1692 bool IsUninitialized() { return is_uninitialized_; }
1702 bool IsPreMonomorphic() { return is_pre_monomorphic_; } 1693 bool IsPreMonomorphic() { return is_pre_monomorphic_; }
1703 bool HasNoTypeInformation() { 1694 bool HasNoTypeInformation() {
1704 return is_uninitialized_ || is_pre_monomorphic_; 1695 return is_uninitialized_ || is_pre_monomorphic_;
1705 } 1696 }
1706 void set_is_uninitialized(bool b) { is_uninitialized_ = b; } 1697 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; } 1698 void set_is_pre_monomorphic(bool b) { is_pre_monomorphic_ = b; }
1709 void set_is_string_access(bool b) { is_string_access_ = b; } 1699 void set_is_string_access(bool b) { is_string_access_ = b; }
1710 void set_is_function_prototype(bool b) { is_function_prototype_ = b; } 1700 void set_is_function_prototype(bool b) { is_function_prototype_ = b; }
1711 1701
1712 TypeFeedbackId PropertyFeedbackId() { return reuse(id()); } 1702 TypeFeedbackId PropertyFeedbackId() { return reuse(id()); }
1713 1703
1714 protected: 1704 protected:
1715 Property(Isolate* isolate, 1705 Property(Isolate* isolate,
1716 Expression* obj, 1706 Expression* obj,
1717 Expression* key, 1707 Expression* key,
1718 int pos) 1708 int pos)
1719 : Expression(isolate, pos), 1709 : Expression(isolate, pos),
1720 obj_(obj), 1710 obj_(obj),
1721 key_(key), 1711 key_(key),
1722 load_id_(GetNextId(isolate)), 1712 load_id_(GetNextId(isolate)),
1723 is_monomorphic_(false),
1724 is_pre_monomorphic_(false), 1713 is_pre_monomorphic_(false),
1725 is_uninitialized_(false), 1714 is_uninitialized_(false),
1726 is_string_access_(false), 1715 is_string_access_(false),
1727 is_function_prototype_(false) { } 1716 is_function_prototype_(false) { }
1728 1717
1729 private: 1718 private:
1730 Expression* obj_; 1719 Expression* obj_;
1731 Expression* key_; 1720 Expression* key_;
1732 const BailoutId load_id_; 1721 const BailoutId load_id_;
1733 1722
1734 SmallMapList receiver_types_; 1723 SmallMapList receiver_types_;
1735 bool is_monomorphic_ : 1;
1736 bool is_pre_monomorphic_ : 1; 1724 bool is_pre_monomorphic_ : 1;
1737 bool is_uninitialized_ : 1; 1725 bool is_uninitialized_ : 1;
1738 bool is_string_access_ : 1; 1726 bool is_string_access_ : 1;
1739 bool is_function_prototype_ : 1; 1727 bool is_function_prototype_ : 1;
1740 }; 1728 };
1741 1729
1742 1730
1743 class Call V8_FINAL : public Expression { 1731 class Call V8_FINAL : public Expression {
1744 public: 1732 public:
1745 DECLARE_NODE_TYPE(Call) 1733 DECLARE_NODE_TYPE(Call)
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
1941 1929
1942 class BinaryOperation V8_FINAL : public Expression { 1930 class BinaryOperation V8_FINAL : public Expression {
1943 public: 1931 public:
1944 DECLARE_NODE_TYPE(BinaryOperation) 1932 DECLARE_NODE_TYPE(BinaryOperation)
1945 1933
1946 virtual bool ResultOverwriteAllowed(); 1934 virtual bool ResultOverwriteAllowed();
1947 1935
1948 Token::Value op() const { return op_; } 1936 Token::Value op() const { return op_; }
1949 Expression* left() const { return left_; } 1937 Expression* left() const { return left_; }
1950 Expression* right() const { return right_; } 1938 Expression* right() const { return right_; }
1939 Handle<AllocationSite> allocation_site() const { return allocation_site_; }
1940 void set_allocation_site(Handle<AllocationSite> allocation_site) {
1941 allocation_site_ = allocation_site;
1942 }
1951 1943
1952 BailoutId RightId() const { return right_id_; } 1944 BailoutId RightId() const { return right_id_; }
1953 1945
1954 TypeFeedbackId BinaryOperationFeedbackId() const { return reuse(id()); } 1946 TypeFeedbackId BinaryOperationFeedbackId() const { return reuse(id()); }
1955 Maybe<int> fixed_right_arg() const { return fixed_right_arg_; } 1947 Maybe<int> fixed_right_arg() const { return fixed_right_arg_; }
1956 void set_fixed_right_arg(Maybe<int> arg) { fixed_right_arg_ = arg; } 1948 void set_fixed_right_arg(Maybe<int> arg) { fixed_right_arg_ = arg; }
1957 1949
1958 virtual void RecordToBooleanTypeFeedback( 1950 virtual void RecordToBooleanTypeFeedback(
1959 TypeFeedbackOracle* oracle) V8_OVERRIDE; 1951 TypeFeedbackOracle* oracle) V8_OVERRIDE;
1960 1952
1961 protected: 1953 protected:
1962 BinaryOperation(Isolate* isolate, 1954 BinaryOperation(Isolate* isolate,
1963 Token::Value op, 1955 Token::Value op,
1964 Expression* left, 1956 Expression* left,
1965 Expression* right, 1957 Expression* right,
1966 int pos) 1958 int pos)
1967 : Expression(isolate, pos), 1959 : Expression(isolate, pos),
1968 op_(op), 1960 op_(op),
1969 left_(left), 1961 left_(left),
1970 right_(right), 1962 right_(right),
1971 right_id_(GetNextId(isolate)) { 1963 right_id_(GetNextId(isolate)) {
1972 ASSERT(Token::IsBinaryOp(op)); 1964 ASSERT(Token::IsBinaryOp(op));
1973 } 1965 }
1974 1966
1975 private: 1967 private:
1976 Token::Value op_; 1968 Token::Value op_;
1977 Expression* left_; 1969 Expression* left_;
1978 Expression* right_; 1970 Expression* right_;
1971 Handle<AllocationSite> allocation_site_;
1979 1972
1980 // TODO(rossberg): the fixed arg should probably be represented as a Constant 1973 // TODO(rossberg): the fixed arg should probably be represented as a Constant
1981 // type for the RHS. 1974 // type for the RHS.
1982 Maybe<int> fixed_right_arg_; 1975 Maybe<int> fixed_right_arg_;
1983 1976
1984 // The short-circuit logical operations need an AST ID for their 1977 // The short-circuit logical operations need an AST ID for their
1985 // right-hand subexpression. 1978 // right-hand subexpression.
1986 const BailoutId right_id_; 1979 const BailoutId right_id_;
1987 }; 1980 };
1988 1981
1989 1982
1990 class CountOperation V8_FINAL : public Expression { 1983 class CountOperation V8_FINAL : public Expression {
1991 public: 1984 public:
1992 DECLARE_NODE_TYPE(CountOperation) 1985 DECLARE_NODE_TYPE(CountOperation)
1993 1986
1994 bool is_prefix() const { return is_prefix_; } 1987 bool is_prefix() const { return is_prefix_; }
1995 bool is_postfix() const { return !is_prefix_; } 1988 bool is_postfix() const { return !is_prefix_; }
1996 1989
1997 Token::Value op() const { return op_; } 1990 Token::Value op() const { return op_; }
1998 Token::Value binary_op() { 1991 Token::Value binary_op() {
1999 return (op() == Token::INC) ? Token::ADD : Token::SUB; 1992 return (op() == Token::INC) ? Token::ADD : Token::SUB;
2000 } 1993 }
2001 1994
2002 Expression* expression() const { return expression_; } 1995 Expression* expression() const { return expression_; }
2003 1996
2004 virtual bool IsMonomorphic() V8_OVERRIDE { return is_monomorphic_; } 1997 virtual bool IsMonomorphic() V8_OVERRIDE {
1998 return receiver_types_.length() == 1;
1999 }
2005 virtual SmallMapList* GetReceiverTypes() V8_OVERRIDE { 2000 virtual SmallMapList* GetReceiverTypes() V8_OVERRIDE {
2006 return &receiver_types_; 2001 return &receiver_types_;
2007 } 2002 }
2008 virtual KeyedAccessStoreMode GetStoreMode() V8_OVERRIDE { 2003 virtual KeyedAccessStoreMode GetStoreMode() V8_OVERRIDE {
2009 return store_mode_; 2004 return store_mode_;
2010 } 2005 }
2011 Handle<Type> type() const { return type_; } 2006 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; } 2007 void set_store_mode(KeyedAccessStoreMode mode) { store_mode_ = mode; }
2014 void set_type(Handle<Type> type) { type_ = type; } 2008 void set_type(Handle<Type> type) { type_ = type; }
2015 2009
2016 BailoutId AssignmentId() const { return assignment_id_; } 2010 BailoutId AssignmentId() const { return assignment_id_; }
2017 2011
2018 TypeFeedbackId CountBinOpFeedbackId() const { return count_id_; } 2012 TypeFeedbackId CountBinOpFeedbackId() const { return count_id_; }
2019 TypeFeedbackId CountStoreFeedbackId() const { return reuse(id()); } 2013 TypeFeedbackId CountStoreFeedbackId() const { return reuse(id()); }
2020 2014
2021 protected: 2015 protected:
2022 CountOperation(Isolate* isolate, 2016 CountOperation(Isolate* isolate,
2023 Token::Value op, 2017 Token::Value op,
2024 bool is_prefix, 2018 bool is_prefix,
2025 Expression* expr, 2019 Expression* expr,
2026 int pos) 2020 int pos)
2027 : Expression(isolate, pos), 2021 : Expression(isolate, pos),
2028 op_(op), 2022 op_(op),
2029 is_prefix_(is_prefix), 2023 is_prefix_(is_prefix),
2030 is_monomorphic_(false),
2031 store_mode_(STANDARD_STORE), 2024 store_mode_(STANDARD_STORE),
2032 expression_(expr), 2025 expression_(expr),
2033 assignment_id_(GetNextId(isolate)), 2026 assignment_id_(GetNextId(isolate)),
2034 count_id_(GetNextId(isolate)) {} 2027 count_id_(GetNextId(isolate)) {}
2035 2028
2036 private: 2029 private:
2037 Token::Value op_; 2030 Token::Value op_;
2038 bool is_prefix_ : 1; 2031 bool is_prefix_ : 1;
2039 bool is_monomorphic_ : 1;
2040 KeyedAccessStoreMode store_mode_ : 5; // Windows treats as signed, 2032 KeyedAccessStoreMode store_mode_ : 5; // Windows treats as signed,
2041 // must have extra bit. 2033 // must have extra bit.
2042 Handle<Type> type_; 2034 Handle<Type> type_;
2043 2035
2044 Expression* expression_; 2036 Expression* expression_;
2045 const BailoutId assignment_id_; 2037 const BailoutId assignment_id_;
2046 const TypeFeedbackId count_id_; 2038 const TypeFeedbackId count_id_;
2047 SmallMapList receiver_types_; 2039 SmallMapList receiver_types_;
2048 }; 2040 };
2049 2041
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
2135 Expression* value() const { return value_; } 2127 Expression* value() const { return value_; }
2136 BinaryOperation* binary_operation() const { return binary_operation_; } 2128 BinaryOperation* binary_operation() const { return binary_operation_; }
2137 2129
2138 // This check relies on the definition order of token in token.h. 2130 // This check relies on the definition order of token in token.h.
2139 bool is_compound() const { return op() > Token::ASSIGN; } 2131 bool is_compound() const { return op() > Token::ASSIGN; }
2140 2132
2141 BailoutId AssignmentId() const { return assignment_id_; } 2133 BailoutId AssignmentId() const { return assignment_id_; }
2142 2134
2143 // Type feedback information. 2135 // Type feedback information.
2144 TypeFeedbackId AssignmentFeedbackId() { return reuse(id()); } 2136 TypeFeedbackId AssignmentFeedbackId() { return reuse(id()); }
2145 virtual bool IsMonomorphic() V8_OVERRIDE { return is_monomorphic_; } 2137 virtual bool IsMonomorphic() V8_OVERRIDE {
2138 return receiver_types_.length() == 1;
2139 }
2146 bool IsUninitialized() { return is_uninitialized_; } 2140 bool IsUninitialized() { return is_uninitialized_; }
2147 bool IsPreMonomorphic() { return is_pre_monomorphic_; } 2141 bool IsPreMonomorphic() { return is_pre_monomorphic_; }
2148 bool HasNoTypeInformation() { 2142 bool HasNoTypeInformation() {
2149 return is_uninitialized_ || is_pre_monomorphic_; 2143 return is_uninitialized_ || is_pre_monomorphic_;
2150 } 2144 }
2151 virtual SmallMapList* GetReceiverTypes() V8_OVERRIDE { 2145 virtual SmallMapList* GetReceiverTypes() V8_OVERRIDE {
2152 return &receiver_types_; 2146 return &receiver_types_;
2153 } 2147 }
2154 virtual KeyedAccessStoreMode GetStoreMode() V8_OVERRIDE { 2148 virtual KeyedAccessStoreMode GetStoreMode() V8_OVERRIDE {
2155 return store_mode_; 2149 return store_mode_;
2156 } 2150 }
2157 void set_is_uninitialized(bool b) { is_uninitialized_ = b; } 2151 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; } 2152 void set_is_pre_monomorphic(bool b) { is_pre_monomorphic_ = b; }
2160 void set_store_mode(KeyedAccessStoreMode mode) { store_mode_ = mode; } 2153 void set_store_mode(KeyedAccessStoreMode mode) { store_mode_ = mode; }
2161 2154
2162 protected: 2155 protected:
2163 Assignment(Isolate* isolate, 2156 Assignment(Isolate* isolate,
2164 Token::Value op, 2157 Token::Value op,
2165 Expression* target, 2158 Expression* target,
2166 Expression* value, 2159 Expression* value,
2167 int pos); 2160 int pos);
2168 2161
2169 template<class Visitor> 2162 template<class Visitor>
2170 void Init(Isolate* isolate, AstNodeFactory<Visitor>* factory) { 2163 void Init(Isolate* isolate, AstNodeFactory<Visitor>* factory) {
2171 ASSERT(Token::IsAssignmentOp(op_)); 2164 ASSERT(Token::IsAssignmentOp(op_));
2172 if (is_compound()) { 2165 if (is_compound()) {
2173 binary_operation_ = factory->NewBinaryOperation( 2166 binary_operation_ = factory->NewBinaryOperation(
2174 binary_op(), target_, value_, position() + 1); 2167 binary_op(), target_, value_, position() + 1);
2175 } 2168 }
2176 } 2169 }
2177 2170
2178 private: 2171 private:
2179 Token::Value op_; 2172 Token::Value op_;
2180 Expression* target_; 2173 Expression* target_;
2181 Expression* value_; 2174 Expression* value_;
2182 BinaryOperation* binary_operation_; 2175 BinaryOperation* binary_operation_;
2183 const BailoutId assignment_id_; 2176 const BailoutId assignment_id_;
2184 2177
2185 bool is_monomorphic_ : 1;
2186 bool is_uninitialized_ : 1; 2178 bool is_uninitialized_ : 1;
2187 bool is_pre_monomorphic_ : 1; 2179 bool is_pre_monomorphic_ : 1;
2188 KeyedAccessStoreMode store_mode_ : 5; // Windows treats as signed, 2180 KeyedAccessStoreMode store_mode_ : 5; // Windows treats as signed,
2189 // must have extra bit. 2181 // must have extra bit.
2190 SmallMapList receiver_types_; 2182 SmallMapList receiver_types_;
2191 }; 2183 };
2192 2184
2193 2185
2194 class Yield V8_FINAL : public Expression { 2186 class Yield V8_FINAL : public Expression {
2195 public: 2187 public:
(...skipping 1105 matching lines...) Expand 10 before | Expand all | Expand 10 after
3301 private: 3293 private:
3302 Isolate* isolate_; 3294 Isolate* isolate_;
3303 Zone* zone_; 3295 Zone* zone_;
3304 Visitor visitor_; 3296 Visitor visitor_;
3305 }; 3297 };
3306 3298
3307 3299
3308 } } // namespace v8::internal 3300 } } // namespace v8::internal
3309 3301
3310 #endif // V8_AST_H_ 3302 #endif // V8_AST_H_
OLDNEW
« no previous file with comments | « src/assembler.cc ('k') | src/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698