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

Side by Side Diff: src/ast.h

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

Powered by Google App Engine
This is Rietveld 408576698