| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1204 // Synthetic properties are property lookups introduced by the system, | 1204 // Synthetic properties are property lookups introduced by the system, |
| 1205 // to objects that aren't visible to the user. Function calls to synthetic | 1205 // to objects that aren't visible to the user. Function calls to synthetic |
| 1206 // properties should use the global object as receiver, not the base object | 1206 // properties should use the global object as receiver, not the base object |
| 1207 // of the resolved Reference. | 1207 // of the resolved Reference. |
| 1208 enum Type { NORMAL, SYNTHETIC }; | 1208 enum Type { NORMAL, SYNTHETIC }; |
| 1209 Property(Expression* obj, Expression* key, int pos, Type type = NORMAL) | 1209 Property(Expression* obj, Expression* key, int pos, Type type = NORMAL) |
| 1210 : obj_(obj), | 1210 : obj_(obj), |
| 1211 key_(key), | 1211 key_(key), |
| 1212 pos_(pos), | 1212 pos_(pos), |
| 1213 type_(type), | 1213 type_(type), |
| 1214 receiver_types_(NULL), |
| 1214 is_monomorphic_(false), | 1215 is_monomorphic_(false), |
| 1215 receiver_types_(NULL), | |
| 1216 is_array_length_(false), | 1216 is_array_length_(false), |
| 1217 is_string_length_(false), |
| 1217 is_function_prototype_(false), | 1218 is_function_prototype_(false), |
| 1218 is_arguments_access_(false) { } | 1219 is_arguments_access_(false) { } |
| 1219 | 1220 |
| 1220 DECLARE_NODE_TYPE(Property) | 1221 DECLARE_NODE_TYPE(Property) |
| 1221 | 1222 |
| 1222 virtual bool IsValidLeftHandSide() { return true; } | 1223 virtual bool IsValidLeftHandSide() { return true; } |
| 1223 virtual bool IsInlineable() const; | 1224 virtual bool IsInlineable() const; |
| 1224 | 1225 |
| 1225 Expression* obj() const { return obj_; } | 1226 Expression* obj() const { return obj_; } |
| 1226 Expression* key() const { return key_; } | 1227 Expression* key() const { return key_; } |
| 1227 int position() const { return pos_; } | 1228 int position() const { return pos_; } |
| 1228 bool is_synthetic() const { return type_ == SYNTHETIC; } | 1229 bool is_synthetic() const { return type_ == SYNTHETIC; } |
| 1229 | 1230 |
| 1231 bool IsStringLength() const { return is_string_length_; } |
| 1230 bool IsFunctionPrototype() const { return is_function_prototype_; } | 1232 bool IsFunctionPrototype() const { return is_function_prototype_; } |
| 1231 | 1233 |
| 1232 // Marks that this is actually an argument rewritten to a keyed property | 1234 // Marks that this is actually an argument rewritten to a keyed property |
| 1233 // accessing the argument through the arguments shadow object. | 1235 // accessing the argument through the arguments shadow object. |
| 1234 void set_is_arguments_access(bool is_arguments_access) { | 1236 void set_is_arguments_access(bool is_arguments_access) { |
| 1235 is_arguments_access_ = is_arguments_access; | 1237 is_arguments_access_ = is_arguments_access; |
| 1236 } | 1238 } |
| 1237 bool is_arguments_access() const { return is_arguments_access_; } | 1239 bool is_arguments_access() const { return is_arguments_access_; } |
| 1238 | 1240 |
| 1239 // Type feedback information. | 1241 // Type feedback information. |
| 1240 void RecordTypeFeedback(TypeFeedbackOracle* oracle); | 1242 void RecordTypeFeedback(TypeFeedbackOracle* oracle); |
| 1241 virtual bool IsMonomorphic() { return is_monomorphic_; } | 1243 virtual bool IsMonomorphic() { return is_monomorphic_; } |
| 1242 virtual ZoneMapList* GetReceiverTypes() { return receiver_types_; } | 1244 virtual ZoneMapList* GetReceiverTypes() { return receiver_types_; } |
| 1243 virtual bool IsArrayLength() { return is_array_length_; } | 1245 virtual bool IsArrayLength() { return is_array_length_; } |
| 1244 virtual Handle<Map> GetMonomorphicReceiverType() { | 1246 virtual Handle<Map> GetMonomorphicReceiverType() { |
| 1245 return monomorphic_receiver_type_; | 1247 return monomorphic_receiver_type_; |
| 1246 } | 1248 } |
| 1247 | 1249 |
| 1248 private: | 1250 private: |
| 1249 Expression* obj_; | 1251 Expression* obj_; |
| 1250 Expression* key_; | 1252 Expression* key_; |
| 1251 int pos_; | 1253 int pos_; |
| 1252 Type type_; | 1254 Type type_; |
| 1253 | 1255 |
| 1254 bool is_monomorphic_; | |
| 1255 ZoneMapList* receiver_types_; | 1256 ZoneMapList* receiver_types_; |
| 1256 bool is_array_length_; | 1257 bool is_monomorphic_ : 1; |
| 1257 bool is_function_prototype_; | 1258 bool is_array_length_ : 1; |
| 1258 bool is_arguments_access_; | 1259 bool is_string_length_ : 1; |
| 1260 bool is_function_prototype_ : 1; |
| 1261 bool is_arguments_access_ : 1; |
| 1259 Handle<Map> monomorphic_receiver_type_; | 1262 Handle<Map> monomorphic_receiver_type_; |
| 1260 }; | 1263 }; |
| 1261 | 1264 |
| 1262 | 1265 |
| 1263 class Call: public Expression { | 1266 class Call: public Expression { |
| 1264 public: | 1267 public: |
| 1265 Call(Expression* expression, ZoneList<Expression*>* arguments, int pos) | 1268 Call(Expression* expression, ZoneList<Expression*>* arguments, int pos) |
| 1266 : expression_(expression), | 1269 : expression_(expression), |
| 1267 arguments_(arguments), | 1270 arguments_(arguments), |
| 1268 pos_(pos), | 1271 pos_(pos), |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1693 Scope* scope, | 1696 Scope* scope, |
| 1694 ZoneList<Statement*>* body, | 1697 ZoneList<Statement*>* body, |
| 1695 int materialized_literal_count, | 1698 int materialized_literal_count, |
| 1696 int expected_property_count, | 1699 int expected_property_count, |
| 1697 bool has_only_simple_this_property_assignments, | 1700 bool has_only_simple_this_property_assignments, |
| 1698 Handle<FixedArray> this_property_assignments, | 1701 Handle<FixedArray> this_property_assignments, |
| 1699 int num_parameters, | 1702 int num_parameters, |
| 1700 int start_position, | 1703 int start_position, |
| 1701 int end_position, | 1704 int end_position, |
| 1702 bool is_expression, | 1705 bool is_expression, |
| 1703 bool contains_loops) | 1706 bool contains_loops, |
| 1707 bool strict_mode) |
| 1704 : name_(name), | 1708 : name_(name), |
| 1705 scope_(scope), | 1709 scope_(scope), |
| 1706 body_(body), | 1710 body_(body), |
| 1707 materialized_literal_count_(materialized_literal_count), | 1711 materialized_literal_count_(materialized_literal_count), |
| 1708 expected_property_count_(expected_property_count), | 1712 expected_property_count_(expected_property_count), |
| 1709 has_only_simple_this_property_assignments_( | 1713 has_only_simple_this_property_assignments_( |
| 1710 has_only_simple_this_property_assignments), | 1714 has_only_simple_this_property_assignments), |
| 1711 this_property_assignments_(this_property_assignments), | 1715 this_property_assignments_(this_property_assignments), |
| 1712 num_parameters_(num_parameters), | 1716 num_parameters_(num_parameters), |
| 1713 start_position_(start_position), | 1717 start_position_(start_position), |
| 1714 end_position_(end_position), | 1718 end_position_(end_position), |
| 1715 is_expression_(is_expression), | 1719 is_expression_(is_expression), |
| 1716 contains_loops_(contains_loops), | 1720 contains_loops_(contains_loops), |
| 1721 strict_mode_(strict_mode), |
| 1717 function_token_position_(RelocInfo::kNoPosition), | 1722 function_token_position_(RelocInfo::kNoPosition), |
| 1718 inferred_name_(HEAP->empty_string()), | 1723 inferred_name_(HEAP->empty_string()), |
| 1719 try_full_codegen_(false), | 1724 try_full_codegen_(false), |
| 1720 pretenure_(false) { } | 1725 pretenure_(false) { } |
| 1721 | 1726 |
| 1722 DECLARE_NODE_TYPE(FunctionLiteral) | 1727 DECLARE_NODE_TYPE(FunctionLiteral) |
| 1723 | 1728 |
| 1724 Handle<String> name() const { return name_; } | 1729 Handle<String> name() const { return name_; } |
| 1725 Scope* scope() const { return scope_; } | 1730 Scope* scope() const { return scope_; } |
| 1726 ZoneList<Statement*>* body() const { return body_; } | 1731 ZoneList<Statement*>* body() const { return body_; } |
| 1727 void set_function_token_position(int pos) { function_token_position_ = pos; } | 1732 void set_function_token_position(int pos) { function_token_position_ = pos; } |
| 1728 int function_token_position() const { return function_token_position_; } | 1733 int function_token_position() const { return function_token_position_; } |
| 1729 int start_position() const { return start_position_; } | 1734 int start_position() const { return start_position_; } |
| 1730 int end_position() const { return end_position_; } | 1735 int end_position() const { return end_position_; } |
| 1731 bool is_expression() const { return is_expression_; } | 1736 bool is_expression() const { return is_expression_; } |
| 1732 bool contains_loops() const { return contains_loops_; } | 1737 bool contains_loops() const { return contains_loops_; } |
| 1738 bool strict_mode() const { return strict_mode_; } |
| 1733 | 1739 |
| 1734 int materialized_literal_count() { return materialized_literal_count_; } | 1740 int materialized_literal_count() { return materialized_literal_count_; } |
| 1735 int expected_property_count() { return expected_property_count_; } | 1741 int expected_property_count() { return expected_property_count_; } |
| 1736 bool has_only_simple_this_property_assignments() { | 1742 bool has_only_simple_this_property_assignments() { |
| 1737 return has_only_simple_this_property_assignments_; | 1743 return has_only_simple_this_property_assignments_; |
| 1738 } | 1744 } |
| 1739 Handle<FixedArray> this_property_assignments() { | 1745 Handle<FixedArray> this_property_assignments() { |
| 1740 return this_property_assignments_; | 1746 return this_property_assignments_; |
| 1741 } | 1747 } |
| 1742 int num_parameters() { return num_parameters_; } | 1748 int num_parameters() { return num_parameters_; } |
| 1743 | 1749 |
| 1744 bool AllowsLazyCompilation(); | 1750 bool AllowsLazyCompilation(); |
| 1745 bool AllowOptimize(); | |
| 1746 | 1751 |
| 1747 Handle<String> debug_name() const { | 1752 Handle<String> debug_name() const { |
| 1748 if (name_->length() > 0) return name_; | 1753 if (name_->length() > 0) return name_; |
| 1749 return inferred_name(); | 1754 return inferred_name(); |
| 1750 } | 1755 } |
| 1751 | 1756 |
| 1752 Handle<String> inferred_name() const { return inferred_name_; } | 1757 Handle<String> inferred_name() const { return inferred_name_; } |
| 1753 void set_inferred_name(Handle<String> inferred_name) { | 1758 void set_inferred_name(Handle<String> inferred_name) { |
| 1754 inferred_name_ = inferred_name; | 1759 inferred_name_ = inferred_name; |
| 1755 } | 1760 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1766 ZoneList<Statement*>* body_; | 1771 ZoneList<Statement*>* body_; |
| 1767 int materialized_literal_count_; | 1772 int materialized_literal_count_; |
| 1768 int expected_property_count_; | 1773 int expected_property_count_; |
| 1769 bool has_only_simple_this_property_assignments_; | 1774 bool has_only_simple_this_property_assignments_; |
| 1770 Handle<FixedArray> this_property_assignments_; | 1775 Handle<FixedArray> this_property_assignments_; |
| 1771 int num_parameters_; | 1776 int num_parameters_; |
| 1772 int start_position_; | 1777 int start_position_; |
| 1773 int end_position_; | 1778 int end_position_; |
| 1774 bool is_expression_; | 1779 bool is_expression_; |
| 1775 bool contains_loops_; | 1780 bool contains_loops_; |
| 1781 bool strict_mode_; |
| 1776 int function_token_position_; | 1782 int function_token_position_; |
| 1777 Handle<String> inferred_name_; | 1783 Handle<String> inferred_name_; |
| 1778 bool try_full_codegen_; | 1784 bool try_full_codegen_; |
| 1779 bool pretenure_; | 1785 bool pretenure_; |
| 1780 }; | 1786 }; |
| 1781 | 1787 |
| 1782 | 1788 |
| 1783 class SharedFunctionInfoLiteral: public Expression { | 1789 class SharedFunctionInfoLiteral: public Expression { |
| 1784 public: | 1790 public: |
| 1785 explicit SharedFunctionInfoLiteral( | 1791 explicit SharedFunctionInfoLiteral( |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2193 #undef DEF_VISIT | 2199 #undef DEF_VISIT |
| 2194 | 2200 |
| 2195 private: | 2201 private: |
| 2196 bool stack_overflow_; | 2202 bool stack_overflow_; |
| 2197 }; | 2203 }; |
| 2198 | 2204 |
| 2199 | 2205 |
| 2200 } } // namespace v8::internal | 2206 } } // namespace v8::internal |
| 2201 | 2207 |
| 2202 #endif // V8_AST_H_ | 2208 #endif // V8_AST_H_ |
| OLD | NEW |