| 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 virtual Expression* AsExpression() { return NULL; } | 161 virtual Expression* AsExpression() { return NULL; } |
| 162 virtual TargetCollector* AsTargetCollector() { return NULL; } | 162 virtual TargetCollector* AsTargetCollector() { return NULL; } |
| 163 virtual BreakableStatement* AsBreakableStatement() { return NULL; } | 163 virtual BreakableStatement* AsBreakableStatement() { return NULL; } |
| 164 virtual IterationStatement* AsIterationStatement() { return NULL; } | 164 virtual IterationStatement* AsIterationStatement() { return NULL; } |
| 165 virtual MaterializedLiteral* AsMaterializedLiteral() { return NULL; } | 165 virtual MaterializedLiteral* AsMaterializedLiteral() { return NULL; } |
| 166 | 166 |
| 167 // True if the node is simple enough for us to inline calls containing it. | 167 // True if the node is simple enough for us to inline calls containing it. |
| 168 virtual bool IsInlineable() const = 0; | 168 virtual bool IsInlineable() const = 0; |
| 169 | 169 |
| 170 static int Count() { return Isolate::Current()->ast_node_count(); } | 170 static int Count() { return Isolate::Current()->ast_node_count(); } |
| 171 static int HeavyCount() { return Isolate::Current()->heavy_ast_node_count(); } |
| 171 static void ResetIds() { Isolate::Current()->set_ast_node_id(0); } | 172 static void ResetIds() { Isolate::Current()->set_ast_node_id(0); } |
| 172 | 173 |
| 173 protected: | 174 protected: |
| 174 static unsigned GetNextId(Isolate* isolate) { | 175 static unsigned GetNextId(Isolate* isolate) { |
| 175 return ReserveIdRange(isolate, 1); | 176 return ReserveIdRange(isolate, 1); |
| 176 } | 177 } |
| 177 | 178 |
| 178 static unsigned ReserveIdRange(Isolate* isolate, int n) { | 179 static unsigned ReserveIdRange(Isolate* isolate, int n) { |
| 179 unsigned tmp = isolate->ast_node_id(); | 180 unsigned tmp = isolate->ast_node_id(); |
| 180 isolate->set_ast_node_id(tmp + n); | 181 isolate->set_ast_node_id(tmp + n); |
| 181 return tmp; | 182 return tmp; |
| 182 } | 183 } |
| 183 | 184 |
| 185 void IncrementHeavyAstNodeCounter(Isolate* isolate) { |
| 186 unsigned tmp = isolate->heavy_ast_node_count(); |
| 187 isolate->set_heavy_ast_node_count(tmp + 1); |
| 188 } |
| 189 |
| 184 private: | 190 private: |
| 185 // Hidden to prevent accidental usage. It would have to load the | 191 // Hidden to prevent accidental usage. It would have to load the |
| 186 // current zone from the TLS. | 192 // current zone from the TLS. |
| 187 void* operator new(size_t size); | 193 void* operator new(size_t size); |
| 188 | 194 |
| 189 friend class CaseClause; // Generates AST IDs. | 195 friend class CaseClause; // Generates AST IDs. |
| 190 }; | 196 }; |
| 191 | 197 |
| 192 | 198 |
| 193 class Statement: public AstNode { | 199 class Statement: public AstNode { |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 virtual int StackCheckId() const = 0; | 440 virtual int StackCheckId() const = 0; |
| 435 | 441 |
| 436 // Code generation | 442 // Code generation |
| 437 Label* continue_target() { return &continue_target_; } | 443 Label* continue_target() { return &continue_target_; } |
| 438 | 444 |
| 439 protected: | 445 protected: |
| 440 IterationStatement(Isolate* isolate, ZoneStringList* labels) | 446 IterationStatement(Isolate* isolate, ZoneStringList* labels) |
| 441 : BreakableStatement(isolate, labels, TARGET_FOR_ANONYMOUS), | 447 : BreakableStatement(isolate, labels, TARGET_FOR_ANONYMOUS), |
| 442 body_(NULL), | 448 body_(NULL), |
| 443 osr_entry_id_(GetNextId(isolate)) { | 449 osr_entry_id_(GetNextId(isolate)) { |
| 450 IncrementHeavyAstNodeCounter(isolate); |
| 444 } | 451 } |
| 445 | 452 |
| 446 void Initialize(Statement* body) { | 453 void Initialize(Statement* body) { |
| 447 body_ = body; | 454 body_ = body; |
| 448 } | 455 } |
| 449 | 456 |
| 450 private: | 457 private: |
| 451 Statement* body_; | 458 Statement* body_; |
| 452 Label continue_target_; | 459 Label continue_target_; |
| 453 int osr_entry_id_; | 460 int osr_entry_id_; |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 679 Expression* expression() const { return expression_; } | 686 Expression* expression() const { return expression_; } |
| 680 virtual bool IsInlineable() const; | 687 virtual bool IsInlineable() const; |
| 681 | 688 |
| 682 private: | 689 private: |
| 683 Expression* expression_; | 690 Expression* expression_; |
| 684 }; | 691 }; |
| 685 | 692 |
| 686 | 693 |
| 687 class WithStatement: public Statement { | 694 class WithStatement: public Statement { |
| 688 public: | 695 public: |
| 689 WithStatement(Expression* expression, Statement* statement) | 696 WithStatement(Isolate* isolate, Expression* expression, Statement* statement) |
| 690 : expression_(expression), statement_(statement) { } | 697 : expression_(expression), statement_(statement) { |
| 698 IncrementHeavyAstNodeCounter(isolate); |
| 699 } |
| 691 | 700 |
| 692 DECLARE_NODE_TYPE(WithStatement) | 701 DECLARE_NODE_TYPE(WithStatement) |
| 693 | 702 |
| 694 Expression* expression() const { return expression_; } | 703 Expression* expression() const { return expression_; } |
| 695 Statement* statement() const { return statement_; } | 704 Statement* statement() const { return statement_; } |
| 696 | 705 |
| 697 virtual bool IsInlineable() const; | 706 virtual bool IsInlineable() const; |
| 698 | 707 |
| 699 private: | 708 private: |
| 700 Expression* expression_; | 709 Expression* expression_; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 747 int entry_id_; | 756 int entry_id_; |
| 748 }; | 757 }; |
| 749 | 758 |
| 750 | 759 |
| 751 class SwitchStatement: public BreakableStatement { | 760 class SwitchStatement: public BreakableStatement { |
| 752 public: | 761 public: |
| 753 SwitchStatement(Isolate* isolate, ZoneStringList* labels) | 762 SwitchStatement(Isolate* isolate, ZoneStringList* labels) |
| 754 : BreakableStatement(isolate, labels, TARGET_FOR_ANONYMOUS), | 763 : BreakableStatement(isolate, labels, TARGET_FOR_ANONYMOUS), |
| 755 tag_(NULL), | 764 tag_(NULL), |
| 756 cases_(NULL) { | 765 cases_(NULL) { |
| 766 IncrementHeavyAstNodeCounter(isolate); |
| 757 } | 767 } |
| 758 | 768 |
| 759 | 769 |
| 760 DECLARE_NODE_TYPE(SwitchStatement) | 770 DECLARE_NODE_TYPE(SwitchStatement) |
| 761 | 771 |
| 762 void Initialize(Expression* tag, ZoneList<CaseClause*>* cases) { | 772 void Initialize(Expression* tag, ZoneList<CaseClause*>* cases) { |
| 763 tag_ = tag; | 773 tag_ = tag; |
| 764 cases_ = cases; | 774 cases_ = cases; |
| 765 } | 775 } |
| 766 | 776 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 783 public: | 793 public: |
| 784 IfStatement(Isolate* isolate, | 794 IfStatement(Isolate* isolate, |
| 785 Expression* condition, | 795 Expression* condition, |
| 786 Statement* then_statement, | 796 Statement* then_statement, |
| 787 Statement* else_statement) | 797 Statement* else_statement) |
| 788 : condition_(condition), | 798 : condition_(condition), |
| 789 then_statement_(then_statement), | 799 then_statement_(then_statement), |
| 790 else_statement_(else_statement), | 800 else_statement_(else_statement), |
| 791 if_id_(GetNextId(isolate)), | 801 if_id_(GetNextId(isolate)), |
| 792 then_id_(GetNextId(isolate)), | 802 then_id_(GetNextId(isolate)), |
| 793 else_id_(GetNextId(isolate)) { | 803 else_id_(GetNextId(isolate)) { } |
| 794 } | |
| 795 | 804 |
| 796 DECLARE_NODE_TYPE(IfStatement) | 805 DECLARE_NODE_TYPE(IfStatement) |
| 797 | 806 |
| 798 virtual bool IsInlineable() const; | 807 virtual bool IsInlineable() const; |
| 799 | 808 |
| 800 bool HasThenStatement() const { return !then_statement()->IsEmpty(); } | 809 bool HasThenStatement() const { return !then_statement()->IsEmpty(); } |
| 801 bool HasElseStatement() const { return !else_statement()->IsEmpty(); } | 810 bool HasElseStatement() const { return !else_statement()->IsEmpty(); } |
| 802 | 811 |
| 803 Expression* condition() const { return condition_; } | 812 Expression* condition() const { return condition_; } |
| 804 Statement* then_statement() const { return then_statement_; } | 813 Statement* then_statement() const { return then_statement_; } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 839 private: | 848 private: |
| 840 ZoneList<Label*> targets_; | 849 ZoneList<Label*> targets_; |
| 841 }; | 850 }; |
| 842 | 851 |
| 843 | 852 |
| 844 class TryStatement: public Statement { | 853 class TryStatement: public Statement { |
| 845 public: | 854 public: |
| 846 explicit TryStatement(int index, Block* try_block) | 855 explicit TryStatement(int index, Block* try_block) |
| 847 : index_(index), | 856 : index_(index), |
| 848 try_block_(try_block), | 857 try_block_(try_block), |
| 849 escaping_targets_(NULL) { | 858 escaping_targets_(NULL) { } |
| 850 } | |
| 851 | 859 |
| 852 void set_escaping_targets(ZoneList<Label*>* targets) { | 860 void set_escaping_targets(ZoneList<Label*>* targets) { |
| 853 escaping_targets_ = targets; | 861 escaping_targets_ = targets; |
| 854 } | 862 } |
| 855 | 863 |
| 856 int index() const { return index_; } | 864 int index() const { return index_; } |
| 857 Block* try_block() const { return try_block_; } | 865 Block* try_block() const { return try_block_; } |
| 858 ZoneList<Label*>* escaping_targets() const { return escaping_targets_; } | 866 ZoneList<Label*>* escaping_targets() const { return escaping_targets_; } |
| 859 virtual bool IsInlineable() const; | 867 virtual bool IsInlineable() const; |
| 860 | 868 |
| 861 private: | 869 private: |
| 862 // Unique (per-function) index of this handler. This is not an AST ID. | 870 // Unique (per-function) index of this handler. This is not an AST ID. |
| 863 int index_; | 871 int index_; |
| 864 | 872 |
| 865 Block* try_block_; | 873 Block* try_block_; |
| 866 ZoneList<Label*>* escaping_targets_; | 874 ZoneList<Label*>* escaping_targets_; |
| 867 }; | 875 }; |
| 868 | 876 |
| 869 | 877 |
| 870 class TryCatchStatement: public TryStatement { | 878 class TryCatchStatement: public TryStatement { |
| 871 public: | 879 public: |
| 872 TryCatchStatement(int index, | 880 TryCatchStatement(Isolate* isolate, |
| 881 int index, |
| 873 Block* try_block, | 882 Block* try_block, |
| 874 Scope* scope, | 883 Scope* scope, |
| 875 Variable* variable, | 884 Variable* variable, |
| 876 Block* catch_block) | 885 Block* catch_block) |
| 877 : TryStatement(index, try_block), | 886 : TryStatement(index, try_block), |
| 878 scope_(scope), | 887 scope_(scope), |
| 879 variable_(variable), | 888 variable_(variable), |
| 880 catch_block_(catch_block) { | 889 catch_block_(catch_block) { |
| 890 IncrementHeavyAstNodeCounter(isolate); |
| 881 } | 891 } |
| 882 | 892 |
| 883 DECLARE_NODE_TYPE(TryCatchStatement) | 893 DECLARE_NODE_TYPE(TryCatchStatement) |
| 884 | 894 |
| 885 Scope* scope() { return scope_; } | 895 Scope* scope() { return scope_; } |
| 886 Variable* variable() { return variable_; } | 896 Variable* variable() { return variable_; } |
| 887 Block* catch_block() const { return catch_block_; } | 897 Block* catch_block() const { return catch_block_; } |
| 888 virtual bool IsInlineable() const; | 898 virtual bool IsInlineable() const; |
| 889 | 899 |
| 890 private: | 900 private: |
| 891 Scope* scope_; | 901 Scope* scope_; |
| 892 Variable* variable_; | 902 Variable* variable_; |
| 893 Block* catch_block_; | 903 Block* catch_block_; |
| 894 }; | 904 }; |
| 895 | 905 |
| 896 | 906 |
| 897 class TryFinallyStatement: public TryStatement { | 907 class TryFinallyStatement: public TryStatement { |
| 898 public: | 908 public: |
| 899 TryFinallyStatement(int index, Block* try_block, Block* finally_block) | 909 TryFinallyStatement(Isolate* isolate, |
| 910 int index, |
| 911 Block* try_block, |
| 912 Block* finally_block) |
| 900 : TryStatement(index, try_block), | 913 : TryStatement(index, try_block), |
| 901 finally_block_(finally_block) { } | 914 finally_block_(finally_block) { |
| 915 IncrementHeavyAstNodeCounter(isolate); |
| 916 } |
| 902 | 917 |
| 903 DECLARE_NODE_TYPE(TryFinallyStatement) | 918 DECLARE_NODE_TYPE(TryFinallyStatement) |
| 904 | 919 |
| 905 Block* finally_block() const { return finally_block_; } | 920 Block* finally_block() const { return finally_block_; } |
| 906 virtual bool IsInlineable() const; | 921 virtual bool IsInlineable() const; |
| 907 | 922 |
| 908 private: | 923 private: |
| 909 Block* finally_block_; | 924 Block* finally_block_; |
| 910 }; | 925 }; |
| 911 | 926 |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1235 Expression* expression, | 1250 Expression* expression, |
| 1236 ZoneList<Expression*>* arguments, | 1251 ZoneList<Expression*>* arguments, |
| 1237 int pos) | 1252 int pos) |
| 1238 : Expression(isolate), | 1253 : Expression(isolate), |
| 1239 expression_(expression), | 1254 expression_(expression), |
| 1240 arguments_(arguments), | 1255 arguments_(arguments), |
| 1241 pos_(pos), | 1256 pos_(pos), |
| 1242 is_monomorphic_(false), | 1257 is_monomorphic_(false), |
| 1243 check_type_(RECEIVER_MAP_CHECK), | 1258 check_type_(RECEIVER_MAP_CHECK), |
| 1244 return_id_(GetNextId(isolate)) { | 1259 return_id_(GetNextId(isolate)) { |
| 1260 IncrementHeavyAstNodeCounter(isolate); |
| 1245 } | 1261 } |
| 1246 | 1262 |
| 1247 DECLARE_NODE_TYPE(Call) | 1263 DECLARE_NODE_TYPE(Call) |
| 1248 | 1264 |
| 1249 virtual bool IsInlineable() const; | 1265 virtual bool IsInlineable() const; |
| 1250 | 1266 |
| 1251 Expression* expression() const { return expression_; } | 1267 Expression* expression() const { return expression_; } |
| 1252 ZoneList<Expression*>* arguments() const { return arguments_; } | 1268 ZoneList<Expression*>* arguments() const { return arguments_; } |
| 1253 virtual int position() const { return pos_; } | 1269 virtual int position() const { return pos_; } |
| 1254 | 1270 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1290 | 1306 |
| 1291 class CallNew: public Expression { | 1307 class CallNew: public Expression { |
| 1292 public: | 1308 public: |
| 1293 CallNew(Isolate* isolate, | 1309 CallNew(Isolate* isolate, |
| 1294 Expression* expression, | 1310 Expression* expression, |
| 1295 ZoneList<Expression*>* arguments, | 1311 ZoneList<Expression*>* arguments, |
| 1296 int pos) | 1312 int pos) |
| 1297 : Expression(isolate), | 1313 : Expression(isolate), |
| 1298 expression_(expression), | 1314 expression_(expression), |
| 1299 arguments_(arguments), | 1315 arguments_(arguments), |
| 1300 pos_(pos) { } | 1316 pos_(pos) { |
| 1317 IncrementHeavyAstNodeCounter(isolate); |
| 1318 } |
| 1301 | 1319 |
| 1302 DECLARE_NODE_TYPE(CallNew) | 1320 DECLARE_NODE_TYPE(CallNew) |
| 1303 | 1321 |
| 1304 virtual bool IsInlineable() const; | 1322 virtual bool IsInlineable() const; |
| 1305 | 1323 |
| 1306 Expression* expression() const { return expression_; } | 1324 Expression* expression() const { return expression_; } |
| 1307 ZoneList<Expression*>* arguments() const { return arguments_; } | 1325 ZoneList<Expression*>* arguments() const { return arguments_; } |
| 1308 virtual int position() const { return pos_; } | 1326 virtual int position() const { return pos_; } |
| 1309 | 1327 |
| 1310 private: | 1328 private: |
| 1311 Expression* expression_; | 1329 Expression* expression_; |
| 1312 ZoneList<Expression*>* arguments_; | 1330 ZoneList<Expression*>* arguments_; |
| 1313 int pos_; | 1331 int pos_; |
| 1314 }; | 1332 }; |
| 1315 | 1333 |
| 1316 | 1334 |
| 1317 // The CallRuntime class does not represent any official JavaScript | 1335 // The CallRuntime class does not represent any official JavaScript |
| 1318 // language construct. Instead it is used to call a C or JS function | 1336 // language construct. Instead it is used to call a C or JS function |
| 1319 // with a set of arguments. This is used from the builtins that are | 1337 // with a set of arguments. This is used from the builtins that are |
| 1320 // implemented in JavaScript (see "v8natives.js"). | 1338 // implemented in JavaScript (see "v8natives.js"). |
| 1321 class CallRuntime: public Expression { | 1339 class CallRuntime: public Expression { |
| 1322 public: | 1340 public: |
| 1323 CallRuntime(Isolate* isolate, | 1341 CallRuntime(Isolate* isolate, |
| 1324 Handle<String> name, | 1342 Handle<String> name, |
| 1325 const Runtime::Function* function, | 1343 const Runtime::Function* function, |
| 1326 ZoneList<Expression*>* arguments) | 1344 ZoneList<Expression*>* arguments) |
| 1327 : Expression(isolate), | 1345 : Expression(isolate), |
| 1328 name_(name), | 1346 name_(name), |
| 1329 function_(function), | 1347 function_(function), |
| 1330 arguments_(arguments) { } | 1348 arguments_(arguments) { |
| 1349 IncrementHeavyAstNodeCounter(isolate); |
| 1350 } |
| 1331 | 1351 |
| 1332 DECLARE_NODE_TYPE(CallRuntime) | 1352 DECLARE_NODE_TYPE(CallRuntime) |
| 1333 | 1353 |
| 1334 virtual bool IsInlineable() const; | 1354 virtual bool IsInlineable() const; |
| 1335 | 1355 |
| 1336 Handle<String> name() const { return name_; } | 1356 Handle<String> name() const { return name_; } |
| 1337 const Runtime::Function* function() const { return function_; } | 1357 const Runtime::Function* function() const { return function_; } |
| 1338 ZoneList<Expression*>* arguments() const { return arguments_; } | 1358 ZoneList<Expression*>* arguments() const { return arguments_; } |
| 1339 bool is_jsruntime() const { return function_ == NULL; } | 1359 bool is_jsruntime() const { return function_ == NULL; } |
| 1340 | 1360 |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1658 Handle<String> name, | 1678 Handle<String> name, |
| 1659 Scope* scope, | 1679 Scope* scope, |
| 1660 ZoneList<Statement*>* body, | 1680 ZoneList<Statement*>* body, |
| 1661 int materialized_literal_count, | 1681 int materialized_literal_count, |
| 1662 int expected_property_count, | 1682 int expected_property_count, |
| 1663 int handler_count, | 1683 int handler_count, |
| 1664 bool has_only_simple_this_property_assignments, | 1684 bool has_only_simple_this_property_assignments, |
| 1665 Handle<FixedArray> this_property_assignments, | 1685 Handle<FixedArray> this_property_assignments, |
| 1666 int parameter_count, | 1686 int parameter_count, |
| 1667 Type type, | 1687 Type type, |
| 1668 bool has_duplicate_parameters) | 1688 bool has_duplicate_parameters, |
| 1689 int ast_node_count, |
| 1690 bool is_primitive) |
| 1669 : Expression(isolate), | 1691 : Expression(isolate), |
| 1670 name_(name), | 1692 name_(name), |
| 1671 scope_(scope), | 1693 scope_(scope), |
| 1672 body_(body), | 1694 body_(body), |
| 1673 this_property_assignments_(this_property_assignments), | 1695 this_property_assignments_(this_property_assignments), |
| 1674 inferred_name_(isolate->factory()->empty_string()), | 1696 inferred_name_(isolate->factory()->empty_string()), |
| 1675 materialized_literal_count_(materialized_literal_count), | 1697 materialized_literal_count_(materialized_literal_count), |
| 1676 expected_property_count_(expected_property_count), | 1698 expected_property_count_(expected_property_count), |
| 1677 handler_count_(handler_count), | 1699 handler_count_(handler_count), |
| 1678 parameter_count_(parameter_count), | 1700 parameter_count_(parameter_count), |
| 1679 function_token_position_(RelocInfo::kNoPosition) { | 1701 function_token_position_(RelocInfo::kNoPosition), |
| 1702 ast_node_count_(ast_node_count), |
| 1703 is_primitive_(is_primitive) { |
| 1680 bitfield_ = | 1704 bitfield_ = |
| 1681 HasOnlySimpleThisPropertyAssignments::encode( | 1705 HasOnlySimpleThisPropertyAssignments::encode( |
| 1682 has_only_simple_this_property_assignments) | | 1706 has_only_simple_this_property_assignments) | |
| 1683 IsExpression::encode(type != DECLARATION) | | 1707 IsExpression::encode(type != DECLARATION) | |
| 1684 IsAnonymous::encode(type == ANONYMOUS_EXPRESSION) | | 1708 IsAnonymous::encode(type == ANONYMOUS_EXPRESSION) | |
| 1685 Pretenure::encode(false) | | 1709 Pretenure::encode(false) | |
| 1686 HasDuplicateParameters::encode(has_duplicate_parameters); | 1710 HasDuplicateParameters::encode(has_duplicate_parameters); |
| 1711 IncrementHeavyAstNodeCounter(isolate); |
| 1687 } | 1712 } |
| 1688 | 1713 |
| 1689 DECLARE_NODE_TYPE(FunctionLiteral) | 1714 DECLARE_NODE_TYPE(FunctionLiteral) |
| 1690 | 1715 |
| 1691 Handle<String> name() const { return name_; } | 1716 Handle<String> name() const { return name_; } |
| 1692 Scope* scope() const { return scope_; } | 1717 Scope* scope() const { return scope_; } |
| 1693 ZoneList<Statement*>* body() const { return body_; } | 1718 ZoneList<Statement*>* body() const { return body_; } |
| 1694 void set_function_token_position(int pos) { function_token_position_ = pos; } | 1719 void set_function_token_position(int pos) { function_token_position_ = pos; } |
| 1695 int function_token_position() const { return function_token_position_; } | 1720 int function_token_position() const { return function_token_position_; } |
| 1696 int start_position() const; | 1721 int start_position() const; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1724 } | 1749 } |
| 1725 | 1750 |
| 1726 bool pretenure() { return Pretenure::decode(bitfield_); } | 1751 bool pretenure() { return Pretenure::decode(bitfield_); } |
| 1727 void set_pretenure() { bitfield_ |= Pretenure::encode(true); } | 1752 void set_pretenure() { bitfield_ |= Pretenure::encode(true); } |
| 1728 virtual bool IsInlineable() const; | 1753 virtual bool IsInlineable() const; |
| 1729 | 1754 |
| 1730 bool has_duplicate_parameters() { | 1755 bool has_duplicate_parameters() { |
| 1731 return HasDuplicateParameters::decode(bitfield_); | 1756 return HasDuplicateParameters::decode(bitfield_); |
| 1732 } | 1757 } |
| 1733 | 1758 |
| 1759 int ast_node_count() { |
| 1760 return ast_node_count_; |
| 1761 } |
| 1762 |
| 1763 bool is_primitive() { |
| 1764 return is_primitive_; |
| 1765 } |
| 1766 |
| 1734 private: | 1767 private: |
| 1735 Handle<String> name_; | 1768 Handle<String> name_; |
| 1736 Scope* scope_; | 1769 Scope* scope_; |
| 1737 ZoneList<Statement*>* body_; | 1770 ZoneList<Statement*>* body_; |
| 1738 Handle<FixedArray> this_property_assignments_; | 1771 Handle<FixedArray> this_property_assignments_; |
| 1739 Handle<String> inferred_name_; | 1772 Handle<String> inferred_name_; |
| 1740 | 1773 |
| 1741 int materialized_literal_count_; | 1774 int materialized_literal_count_; |
| 1742 int expected_property_count_; | 1775 int expected_property_count_; |
| 1743 int handler_count_; | 1776 int handler_count_; |
| 1744 int parameter_count_; | 1777 int parameter_count_; |
| 1745 int function_token_position_; | 1778 int function_token_position_; |
| 1746 | 1779 |
| 1780 int ast_node_count_; |
| 1781 bool is_primitive_; |
| 1782 |
| 1747 unsigned bitfield_; | 1783 unsigned bitfield_; |
| 1748 class HasOnlySimpleThisPropertyAssignments: public BitField<bool, 0, 1> {}; | 1784 class HasOnlySimpleThisPropertyAssignments: public BitField<bool, 0, 1> {}; |
| 1749 class IsExpression: public BitField<bool, 1, 1> {}; | 1785 class IsExpression: public BitField<bool, 1, 1> {}; |
| 1750 class IsAnonymous: public BitField<bool, 2, 1> {}; | 1786 class IsAnonymous: public BitField<bool, 2, 1> {}; |
| 1751 class Pretenure: public BitField<bool, 3, 1> {}; | 1787 class Pretenure: public BitField<bool, 3, 1> {}; |
| 1752 class HasDuplicateParameters: public BitField<bool, 4, 1> {}; | 1788 class HasDuplicateParameters: public BitField<bool, 4, 1> {}; |
| 1753 }; | 1789 }; |
| 1754 | 1790 |
| 1755 | 1791 |
| 1756 class SharedFunctionInfoLiteral: public Expression { | 1792 class SharedFunctionInfoLiteral: public Expression { |
| 1757 public: | 1793 public: |
| 1758 SharedFunctionInfoLiteral( | 1794 SharedFunctionInfoLiteral( |
| 1759 Isolate* isolate, | 1795 Isolate* isolate, |
| 1760 Handle<SharedFunctionInfo> shared_function_info) | 1796 Handle<SharedFunctionInfo> shared_function_info) |
| 1761 : Expression(isolate), shared_function_info_(shared_function_info) { } | 1797 : Expression(isolate), shared_function_info_(shared_function_info) { |
| 1798 IncrementHeavyAstNodeCounter(isolate); |
| 1799 } |
| 1762 | 1800 |
| 1763 DECLARE_NODE_TYPE(SharedFunctionInfoLiteral) | 1801 DECLARE_NODE_TYPE(SharedFunctionInfoLiteral) |
| 1764 | 1802 |
| 1765 Handle<SharedFunctionInfo> shared_function_info() const { | 1803 Handle<SharedFunctionInfo> shared_function_info() const { |
| 1766 return shared_function_info_; | 1804 return shared_function_info_; |
| 1767 } | 1805 } |
| 1768 virtual bool IsInlineable() const; | 1806 virtual bool IsInlineable() const; |
| 1769 | 1807 |
| 1770 private: | 1808 private: |
| 1771 Handle<SharedFunctionInfo> shared_function_info_; | 1809 Handle<SharedFunctionInfo> shared_function_info_; |
| 1772 }; | 1810 }; |
| 1773 | 1811 |
| 1774 | 1812 |
| 1775 class ThisFunction: public Expression { | 1813 class ThisFunction: public Expression { |
| 1776 public: | 1814 public: |
| 1777 explicit ThisFunction(Isolate* isolate) : Expression(isolate) {} | 1815 explicit ThisFunction(Isolate* isolate) : Expression(isolate) { |
| 1816 IncrementHeavyAstNodeCounter(isolate); |
| 1817 } |
| 1778 DECLARE_NODE_TYPE(ThisFunction) | 1818 DECLARE_NODE_TYPE(ThisFunction) |
| 1779 virtual bool IsInlineable() const; | 1819 virtual bool IsInlineable() const; |
| 1780 }; | 1820 }; |
| 1781 | 1821 |
| 1782 | 1822 |
| 1783 // ---------------------------------------------------------------------------- | 1823 // ---------------------------------------------------------------------------- |
| 1784 // Regular expressions | 1824 // Regular expressions |
| 1785 | 1825 |
| 1786 | 1826 |
| 1787 class RegExpVisitor BASE_EMBEDDED { | 1827 class RegExpVisitor BASE_EMBEDDED { |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2176 | 2216 |
| 2177 private: | 2217 private: |
| 2178 Isolate* isolate_; | 2218 Isolate* isolate_; |
| 2179 bool stack_overflow_; | 2219 bool stack_overflow_; |
| 2180 }; | 2220 }; |
| 2181 | 2221 |
| 2182 | 2222 |
| 2183 } } // namespace v8::internal | 2223 } } // namespace v8::internal |
| 2184 | 2224 |
| 2185 #endif // V8_AST_H_ | 2225 #endif // V8_AST_H_ |
| OLD | NEW |