| 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 } | 175 } |
| 176 static unsigned ReserveIdRange(int n) { | 176 static unsigned ReserveIdRange(int n) { |
| 177 Isolate* isolate = Isolate::Current(); | 177 Isolate* isolate = Isolate::Current(); |
| 178 unsigned tmp = isolate->ast_node_id(); | 178 unsigned tmp = isolate->ast_node_id(); |
| 179 isolate->set_ast_node_id(tmp + n); | 179 isolate->set_ast_node_id(tmp + n); |
| 180 return tmp; | 180 return tmp; |
| 181 } | 181 } |
| 182 | 182 |
| 183 private: | 183 private: |
| 184 unsigned id_; | 184 unsigned id_; |
| 185 |
| 186 friend class CaseClause; // Generates AST IDs. |
| 185 }; | 187 }; |
| 186 | 188 |
| 187 | 189 |
| 188 class Statement: public AstNode { | 190 class Statement: public AstNode { |
| 189 public: | 191 public: |
| 190 Statement() : statement_pos_(RelocInfo::kNoPosition) {} | 192 Statement() : statement_pos_(RelocInfo::kNoPosition) {} |
| 191 | 193 |
| 192 virtual Statement* AsStatement() { return this; } | 194 virtual Statement* AsStatement() { return this; } |
| 193 | 195 |
| 194 virtual Assignment* StatementAsSimpleAssignment() { return NULL; } | 196 virtual Assignment* StatementAsSimpleAssignment() { return NULL; } |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 Expression* label() const { | 692 Expression* label() const { |
| 691 CHECK(!is_default()); | 693 CHECK(!is_default()); |
| 692 return label_; | 694 return label_; |
| 693 } | 695 } |
| 694 JumpTarget* body_target() { return &body_target_; } | 696 JumpTarget* body_target() { return &body_target_; } |
| 695 ZoneList<Statement*>* statements() const { return statements_; } | 697 ZoneList<Statement*>* statements() const { return statements_; } |
| 696 | 698 |
| 697 int position() { return position_; } | 699 int position() { return position_; } |
| 698 void set_position(int pos) { position_ = pos; } | 700 void set_position(int pos) { position_ = pos; } |
| 699 | 701 |
| 702 int EntryId() { return entry_id_; } |
| 703 |
| 700 // Type feedback information. | 704 // Type feedback information. |
| 701 void RecordTypeFeedback(TypeFeedbackOracle* oracle); | 705 void RecordTypeFeedback(TypeFeedbackOracle* oracle); |
| 702 bool IsSmiCompare() { return compare_type_ == SMI_ONLY; } | 706 bool IsSmiCompare() { return compare_type_ == SMI_ONLY; } |
| 703 bool IsObjectCompare() { return compare_type_ == OBJECT_ONLY; } | 707 bool IsObjectCompare() { return compare_type_ == OBJECT_ONLY; } |
| 704 | 708 |
| 705 private: | 709 private: |
| 706 Expression* label_; | 710 Expression* label_; |
| 707 JumpTarget body_target_; | 711 JumpTarget body_target_; |
| 708 ZoneList<Statement*>* statements_; | 712 ZoneList<Statement*>* statements_; |
| 709 int position_; | 713 int position_; |
| 710 enum CompareTypeFeedback { NONE, SMI_ONLY, OBJECT_ONLY }; | 714 enum CompareTypeFeedback { NONE, SMI_ONLY, OBJECT_ONLY }; |
| 711 CompareTypeFeedback compare_type_; | 715 CompareTypeFeedback compare_type_; |
| 716 int entry_id_; |
| 712 }; | 717 }; |
| 713 | 718 |
| 714 | 719 |
| 715 class SwitchStatement: public BreakableStatement { | 720 class SwitchStatement: public BreakableStatement { |
| 716 public: | 721 public: |
| 717 explicit inline SwitchStatement(ZoneStringList* labels); | 722 explicit inline SwitchStatement(ZoneStringList* labels); |
| 718 | 723 |
| 719 DECLARE_NODE_TYPE(SwitchStatement) | 724 DECLARE_NODE_TYPE(SwitchStatement) |
| 720 | 725 |
| 721 void Initialize(Expression* tag, ZoneList<CaseClause*>* cases) { | 726 void Initialize(Expression* tag, ZoneList<CaseClause*>* cases) { |
| (...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1231 bool IsStringLength() const { return is_string_length_; } | 1236 bool IsStringLength() const { return is_string_length_; } |
| 1232 bool IsFunctionPrototype() const { return is_function_prototype_; } | 1237 bool IsFunctionPrototype() const { return is_function_prototype_; } |
| 1233 | 1238 |
| 1234 // Marks that this is actually an argument rewritten to a keyed property | 1239 // Marks that this is actually an argument rewritten to a keyed property |
| 1235 // accessing the argument through the arguments shadow object. | 1240 // accessing the argument through the arguments shadow object. |
| 1236 void set_is_arguments_access(bool is_arguments_access) { | 1241 void set_is_arguments_access(bool is_arguments_access) { |
| 1237 is_arguments_access_ = is_arguments_access; | 1242 is_arguments_access_ = is_arguments_access; |
| 1238 } | 1243 } |
| 1239 bool is_arguments_access() const { return is_arguments_access_; } | 1244 bool is_arguments_access() const { return is_arguments_access_; } |
| 1240 | 1245 |
| 1246 ExternalArrayType GetExternalArrayType() const { return array_type_; } |
| 1247 void SetExternalArrayType(ExternalArrayType array_type) { |
| 1248 array_type_ = array_type; |
| 1249 } |
| 1250 |
| 1241 // Type feedback information. | 1251 // Type feedback information. |
| 1242 void RecordTypeFeedback(TypeFeedbackOracle* oracle); | 1252 void RecordTypeFeedback(TypeFeedbackOracle* oracle); |
| 1243 virtual bool IsMonomorphic() { return is_monomorphic_; } | 1253 virtual bool IsMonomorphic() { return is_monomorphic_; } |
| 1244 virtual ZoneMapList* GetReceiverTypes() { return receiver_types_; } | 1254 virtual ZoneMapList* GetReceiverTypes() { return receiver_types_; } |
| 1245 virtual bool IsArrayLength() { return is_array_length_; } | 1255 virtual bool IsArrayLength() { return is_array_length_; } |
| 1246 virtual Handle<Map> GetMonomorphicReceiverType() { | 1256 virtual Handle<Map> GetMonomorphicReceiverType() { |
| 1247 return monomorphic_receiver_type_; | 1257 return monomorphic_receiver_type_; |
| 1248 } | 1258 } |
| 1249 | 1259 |
| 1250 private: | 1260 private: |
| 1251 Expression* obj_; | 1261 Expression* obj_; |
| 1252 Expression* key_; | 1262 Expression* key_; |
| 1253 int pos_; | 1263 int pos_; |
| 1254 Type type_; | 1264 Type type_; |
| 1255 | 1265 |
| 1256 ZoneMapList* receiver_types_; | 1266 ZoneMapList* receiver_types_; |
| 1257 bool is_monomorphic_ : 1; | 1267 bool is_monomorphic_ : 1; |
| 1258 bool is_array_length_ : 1; | 1268 bool is_array_length_ : 1; |
| 1259 bool is_string_length_ : 1; | 1269 bool is_string_length_ : 1; |
| 1260 bool is_function_prototype_ : 1; | 1270 bool is_function_prototype_ : 1; |
| 1261 bool is_arguments_access_ : 1; | 1271 bool is_arguments_access_ : 1; |
| 1262 Handle<Map> monomorphic_receiver_type_; | 1272 Handle<Map> monomorphic_receiver_type_; |
| 1273 ExternalArrayType array_type_; |
| 1263 }; | 1274 }; |
| 1264 | 1275 |
| 1265 | 1276 |
| 1266 class Call: public Expression { | 1277 class Call: public Expression { |
| 1267 public: | 1278 public: |
| 1268 Call(Expression* expression, ZoneList<Expression*>* arguments, int pos) | 1279 Call(Expression* expression, ZoneList<Expression*>* arguments, int pos) |
| 1269 : expression_(expression), | 1280 : expression_(expression), |
| 1270 arguments_(arguments), | 1281 arguments_(arguments), |
| 1271 pos_(pos), | 1282 pos_(pos), |
| 1272 is_monomorphic_(false), | 1283 is_monomorphic_(false), |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1639 void mark_block_start() { block_start_ = true; } | 1650 void mark_block_start() { block_start_ = true; } |
| 1640 void mark_block_end() { block_end_ = true; } | 1651 void mark_block_end() { block_end_ = true; } |
| 1641 | 1652 |
| 1642 // Type feedback information. | 1653 // Type feedback information. |
| 1643 void RecordTypeFeedback(TypeFeedbackOracle* oracle); | 1654 void RecordTypeFeedback(TypeFeedbackOracle* oracle); |
| 1644 virtual bool IsMonomorphic() { return is_monomorphic_; } | 1655 virtual bool IsMonomorphic() { return is_monomorphic_; } |
| 1645 virtual ZoneMapList* GetReceiverTypes() { return receiver_types_; } | 1656 virtual ZoneMapList* GetReceiverTypes() { return receiver_types_; } |
| 1646 virtual Handle<Map> GetMonomorphicReceiverType() { | 1657 virtual Handle<Map> GetMonomorphicReceiverType() { |
| 1647 return monomorphic_receiver_type_; | 1658 return monomorphic_receiver_type_; |
| 1648 } | 1659 } |
| 1660 ExternalArrayType GetExternalArrayType() const { return array_type_; } |
| 1661 void SetExternalArrayType(ExternalArrayType array_type) { |
| 1662 array_type_ = array_type; |
| 1663 } |
| 1649 | 1664 |
| 1650 // Bailout support. | 1665 // Bailout support. |
| 1651 int CompoundLoadId() const { return compound_load_id_; } | 1666 int CompoundLoadId() const { return compound_load_id_; } |
| 1652 int AssignmentId() const { return assignment_id_; } | 1667 int AssignmentId() const { return assignment_id_; } |
| 1653 | 1668 |
| 1654 private: | 1669 private: |
| 1655 Token::Value op_; | 1670 Token::Value op_; |
| 1656 Expression* target_; | 1671 Expression* target_; |
| 1657 Expression* value_; | 1672 Expression* value_; |
| 1658 int pos_; | 1673 int pos_; |
| 1659 BinaryOperation* binary_operation_; | 1674 BinaryOperation* binary_operation_; |
| 1660 int compound_load_id_; | 1675 int compound_load_id_; |
| 1661 int assignment_id_; | 1676 int assignment_id_; |
| 1662 | 1677 |
| 1663 bool block_start_; | 1678 bool block_start_; |
| 1664 bool block_end_; | 1679 bool block_end_; |
| 1665 | 1680 |
| 1666 bool is_monomorphic_; | 1681 bool is_monomorphic_; |
| 1667 ZoneMapList* receiver_types_; | 1682 ZoneMapList* receiver_types_; |
| 1668 Handle<Map> monomorphic_receiver_type_; | 1683 Handle<Map> monomorphic_receiver_type_; |
| 1684 ExternalArrayType array_type_; |
| 1669 }; | 1685 }; |
| 1670 | 1686 |
| 1671 | 1687 |
| 1672 class Throw: public Expression { | 1688 class Throw: public Expression { |
| 1673 public: | 1689 public: |
| 1674 Throw(Expression* exception, int pos) | 1690 Throw(Expression* exception, int pos) |
| 1675 : exception_(exception), pos_(pos) {} | 1691 : exception_(exception), pos_(pos) {} |
| 1676 | 1692 |
| 1677 DECLARE_NODE_TYPE(Throw) | 1693 DECLARE_NODE_TYPE(Throw) |
| 1678 | 1694 |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2192 #undef DEF_VISIT | 2208 #undef DEF_VISIT |
| 2193 | 2209 |
| 2194 private: | 2210 private: |
| 2195 bool stack_overflow_; | 2211 bool stack_overflow_; |
| 2196 }; | 2212 }; |
| 2197 | 2213 |
| 2198 | 2214 |
| 2199 } } // namespace v8::internal | 2215 } } // namespace v8::internal |
| 2200 | 2216 |
| 2201 #endif // V8_AST_H_ | 2217 #endif // V8_AST_H_ |
| OLD | NEW |