Chromium Code Reviews| OLD | NEW | 
|---|---|
| 1 // Copyright 2011 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 | 
| 11 // with the distribution. | 11 // with the distribution. | 
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 113 // Please do appreciate the required space in "> >". | 113 // Please do appreciate the required space in "> >". | 
| 114 typedef ZoneList<Handle<String> > ZoneStringList; | 114 typedef ZoneList<Handle<String> > ZoneStringList; | 
| 115 typedef ZoneList<Handle<Object> > ZoneObjectList; | 115 typedef ZoneList<Handle<Object> > ZoneObjectList; | 
| 116 | 116 | 
| 117 | 117 | 
| 118 #define DECLARE_NODE_TYPE(type) \ | 118 #define DECLARE_NODE_TYPE(type) \ | 
| 119 virtual void Accept(AstVisitor* v); \ | 119 virtual void Accept(AstVisitor* v); \ | 
| 120 virtual AstNode::Type node_type() const { return AstNode::k##type; } \ | 120 virtual AstNode::Type node_type() const { return AstNode::k##type; } \ | 
| 121 | 121 | 
| 122 | 122 | 
| 123 class AstNodeType { | |
| 124 public: | |
| 125 enum FlagIndex { | |
| 126 kIfStatement = 0, | |
| 127 kContinueStatement, | |
| 128 kBreakStatement, | |
| 129 kReturnStatement, | |
| 130 kWithStatement, | |
| 131 kSwitchStatement, | |
| 132 kDoWhileStatement, | |
| 133 kWhileStatement, | |
| 134 kForStatement, | |
| 135 kForInStatement, | |
| 136 kTryCatchStatement, | |
| 137 kTryFinallyStatement, | |
| 138 kDebuggerStatement, | |
| 139 kFunctionLiteral, | |
| 140 kSharedFunctionInfoLiteral, | |
| 141 kConditional, | |
| 142 kRegExpLiteral, | |
| 143 kObjectLiteral, | |
| 144 kArrayLiteral, | |
| 145 kThrow, | |
| 146 kProperty, | |
| 147 kCall, | |
| 148 kCallNew, | |
| 149 kCallRuntime, | |
| 150 kThisFunction | |
| 151 }; | |
| 152 | |
| 153 typedef int Flag; | |
| 
 
Sven Panne
2012/01/17 13:46:58
Drive-by comment: One could use EnumSet<FlagIndex>
 
 | |
| 154 | |
| 155 static const Flag kIfStatementMask = (1 << kIfStatement); | |
| 156 static const Flag kContinueStatementMask = (1 << kContinueStatement); | |
| 157 static const Flag kBreakStatementMask = (1 << kBreakStatement); | |
| 158 static const Flag kReturnStatementMask = (1 << kReturnStatement); | |
| 159 static const Flag kWithStatementMask = (1 << kWithStatement); | |
| 160 static const Flag kSwitchStatementMask = (1 << kSwitchStatement); | |
| 161 static const Flag kDoWhileStatementMask = (1 << kDoWhileStatement); | |
| 162 static const Flag kWhileStatementMask = (1 << kWhileStatement); | |
| 163 static const Flag kForStatementMask = (1 << kForStatement); | |
| 164 static const Flag kForInStatementMask = (1 << kForInStatement); | |
| 165 static const Flag kTryCatchStatementMask = (1 << kTryCatchStatement); | |
| 166 static const Flag kTryFinallyStatementMask = (1 << kTryFinallyStatement); | |
| 167 static const Flag kDebuggerStatementMask = (1 << kDebuggerStatement); | |
| 168 static const Flag kFunctionLiteralMask = (1 << kFunctionLiteral); | |
| 169 static const Flag kSharedFunctionInfoLiteralMask = | |
| 170 (1 << kSharedFunctionInfoLiteral); | |
| 171 static const Flag kConditionalMask = (1 << kConditional); | |
| 172 static const Flag kRegExpLiteralMask = (1 << kRegExpLiteral); | |
| 173 static const Flag kObjectLiteralMask = (1 << kObjectLiteral); | |
| 174 static const Flag kArrayLiteralMask = (1 << kArrayLiteral); | |
| 175 static const Flag kThrowMask = (1 << kThrow); | |
| 176 static const Flag kPropertyMask = (1 << kProperty); | |
| 177 static const Flag kCallMask = (1 << kCall); | |
| 178 static const Flag kCallNewMask = (1 << kCallNew); | |
| 179 static const Flag kCallRuntimeMask = (1 << kCallRuntime); | |
| 180 static const Flag kThisFunctionMask = (1 << kThisFunction); | |
| 181 | |
| 182 static const Flag kContainsBackEdgesMask = | |
| 183 kDoWhileStatementMask | | |
| 184 kWhileStatementMask | | |
| 185 kForStatementMask | | |
| 186 kForInStatementMask; | |
| 187 | |
| 188 static const Flag kContainsCallsMask = | |
| 189 kCallMask | kCallNewMask | kCallRuntimeMask; | |
| 190 | |
| 191 static const Flag kPreventsOptimizationMask = | |
| 192 kWithStatementMask | | |
| 193 kForInStatementMask | | |
| 194 kTryCatchStatementMask | | |
| 195 kTryFinallyStatementMask | | |
| 196 kDebuggerStatementMask | | |
| 197 kSharedFunctionInfoLiteral; | |
| 198 }; | |
| 199 | |
| 123 class AstNode: public ZoneObject { | 200 class AstNode: public ZoneObject { | 
| 124 public: | 201 public: | 
| 125 #define DECLARE_TYPE_ENUM(type) k##type, | 202 #define DECLARE_TYPE_ENUM(type) k##type, | 
| 126 enum Type { | 203 enum Type { | 
| 127 AST_NODE_LIST(DECLARE_TYPE_ENUM) | 204 AST_NODE_LIST(DECLARE_TYPE_ENUM) | 
| 128 kInvalid = -1 | 205 kInvalid = -1 | 
| 129 }; | 206 }; | 
| 130 #undef DECLARE_TYPE_ENUM | 207 #undef DECLARE_TYPE_ENUM | 
| 131 | 208 | 
| 132 static const int kNoNumber = -1; | 209 static const int kNoNumber = -1; | 
| (...skipping 27 matching lines...) Expand all Loading... | |
| 160 virtual Statement* AsStatement() { return NULL; } | 237 virtual Statement* AsStatement() { return NULL; } | 
| 161 virtual Expression* AsExpression() { return NULL; } | 238 virtual Expression* AsExpression() { return NULL; } | 
| 162 virtual TargetCollector* AsTargetCollector() { return NULL; } | 239 virtual TargetCollector* AsTargetCollector() { return NULL; } | 
| 163 virtual BreakableStatement* AsBreakableStatement() { return NULL; } | 240 virtual BreakableStatement* AsBreakableStatement() { return NULL; } | 
| 164 virtual IterationStatement* AsIterationStatement() { return NULL; } | 241 virtual IterationStatement* AsIterationStatement() { return NULL; } | 
| 165 virtual MaterializedLiteral* AsMaterializedLiteral() { return NULL; } | 242 virtual MaterializedLiteral* AsMaterializedLiteral() { return NULL; } | 
| 166 | 243 | 
| 167 // True if the node is simple enough for us to inline calls containing it. | 244 // True if the node is simple enough for us to inline calls containing it. | 
| 168 virtual bool IsInlineable() const = 0; | 245 virtual bool IsInlineable() const = 0; | 
| 169 | 246 | 
| 247 virtual void CollectInfo(AstNodeType::Flag* flags, int* node_count) const { | |
| 248 *node_count += 1; | |
| 249 } | |
| 250 | |
| 170 static int Count() { return Isolate::Current()->ast_node_count(); } | 251 static int Count() { return Isolate::Current()->ast_node_count(); } | 
| 171 static void ResetIds() { Isolate::Current()->set_ast_node_id(0); } | 252 static void ResetIds() { Isolate::Current()->set_ast_node_id(0); } | 
| 172 | 253 | 
| 173 protected: | 254 protected: | 
| 174 static unsigned GetNextId(Isolate* isolate) { | 255 static unsigned GetNextId(Isolate* isolate) { | 
| 175 return ReserveIdRange(isolate, 1); | 256 return ReserveIdRange(isolate, 1); | 
| 176 } | 257 } | 
| 177 | 258 | 
| 178 static unsigned ReserveIdRange(Isolate* isolate, int n) { | 259 static unsigned ReserveIdRange(Isolate* isolate, int n) { | 
| 179 unsigned tmp = isolate->ast_node_id(); | 260 unsigned tmp = isolate->ast_node_id(); | 
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 362 : BreakableStatement(isolate, labels, TARGET_FOR_NAMED_ONLY), | 443 : BreakableStatement(isolate, labels, TARGET_FOR_NAMED_ONLY), | 
| 363 statements_(capacity), | 444 statements_(capacity), | 
| 364 is_initializer_block_(is_initializer_block), | 445 is_initializer_block_(is_initializer_block), | 
| 365 block_scope_(NULL) { | 446 block_scope_(NULL) { | 
| 366 } | 447 } | 
| 367 | 448 | 
| 368 | 449 | 
| 369 DECLARE_NODE_TYPE(Block) | 450 DECLARE_NODE_TYPE(Block) | 
| 370 | 451 | 
| 371 virtual bool IsInlineable() const; | 452 virtual bool IsInlineable() const; | 
| 453 virtual void CollectInfo(AstNodeType::Flag* flags, int* node_count) const; | |
| 372 | 454 | 
| 373 void AddStatement(Statement* statement) { statements_.Add(statement); } | 455 void AddStatement(Statement* statement) { statements_.Add(statement); } | 
| 374 | 456 | 
| 375 ZoneList<Statement*>* statements() { return &statements_; } | 457 ZoneList<Statement*>* statements() { return &statements_; } | 
| 376 bool is_initializer_block() const { return is_initializer_block_; } | 458 bool is_initializer_block() const { return is_initializer_block_; } | 
| 377 | 459 | 
| 378 Scope* block_scope() const { return block_scope_; } | 460 Scope* block_scope() const { return block_scope_; } | 
| 379 void set_block_scope(Scope* block_scope) { block_scope_ = block_scope; } | 461 void set_block_scope(Scope* block_scope) { block_scope_ = block_scope; } | 
| 380 | 462 | 
| 381 private: | 463 private: | 
| (...skipping 20 matching lines...) Expand all Loading... | |
| 402 // At the moment there are no "const functions"'s in JavaScript... | 484 // At the moment there are no "const functions"'s in JavaScript... | 
| 403 ASSERT(fun == NULL || mode == VAR || mode == LET); | 485 ASSERT(fun == NULL || mode == VAR || mode == LET); | 
| 404 } | 486 } | 
| 405 | 487 | 
| 406 DECLARE_NODE_TYPE(Declaration) | 488 DECLARE_NODE_TYPE(Declaration) | 
| 407 | 489 | 
| 408 VariableProxy* proxy() const { return proxy_; } | 490 VariableProxy* proxy() const { return proxy_; } | 
| 409 VariableMode mode() const { return mode_; } | 491 VariableMode mode() const { return mode_; } | 
| 410 FunctionLiteral* fun() const { return fun_; } // may be NULL | 492 FunctionLiteral* fun() const { return fun_; } // may be NULL | 
| 411 virtual bool IsInlineable() const; | 493 virtual bool IsInlineable() const; | 
| 494 virtual void CollectInfo(AstNodeType::Flag* flags, int* node_count) const; | |
| 412 Scope* scope() const { return scope_; } | 495 Scope* scope() const { return scope_; } | 
| 413 | 496 | 
| 414 private: | 497 private: | 
| 415 VariableProxy* proxy_; | 498 VariableProxy* proxy_; | 
| 416 VariableMode mode_; | 499 VariableMode mode_; | 
| 417 FunctionLiteral* fun_; | 500 FunctionLiteral* fun_; | 
| 418 | 501 | 
| 419 // Nested scope from which the declaration originated. | 502 // Nested scope from which the declaration originated. | 
| 420 Scope* scope_; | 503 Scope* scope_; | 
| 421 }; | 504 }; | 
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 477 // the loop's condition a breakable location. | 560 // the loop's condition a breakable location. | 
| 478 int condition_position() { return condition_position_; } | 561 int condition_position() { return condition_position_; } | 
| 479 void set_condition_position(int pos) { condition_position_ = pos; } | 562 void set_condition_position(int pos) { condition_position_ = pos; } | 
| 480 | 563 | 
| 481 // Bailout support. | 564 // Bailout support. | 
| 482 virtual int ContinueId() const { return continue_id_; } | 565 virtual int ContinueId() const { return continue_id_; } | 
| 483 virtual int StackCheckId() const { return back_edge_id_; } | 566 virtual int StackCheckId() const { return back_edge_id_; } | 
| 484 int BackEdgeId() const { return back_edge_id_; } | 567 int BackEdgeId() const { return back_edge_id_; } | 
| 485 | 568 | 
| 486 virtual bool IsInlineable() const; | 569 virtual bool IsInlineable() const; | 
| 570 virtual void CollectInfo(AstNodeType::Flag* flags, int* node_count) const; | |
| 487 | 571 | 
| 488 private: | 572 private: | 
| 489 Expression* cond_; | 573 Expression* cond_; | 
| 490 int condition_position_; | 574 int condition_position_; | 
| 491 int continue_id_; | 575 int continue_id_; | 
| 492 int back_edge_id_; | 576 int back_edge_id_; | 
| 493 }; | 577 }; | 
| 494 | 578 | 
| 495 | 579 | 
| 496 class WhileStatement: public IterationStatement { | 580 class WhileStatement: public IterationStatement { | 
| (...skipping 13 matching lines...) Expand all Loading... | |
| 510 } | 594 } | 
| 511 | 595 | 
| 512 Expression* cond() const { return cond_; } | 596 Expression* cond() const { return cond_; } | 
| 513 bool may_have_function_literal() const { | 597 bool may_have_function_literal() const { | 
| 514 return may_have_function_literal_; | 598 return may_have_function_literal_; | 
| 515 } | 599 } | 
| 516 void set_may_have_function_literal(bool value) { | 600 void set_may_have_function_literal(bool value) { | 
| 517 may_have_function_literal_ = value; | 601 may_have_function_literal_ = value; | 
| 518 } | 602 } | 
| 519 virtual bool IsInlineable() const; | 603 virtual bool IsInlineable() const; | 
| 604 virtual void CollectInfo(AstNodeType::Flag* flags, int* node_count) const; | |
| 520 | 605 | 
| 521 // Bailout support. | 606 // Bailout support. | 
| 522 virtual int ContinueId() const { return EntryId(); } | 607 virtual int ContinueId() const { return EntryId(); } | 
| 523 virtual int StackCheckId() const { return body_id_; } | 608 virtual int StackCheckId() const { return body_id_; } | 
| 524 int BodyId() const { return body_id_; } | 609 int BodyId() const { return body_id_; } | 
| 525 | 610 | 
| 526 private: | 611 private: | 
| 527 Expression* cond_; | 612 Expression* cond_; | 
| 528 // True if there is a function literal subexpression in the condition. | 613 // True if there is a function literal subexpression in the condition. | 
| 529 bool may_have_function_literal_; | 614 bool may_have_function_literal_; | 
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 569 | 654 | 
| 570 // Bailout support. | 655 // Bailout support. | 
| 571 virtual int ContinueId() const { return continue_id_; } | 656 virtual int ContinueId() const { return continue_id_; } | 
| 572 virtual int StackCheckId() const { return body_id_; } | 657 virtual int StackCheckId() const { return body_id_; } | 
| 573 int BodyId() const { return body_id_; } | 658 int BodyId() const { return body_id_; } | 
| 574 | 659 | 
| 575 bool is_fast_smi_loop() { return loop_variable_ != NULL; } | 660 bool is_fast_smi_loop() { return loop_variable_ != NULL; } | 
| 576 Variable* loop_variable() { return loop_variable_; } | 661 Variable* loop_variable() { return loop_variable_; } | 
| 577 void set_loop_variable(Variable* var) { loop_variable_ = var; } | 662 void set_loop_variable(Variable* var) { loop_variable_ = var; } | 
| 578 virtual bool IsInlineable() const; | 663 virtual bool IsInlineable() const; | 
| 664 virtual void CollectInfo(AstNodeType::Flag* flags, int* node_count) const; | |
| 579 | 665 | 
| 580 private: | 666 private: | 
| 581 Statement* init_; | 667 Statement* init_; | 
| 582 Expression* cond_; | 668 Expression* cond_; | 
| 583 Statement* next_; | 669 Statement* next_; | 
| 584 // True if there is a function literal subexpression in the condition. | 670 // True if there is a function literal subexpression in the condition. | 
| 585 bool may_have_function_literal_; | 671 bool may_have_function_literal_; | 
| 586 Variable* loop_variable_; | 672 Variable* loop_variable_; | 
| 587 int continue_id_; | 673 int continue_id_; | 
| 588 int body_id_; | 674 int body_id_; | 
| (...skipping 13 matching lines...) Expand all Loading... | |
| 602 | 688 | 
| 603 void Initialize(Expression* each, Expression* enumerable, Statement* body) { | 689 void Initialize(Expression* each, Expression* enumerable, Statement* body) { | 
| 604 IterationStatement::Initialize(body); | 690 IterationStatement::Initialize(body); | 
| 605 each_ = each; | 691 each_ = each; | 
| 606 enumerable_ = enumerable; | 692 enumerable_ = enumerable; | 
| 607 } | 693 } | 
| 608 | 694 | 
| 609 Expression* each() const { return each_; } | 695 Expression* each() const { return each_; } | 
| 610 Expression* enumerable() const { return enumerable_; } | 696 Expression* enumerable() const { return enumerable_; } | 
| 611 virtual bool IsInlineable() const; | 697 virtual bool IsInlineable() const; | 
| 698 virtual void CollectInfo(AstNodeType::Flag* flags, int* node_count) const; | |
| 612 | 699 | 
| 613 // Bailout support. | 700 // Bailout support. | 
| 614 int AssignmentId() const { return assignment_id_; } | 701 int AssignmentId() const { return assignment_id_; } | 
| 615 virtual int ContinueId() const { return EntryId(); } | 702 virtual int ContinueId() const { return EntryId(); } | 
| 616 virtual int StackCheckId() const { return EntryId(); } | 703 virtual int StackCheckId() const { return EntryId(); } | 
| 617 | 704 | 
| 618 private: | 705 private: | 
| 619 Expression* each_; | 706 Expression* each_; | 
| 620 Expression* enumerable_; | 707 Expression* enumerable_; | 
| 621 int assignment_id_; | 708 int assignment_id_; | 
| 622 }; | 709 }; | 
| 623 | 710 | 
| 624 | 711 | 
| 625 class ExpressionStatement: public Statement { | 712 class ExpressionStatement: public Statement { | 
| 626 public: | 713 public: | 
| 627 explicit ExpressionStatement(Expression* expression) | 714 explicit ExpressionStatement(Expression* expression) | 
| 628 : expression_(expression) { } | 715 : expression_(expression) { } | 
| 629 | 716 | 
| 630 DECLARE_NODE_TYPE(ExpressionStatement) | 717 DECLARE_NODE_TYPE(ExpressionStatement) | 
| 631 | 718 | 
| 632 virtual bool IsInlineable() const; | 719 virtual bool IsInlineable() const; | 
| 720 virtual void CollectInfo(AstNodeType::Flag* flags, int* node_count) const; | |
| 633 | 721 | 
| 634 void set_expression(Expression* e) { expression_ = e; } | 722 void set_expression(Expression* e) { expression_ = e; } | 
| 635 Expression* expression() const { return expression_; } | 723 Expression* expression() const { return expression_; } | 
| 636 | 724 | 
| 637 private: | 725 private: | 
| 638 Expression* expression_; | 726 Expression* expression_; | 
| 639 }; | 727 }; | 
| 640 | 728 | 
| 641 | 729 | 
| 642 class ContinueStatement: public Statement { | 730 class ContinueStatement: public Statement { | 
| 643 public: | 731 public: | 
| 644 explicit ContinueStatement(IterationStatement* target) | 732 explicit ContinueStatement(IterationStatement* target) | 
| 645 : target_(target) { } | 733 : target_(target) { } | 
| 646 | 734 | 
| 647 DECLARE_NODE_TYPE(ContinueStatement) | 735 DECLARE_NODE_TYPE(ContinueStatement) | 
| 648 | 736 | 
| 649 IterationStatement* target() const { return target_; } | 737 IterationStatement* target() const { return target_; } | 
| 650 virtual bool IsInlineable() const; | 738 virtual bool IsInlineable() const; | 
| 739 virtual void CollectInfo(AstNodeType::Flag* flags, int* node_count) const; | |
| 651 | 740 | 
| 652 private: | 741 private: | 
| 653 IterationStatement* target_; | 742 IterationStatement* target_; | 
| 654 }; | 743 }; | 
| 655 | 744 | 
| 656 | 745 | 
| 657 class BreakStatement: public Statement { | 746 class BreakStatement: public Statement { | 
| 658 public: | 747 public: | 
| 659 explicit BreakStatement(BreakableStatement* target) | 748 explicit BreakStatement(BreakableStatement* target) | 
| 660 : target_(target) { } | 749 : target_(target) { } | 
| 661 | 750 | 
| 662 DECLARE_NODE_TYPE(BreakStatement) | 751 DECLARE_NODE_TYPE(BreakStatement) | 
| 663 | 752 | 
| 664 BreakableStatement* target() const { return target_; } | 753 BreakableStatement* target() const { return target_; } | 
| 665 virtual bool IsInlineable() const; | 754 virtual bool IsInlineable() const; | 
| 755 virtual void CollectInfo(AstNodeType::Flag* flags, int* node_count) const; | |
| 666 | 756 | 
| 667 private: | 757 private: | 
| 668 BreakableStatement* target_; | 758 BreakableStatement* target_; | 
| 669 }; | 759 }; | 
| 670 | 760 | 
| 671 | 761 | 
| 672 class ReturnStatement: public Statement { | 762 class ReturnStatement: public Statement { | 
| 673 public: | 763 public: | 
| 674 explicit ReturnStatement(Expression* expression) | 764 explicit ReturnStatement(Expression* expression) | 
| 675 : expression_(expression) { } | 765 : expression_(expression) { } | 
| 676 | 766 | 
| 677 DECLARE_NODE_TYPE(ReturnStatement) | 767 DECLARE_NODE_TYPE(ReturnStatement) | 
| 678 | 768 | 
| 679 Expression* expression() const { return expression_; } | 769 Expression* expression() const { return expression_; } | 
| 680 virtual bool IsInlineable() const; | 770 virtual bool IsInlineable() const; | 
| 771 virtual void CollectInfo(AstNodeType::Flag* flags, int* node_count) const; | |
| 681 | 772 | 
| 682 private: | 773 private: | 
| 683 Expression* expression_; | 774 Expression* expression_; | 
| 684 }; | 775 }; | 
| 685 | 776 | 
| 686 | 777 | 
| 687 class WithStatement: public Statement { | 778 class WithStatement: public Statement { | 
| 688 public: | 779 public: | 
| 689 WithStatement(Expression* expression, Statement* statement) | 780 WithStatement(Expression* expression, Statement* statement) | 
| 690 : expression_(expression), statement_(statement) { } | 781 : expression_(expression), statement_(statement) { } | 
| 691 | 782 | 
| 692 DECLARE_NODE_TYPE(WithStatement) | 783 DECLARE_NODE_TYPE(WithStatement) | 
| 693 | 784 | 
| 694 Expression* expression() const { return expression_; } | 785 Expression* expression() const { return expression_; } | 
| 695 Statement* statement() const { return statement_; } | 786 Statement* statement() const { return statement_; } | 
| 696 | 787 | 
| 697 virtual bool IsInlineable() const; | 788 virtual bool IsInlineable() const; | 
| 789 virtual void CollectInfo(AstNodeType::Flag* flags, int* node_count) const; | |
| 698 | 790 | 
| 699 private: | 791 private: | 
| 700 Expression* expression_; | 792 Expression* expression_; | 
| 701 Statement* statement_; | 793 Statement* statement_; | 
| 702 }; | 794 }; | 
| 703 | 795 | 
| 704 | 796 | 
| 705 class CaseClause: public ZoneObject { | 797 class CaseClause: public ZoneObject { | 
| 706 public: | 798 public: | 
| 707 CaseClause(Isolate* isolate, | 799 CaseClause(Isolate* isolate, | 
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 760 DECLARE_NODE_TYPE(SwitchStatement) | 852 DECLARE_NODE_TYPE(SwitchStatement) | 
| 761 | 853 | 
| 762 void Initialize(Expression* tag, ZoneList<CaseClause*>* cases) { | 854 void Initialize(Expression* tag, ZoneList<CaseClause*>* cases) { | 
| 763 tag_ = tag; | 855 tag_ = tag; | 
| 764 cases_ = cases; | 856 cases_ = cases; | 
| 765 } | 857 } | 
| 766 | 858 | 
| 767 Expression* tag() const { return tag_; } | 859 Expression* tag() const { return tag_; } | 
| 768 ZoneList<CaseClause*>* cases() const { return cases_; } | 860 ZoneList<CaseClause*>* cases() const { return cases_; } | 
| 769 virtual bool IsInlineable() const; | 861 virtual bool IsInlineable() const; | 
| 862 virtual void CollectInfo(AstNodeType::Flag* flags, int* node_count) const; | |
| 770 | 863 | 
| 771 private: | 864 private: | 
| 772 Expression* tag_; | 865 Expression* tag_; | 
| 773 ZoneList<CaseClause*>* cases_; | 866 ZoneList<CaseClause*>* cases_; | 
| 774 }; | 867 }; | 
| 775 | 868 | 
| 776 | 869 | 
| 777 // If-statements always have non-null references to their then- and | 870 // If-statements always have non-null references to their then- and | 
| 778 // else-parts. When parsing if-statements with no explicit else-part, | 871 // else-parts. When parsing if-statements with no explicit else-part, | 
| 779 // the parser implicitly creates an empty statement. Use the | 872 // the parser implicitly creates an empty statement. Use the | 
| 780 // HasThenStatement() and HasElseStatement() functions to check if a | 873 // HasThenStatement() and HasElseStatement() functions to check if a | 
| 781 // given if-statement has a then- or an else-part containing code. | 874 // given if-statement has a then- or an else-part containing code. | 
| 782 class IfStatement: public Statement { | 875 class IfStatement: public Statement { | 
| 783 public: | 876 public: | 
| 784 IfStatement(Isolate* isolate, | 877 IfStatement(Isolate* isolate, | 
| 785 Expression* condition, | 878 Expression* condition, | 
| 786 Statement* then_statement, | 879 Statement* then_statement, | 
| 787 Statement* else_statement) | 880 Statement* else_statement) | 
| 788 : condition_(condition), | 881 : condition_(condition), | 
| 789 then_statement_(then_statement), | 882 then_statement_(then_statement), | 
| 790 else_statement_(else_statement), | 883 else_statement_(else_statement), | 
| 791 if_id_(GetNextId(isolate)), | 884 if_id_(GetNextId(isolate)), | 
| 792 then_id_(GetNextId(isolate)), | 885 then_id_(GetNextId(isolate)), | 
| 793 else_id_(GetNextId(isolate)) { | 886 else_id_(GetNextId(isolate)) { | 
| 794 } | 887 } | 
| 795 | 888 | 
| 796 DECLARE_NODE_TYPE(IfStatement) | 889 DECLARE_NODE_TYPE(IfStatement) | 
| 797 | 890 | 
| 798 virtual bool IsInlineable() const; | 891 virtual bool IsInlineable() const; | 
| 892 virtual void CollectInfo(AstNodeType::Flag* flags, int* node_count) const; | |
| 799 | 893 | 
| 800 bool HasThenStatement() const { return !then_statement()->IsEmpty(); } | 894 bool HasThenStatement() const { return !then_statement()->IsEmpty(); } | 
| 801 bool HasElseStatement() const { return !else_statement()->IsEmpty(); } | 895 bool HasElseStatement() const { return !else_statement()->IsEmpty(); } | 
| 802 | 896 | 
| 803 Expression* condition() const { return condition_; } | 897 Expression* condition() const { return condition_; } | 
| 804 Statement* then_statement() const { return then_statement_; } | 898 Statement* then_statement() const { return then_statement_; } | 
| 805 Statement* else_statement() const { return else_statement_; } | 899 Statement* else_statement() const { return else_statement_; } | 
| 806 | 900 | 
| 807 int IfId() const { return if_id_; } | 901 int IfId() const { return if_id_; } | 
| 808 int ThenId() const { return then_id_; } | 902 int ThenId() const { return then_id_; } | 
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 878 scope_(scope), | 972 scope_(scope), | 
| 879 variable_(variable), | 973 variable_(variable), | 
| 880 catch_block_(catch_block) { | 974 catch_block_(catch_block) { | 
| 881 } | 975 } | 
| 882 | 976 | 
| 883 DECLARE_NODE_TYPE(TryCatchStatement) | 977 DECLARE_NODE_TYPE(TryCatchStatement) | 
| 884 | 978 | 
| 885 Scope* scope() { return scope_; } | 979 Scope* scope() { return scope_; } | 
| 886 Variable* variable() { return variable_; } | 980 Variable* variable() { return variable_; } | 
| 887 Block* catch_block() const { return catch_block_; } | 981 Block* catch_block() const { return catch_block_; } | 
| 888 virtual bool IsInlineable() const; | 982 virtual void CollectInfo(AstNodeType::Flag* flags, int* node_count) const; | 
| 889 | 983 | 
| 890 private: | 984 private: | 
| 891 Scope* scope_; | 985 Scope* scope_; | 
| 892 Variable* variable_; | 986 Variable* variable_; | 
| 893 Block* catch_block_; | 987 Block* catch_block_; | 
| 894 }; | 988 }; | 
| 895 | 989 | 
| 896 | 990 | 
| 897 class TryFinallyStatement: public TryStatement { | 991 class TryFinallyStatement: public TryStatement { | 
| 898 public: | 992 public: | 
| 899 TryFinallyStatement(int index, Block* try_block, Block* finally_block) | 993 TryFinallyStatement(int index, Block* try_block, Block* finally_block) | 
| 900 : TryStatement(index, try_block), | 994 : TryStatement(index, try_block), | 
| 901 finally_block_(finally_block) { } | 995 finally_block_(finally_block) { } | 
| 902 | 996 | 
| 903 DECLARE_NODE_TYPE(TryFinallyStatement) | 997 DECLARE_NODE_TYPE(TryFinallyStatement) | 
| 904 | 998 | 
| 905 Block* finally_block() const { return finally_block_; } | 999 Block* finally_block() const { return finally_block_; } | 
| 906 virtual bool IsInlineable() const; | 1000 virtual void CollectInfo(AstNodeType::Flag* flags, int* node_count) const; | 
| 907 | 1001 | 
| 908 private: | 1002 private: | 
| 909 Block* finally_block_; | 1003 Block* finally_block_; | 
| 910 }; | 1004 }; | 
| 911 | 1005 | 
| 912 | 1006 | 
| 913 class DebuggerStatement: public Statement { | 1007 class DebuggerStatement: public Statement { | 
| 914 public: | 1008 public: | 
| 915 DECLARE_NODE_TYPE(DebuggerStatement) | 1009 DECLARE_NODE_TYPE(DebuggerStatement) | 
| 916 virtual bool IsInlineable() const; | 1010 virtual bool IsInlineable() const; | 
| 1011 virtual void CollectInfo(AstNodeType::Flag* flags, int* node_count) const; | |
| 917 }; | 1012 }; | 
| 918 | 1013 | 
| 919 | 1014 | 
| 920 class EmptyStatement: public Statement { | 1015 class EmptyStatement: public Statement { | 
| 921 public: | 1016 public: | 
| 922 DECLARE_NODE_TYPE(EmptyStatement) | 1017 DECLARE_NODE_TYPE(EmptyStatement) | 
| 923 | 1018 | 
| 924 virtual bool IsInlineable() const; | 1019 virtual bool IsInlineable() const; | 
| 1020 virtual void CollectInfo(AstNodeType::Flag* flags, int* node_count) const; | |
| 925 }; | 1021 }; | 
| 926 | 1022 | 
| 927 | 1023 | 
| 928 class Literal: public Expression { | 1024 class Literal: public Expression { | 
| 929 public: | 1025 public: | 
| 930 Literal(Isolate* isolate, Handle<Object> handle) | 1026 Literal(Isolate* isolate, Handle<Object> handle) | 
| 931 : Expression(isolate), handle_(handle) { } | 1027 : Expression(isolate), handle_(handle) { } | 
| 932 | 1028 | 
| 933 DECLARE_NODE_TYPE(Literal) | 1029 DECLARE_NODE_TYPE(Literal) | 
| 934 | 1030 | 
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1070 // is shadowed by a later occurrence of the same key. For the | 1166 // is shadowed by a later occurrence of the same key. For the | 
| 1071 // marked expressions, no store code is emitted. | 1167 // marked expressions, no store code is emitted. | 
| 1072 void CalculateEmitStore(); | 1168 void CalculateEmitStore(); | 
| 1073 | 1169 | 
| 1074 enum Flags { | 1170 enum Flags { | 
| 1075 kNoFlags = 0, | 1171 kNoFlags = 0, | 
| 1076 kFastElements = 1, | 1172 kFastElements = 1, | 
| 1077 kHasFunction = 1 << 1 | 1173 kHasFunction = 1 << 1 | 
| 1078 }; | 1174 }; | 
| 1079 | 1175 | 
| 1176 virtual void CollectInfo(AstNodeType::Flag* flags, int* node_count) const; | |
| 1177 | |
| 1080 private: | 1178 private: | 
| 1081 Handle<FixedArray> constant_properties_; | 1179 Handle<FixedArray> constant_properties_; | 
| 1082 ZoneList<Property*>* properties_; | 1180 ZoneList<Property*>* properties_; | 
| 1083 bool fast_elements_; | 1181 bool fast_elements_; | 
| 1084 bool has_function_; | 1182 bool has_function_; | 
| 1085 }; | 1183 }; | 
| 1086 | 1184 | 
| 1087 | 1185 | 
| 1088 // Node for capturing a regexp literal. | 1186 // Node for capturing a regexp literal. | 
| 1089 class RegExpLiteral: public MaterializedLiteral { | 1187 class RegExpLiteral: public MaterializedLiteral { | 
| 1090 public: | 1188 public: | 
| 1091 RegExpLiteral(Isolate* isolate, | 1189 RegExpLiteral(Isolate* isolate, | 
| 1092 Handle<String> pattern, | 1190 Handle<String> pattern, | 
| 1093 Handle<String> flags, | 1191 Handle<String> flags, | 
| 1094 int literal_index) | 1192 int literal_index) | 
| 1095 : MaterializedLiteral(isolate, literal_index, false, 1), | 1193 : MaterializedLiteral(isolate, literal_index, false, 1), | 
| 1096 pattern_(pattern), | 1194 pattern_(pattern), | 
| 1097 flags_(flags) {} | 1195 flags_(flags) {} | 
| 1098 | 1196 | 
| 1099 DECLARE_NODE_TYPE(RegExpLiteral) | 1197 DECLARE_NODE_TYPE(RegExpLiteral) | 
| 1100 | 1198 | 
| 1101 Handle<String> pattern() const { return pattern_; } | 1199 Handle<String> pattern() const { return pattern_; } | 
| 1102 Handle<String> flags() const { return flags_; } | 1200 Handle<String> flags() const { return flags_; } | 
| 1103 | 1201 | 
| 1202 virtual void CollectInfo(AstNodeType::Flag* flags, int* node_count) const; | |
| 1203 | |
| 1104 private: | 1204 private: | 
| 1105 Handle<String> pattern_; | 1205 Handle<String> pattern_; | 
| 1106 Handle<String> flags_; | 1206 Handle<String> flags_; | 
| 1107 }; | 1207 }; | 
| 1108 | 1208 | 
| 1109 // An array literal has a literals object that is used | 1209 // An array literal has a literals object that is used | 
| 1110 // for minimizing the work when constructing it at runtime. | 1210 // for minimizing the work when constructing it at runtime. | 
| 1111 class ArrayLiteral: public MaterializedLiteral { | 1211 class ArrayLiteral: public MaterializedLiteral { | 
| 1112 public: | 1212 public: | 
| 1113 ArrayLiteral(Isolate* isolate, | 1213 ArrayLiteral(Isolate* isolate, | 
| 1114 Handle<FixedArray> constant_elements, | 1214 Handle<FixedArray> constant_elements, | 
| 1115 ZoneList<Expression*>* values, | 1215 ZoneList<Expression*>* values, | 
| 1116 int literal_index, | 1216 int literal_index, | 
| 1117 bool is_simple, | 1217 bool is_simple, | 
| 1118 int depth) | 1218 int depth) | 
| 1119 : MaterializedLiteral(isolate, literal_index, is_simple, depth), | 1219 : MaterializedLiteral(isolate, literal_index, is_simple, depth), | 
| 1120 constant_elements_(constant_elements), | 1220 constant_elements_(constant_elements), | 
| 1121 values_(values), | 1221 values_(values), | 
| 1122 first_element_id_(ReserveIdRange(isolate, values->length())) {} | 1222 first_element_id_(ReserveIdRange(isolate, values->length())) {} | 
| 1123 | 1223 | 
| 1124 DECLARE_NODE_TYPE(ArrayLiteral) | 1224 DECLARE_NODE_TYPE(ArrayLiteral) | 
| 1125 | 1225 | 
| 1126 Handle<FixedArray> constant_elements() const { return constant_elements_; } | 1226 Handle<FixedArray> constant_elements() const { return constant_elements_; } | 
| 1127 ZoneList<Expression*>* values() const { return values_; } | 1227 ZoneList<Expression*>* values() const { return values_; } | 
| 1128 | 1228 | 
| 1129 // Return an AST id for an element that is used in simulate instructions. | 1229 // Return an AST id for an element that is used in simulate instructions. | 
| 1130 int GetIdForElement(int i) { return first_element_id_ + i; } | 1230 int GetIdForElement(int i) { return first_element_id_ + i; } | 
| 1131 | 1231 | 
| 1232 virtual void CollectInfo(AstNodeType::Flag* flags, int* node_count) const; | |
| 1233 | |
| 1132 private: | 1234 private: | 
| 1133 Handle<FixedArray> constant_elements_; | 1235 Handle<FixedArray> constant_elements_; | 
| 1134 ZoneList<Expression*>* values_; | 1236 ZoneList<Expression*>* values_; | 
| 1135 int first_element_id_; | 1237 int first_element_id_; | 
| 1136 }; | 1238 }; | 
| 1137 | 1239 | 
| 1138 | 1240 | 
| 1139 class VariableProxy: public Expression { | 1241 class VariableProxy: public Expression { | 
| 1140 public: | 1242 public: | 
| 1141 VariableProxy(Isolate* isolate, Variable* var); | 1243 VariableProxy(Isolate* isolate, Variable* var); | 
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1199 is_monomorphic_(false), | 1301 is_monomorphic_(false), | 
| 1200 is_array_length_(false), | 1302 is_array_length_(false), | 
| 1201 is_string_length_(false), | 1303 is_string_length_(false), | 
| 1202 is_string_access_(false), | 1304 is_string_access_(false), | 
| 1203 is_function_prototype_(false) { } | 1305 is_function_prototype_(false) { } | 
| 1204 | 1306 | 
| 1205 DECLARE_NODE_TYPE(Property) | 1307 DECLARE_NODE_TYPE(Property) | 
| 1206 | 1308 | 
| 1207 virtual bool IsValidLeftHandSide() { return true; } | 1309 virtual bool IsValidLeftHandSide() { return true; } | 
| 1208 virtual bool IsInlineable() const; | 1310 virtual bool IsInlineable() const; | 
| 1311 virtual void CollectInfo(AstNodeType::Flag* flags, int* node_count) const; | |
| 1209 | 1312 | 
| 1210 Expression* obj() const { return obj_; } | 1313 Expression* obj() const { return obj_; } | 
| 1211 Expression* key() const { return key_; } | 1314 Expression* key() const { return key_; } | 
| 1212 virtual int position() const { return pos_; } | 1315 virtual int position() const { return pos_; } | 
| 1213 | 1316 | 
| 1214 bool IsStringLength() const { return is_string_length_; } | 1317 bool IsStringLength() const { return is_string_length_; } | 
| 1215 bool IsStringAccess() const { return is_string_access_; } | 1318 bool IsStringAccess() const { return is_string_access_; } | 
| 1216 bool IsFunctionPrototype() const { return is_function_prototype_; } | 1319 bool IsFunctionPrototype() const { return is_function_prototype_; } | 
| 1217 | 1320 | 
| 1218 // Type feedback information. | 1321 // Type feedback information. | 
| (...skipping 27 matching lines...) Expand all Loading... | |
| 1246 arguments_(arguments), | 1349 arguments_(arguments), | 
| 1247 pos_(pos), | 1350 pos_(pos), | 
| 1248 is_monomorphic_(false), | 1351 is_monomorphic_(false), | 
| 1249 check_type_(RECEIVER_MAP_CHECK), | 1352 check_type_(RECEIVER_MAP_CHECK), | 
| 1250 return_id_(GetNextId(isolate)) { | 1353 return_id_(GetNextId(isolate)) { | 
| 1251 } | 1354 } | 
| 1252 | 1355 | 
| 1253 DECLARE_NODE_TYPE(Call) | 1356 DECLARE_NODE_TYPE(Call) | 
| 1254 | 1357 | 
| 1255 virtual bool IsInlineable() const; | 1358 virtual bool IsInlineable() const; | 
| 1359 virtual void CollectInfo(AstNodeType::Flag* flags, int* node_count) const; | |
| 1256 | 1360 | 
| 1257 Expression* expression() const { return expression_; } | 1361 Expression* expression() const { return expression_; } | 
| 1258 ZoneList<Expression*>* arguments() const { return arguments_; } | 1362 ZoneList<Expression*>* arguments() const { return arguments_; } | 
| 1259 virtual int position() const { return pos_; } | 1363 virtual int position() const { return pos_; } | 
| 1260 | 1364 | 
| 1261 void RecordTypeFeedback(TypeFeedbackOracle* oracle, | 1365 void RecordTypeFeedback(TypeFeedbackOracle* oracle, | 
| 1262 CallKind call_kind); | 1366 CallKind call_kind); | 
| 1263 virtual SmallMapList* GetReceiverTypes() { return &receiver_types_; } | 1367 virtual SmallMapList* GetReceiverTypes() { return &receiver_types_; } | 
| 1264 virtual bool IsMonomorphic() { return is_monomorphic_; } | 1368 virtual bool IsMonomorphic() { return is_monomorphic_; } | 
| 1265 CheckType check_type() const { return check_type_; } | 1369 CheckType check_type() const { return check_type_; } | 
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1301 ZoneList<Expression*>* arguments, | 1405 ZoneList<Expression*>* arguments, | 
| 1302 int pos) | 1406 int pos) | 
| 1303 : Expression(isolate), | 1407 : Expression(isolate), | 
| 1304 expression_(expression), | 1408 expression_(expression), | 
| 1305 arguments_(arguments), | 1409 arguments_(arguments), | 
| 1306 pos_(pos) { } | 1410 pos_(pos) { } | 
| 1307 | 1411 | 
| 1308 DECLARE_NODE_TYPE(CallNew) | 1412 DECLARE_NODE_TYPE(CallNew) | 
| 1309 | 1413 | 
| 1310 virtual bool IsInlineable() const; | 1414 virtual bool IsInlineable() const; | 
| 1415 virtual void CollectInfo(AstNodeType::Flag* flags, int* node_count) const; | |
| 1311 | 1416 | 
| 1312 Expression* expression() const { return expression_; } | 1417 Expression* expression() const { return expression_; } | 
| 1313 ZoneList<Expression*>* arguments() const { return arguments_; } | 1418 ZoneList<Expression*>* arguments() const { return arguments_; } | 
| 1314 virtual int position() const { return pos_; } | 1419 virtual int position() const { return pos_; } | 
| 1315 | 1420 | 
| 1316 private: | 1421 private: | 
| 1317 Expression* expression_; | 1422 Expression* expression_; | 
| 1318 ZoneList<Expression*>* arguments_; | 1423 ZoneList<Expression*>* arguments_; | 
| 1319 int pos_; | 1424 int pos_; | 
| 1320 }; | 1425 }; | 
| (...skipping 10 matching lines...) Expand all Loading... | |
| 1331 const Runtime::Function* function, | 1436 const Runtime::Function* function, | 
| 1332 ZoneList<Expression*>* arguments) | 1437 ZoneList<Expression*>* arguments) | 
| 1333 : Expression(isolate), | 1438 : Expression(isolate), | 
| 1334 name_(name), | 1439 name_(name), | 
| 1335 function_(function), | 1440 function_(function), | 
| 1336 arguments_(arguments) { } | 1441 arguments_(arguments) { } | 
| 1337 | 1442 | 
| 1338 DECLARE_NODE_TYPE(CallRuntime) | 1443 DECLARE_NODE_TYPE(CallRuntime) | 
| 1339 | 1444 | 
| 1340 virtual bool IsInlineable() const; | 1445 virtual bool IsInlineable() const; | 
| 1446 virtual void CollectInfo(AstNodeType::Flag* flags, int* node_count) const; | |
| 1341 | 1447 | 
| 1342 Handle<String> name() const { return name_; } | 1448 Handle<String> name() const { return name_; } | 
| 1343 const Runtime::Function* function() const { return function_; } | 1449 const Runtime::Function* function() const { return function_; } | 
| 1344 ZoneList<Expression*>* arguments() const { return arguments_; } | 1450 ZoneList<Expression*>* arguments() const { return arguments_; } | 
| 1345 bool is_jsruntime() const { return function_ == NULL; } | 1451 bool is_jsruntime() const { return function_ == NULL; } | 
| 1346 | 1452 | 
| 1347 private: | 1453 private: | 
| 1348 Handle<String> name_; | 1454 Handle<String> name_; | 
| 1349 const Runtime::Function* function_; | 1455 const Runtime::Function* function_; | 
| 1350 ZoneList<Expression*>* arguments_; | 1456 ZoneList<Expression*>* arguments_; | 
| (...skipping 15 matching lines...) Expand all Loading... | |
| 1366 ASSERT(Token::IsUnaryOp(op)); | 1472 ASSERT(Token::IsUnaryOp(op)); | 
| 1367 if (op == Token::NOT) { | 1473 if (op == Token::NOT) { | 
| 1368 materialize_true_id_ = GetNextId(isolate); | 1474 materialize_true_id_ = GetNextId(isolate); | 
| 1369 materialize_false_id_ = GetNextId(isolate); | 1475 materialize_false_id_ = GetNextId(isolate); | 
| 1370 } | 1476 } | 
| 1371 } | 1477 } | 
| 1372 | 1478 | 
| 1373 DECLARE_NODE_TYPE(UnaryOperation) | 1479 DECLARE_NODE_TYPE(UnaryOperation) | 
| 1374 | 1480 | 
| 1375 virtual bool IsInlineable() const; | 1481 virtual bool IsInlineable() const; | 
| 1482 virtual void CollectInfo(AstNodeType::Flag* flags, int* node_count) const; | |
| 1376 | 1483 | 
| 1377 virtual bool ResultOverwriteAllowed(); | 1484 virtual bool ResultOverwriteAllowed(); | 
| 1378 | 1485 | 
| 1379 Token::Value op() const { return op_; } | 1486 Token::Value op() const { return op_; } | 
| 1380 Expression* expression() const { return expression_; } | 1487 Expression* expression() const { return expression_; } | 
| 1381 virtual int position() const { return pos_; } | 1488 virtual int position() const { return pos_; } | 
| 1382 | 1489 | 
| 1383 int MaterializeTrueId() { return materialize_true_id_; } | 1490 int MaterializeTrueId() { return materialize_true_id_; } | 
| 1384 int MaterializeFalseId() { return materialize_false_id_; } | 1491 int MaterializeFalseId() { return materialize_false_id_; } | 
| 1385 | 1492 | 
| (...skipping 19 matching lines...) Expand all Loading... | |
| 1405 : Expression(isolate), op_(op), left_(left), right_(right), pos_(pos) { | 1512 : Expression(isolate), op_(op), left_(left), right_(right), pos_(pos) { | 
| 1406 ASSERT(Token::IsBinaryOp(op)); | 1513 ASSERT(Token::IsBinaryOp(op)); | 
| 1407 right_id_ = (op == Token::AND || op == Token::OR) | 1514 right_id_ = (op == Token::AND || op == Token::OR) | 
| 1408 ? static_cast<int>(GetNextId(isolate)) | 1515 ? static_cast<int>(GetNextId(isolate)) | 
| 1409 : AstNode::kNoNumber; | 1516 : AstNode::kNoNumber; | 
| 1410 } | 1517 } | 
| 1411 | 1518 | 
| 1412 DECLARE_NODE_TYPE(BinaryOperation) | 1519 DECLARE_NODE_TYPE(BinaryOperation) | 
| 1413 | 1520 | 
| 1414 virtual bool IsInlineable() const; | 1521 virtual bool IsInlineable() const; | 
| 1522 virtual void CollectInfo(AstNodeType::Flag* flags, int* node_count) const; | |
| 1415 | 1523 | 
| 1416 virtual bool ResultOverwriteAllowed(); | 1524 virtual bool ResultOverwriteAllowed(); | 
| 1417 | 1525 | 
| 1418 Token::Value op() const { return op_; } | 1526 Token::Value op() const { return op_; } | 
| 1419 Expression* left() const { return left_; } | 1527 Expression* left() const { return left_; } | 
| 1420 Expression* right() const { return right_; } | 1528 Expression* right() const { return right_; } | 
| 1421 virtual int position() const { return pos_; } | 1529 virtual int position() const { return pos_; } | 
| 1422 | 1530 | 
| 1423 // Bailout support. | 1531 // Bailout support. | 
| 1424 int RightId() const { return right_id_; } | 1532 int RightId() const { return right_id_; } | 
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1458 Token::Value binary_op() { | 1566 Token::Value binary_op() { | 
| 1459 return (op() == Token::INC) ? Token::ADD : Token::SUB; | 1567 return (op() == Token::INC) ? Token::ADD : Token::SUB; | 
| 1460 } | 1568 } | 
| 1461 | 1569 | 
| 1462 Expression* expression() const { return expression_; } | 1570 Expression* expression() const { return expression_; } | 
| 1463 virtual int position() const { return pos_; } | 1571 virtual int position() const { return pos_; } | 
| 1464 | 1572 | 
| 1465 virtual void MarkAsStatement() { is_prefix_ = true; } | 1573 virtual void MarkAsStatement() { is_prefix_ = true; } | 
| 1466 | 1574 | 
| 1467 virtual bool IsInlineable() const; | 1575 virtual bool IsInlineable() const; | 
| 1576 virtual void CollectInfo(AstNodeType::Flag* flags, int* node_count) const; | |
| 1468 | 1577 | 
| 1469 void RecordTypeFeedback(TypeFeedbackOracle* oracle); | 1578 void RecordTypeFeedback(TypeFeedbackOracle* oracle); | 
| 1470 virtual bool IsMonomorphic() { return is_monomorphic_; } | 1579 virtual bool IsMonomorphic() { return is_monomorphic_; } | 
| 1471 virtual SmallMapList* GetReceiverTypes() { return &receiver_types_; } | 1580 virtual SmallMapList* GetReceiverTypes() { return &receiver_types_; } | 
| 1472 | 1581 | 
| 1473 // Bailout support. | 1582 // Bailout support. | 
| 1474 int AssignmentId() const { return assignment_id_; } | 1583 int AssignmentId() const { return assignment_id_; } | 
| 1475 int CountId() const { return count_id_; } | 1584 int CountId() const { return count_id_; } | 
| 1476 | 1585 | 
| 1477 private: | 1586 private: | 
| (...skipping 25 matching lines...) Expand all Loading... | |
| 1503 } | 1612 } | 
| 1504 | 1613 | 
| 1505 DECLARE_NODE_TYPE(CompareOperation) | 1614 DECLARE_NODE_TYPE(CompareOperation) | 
| 1506 | 1615 | 
| 1507 Token::Value op() const { return op_; } | 1616 Token::Value op() const { return op_; } | 
| 1508 Expression* left() const { return left_; } | 1617 Expression* left() const { return left_; } | 
| 1509 Expression* right() const { return right_; } | 1618 Expression* right() const { return right_; } | 
| 1510 virtual int position() const { return pos_; } | 1619 virtual int position() const { return pos_; } | 
| 1511 | 1620 | 
| 1512 virtual bool IsInlineable() const; | 1621 virtual bool IsInlineable() const; | 
| 1622 virtual void CollectInfo(AstNodeType::Flag* flags, int* node_count) const; | |
| 1513 | 1623 | 
| 1514 // Type feedback information. | 1624 // Type feedback information. | 
| 1515 void RecordTypeFeedback(TypeFeedbackOracle* oracle); | 1625 void RecordTypeFeedback(TypeFeedbackOracle* oracle); | 
| 1516 bool IsSmiCompare() { return compare_type_ == SMI_ONLY; } | 1626 bool IsSmiCompare() { return compare_type_ == SMI_ONLY; } | 
| 1517 bool IsObjectCompare() { return compare_type_ == OBJECT_ONLY; } | 1627 bool IsObjectCompare() { return compare_type_ == OBJECT_ONLY; } | 
| 1518 | 1628 | 
| 1519 // Match special cases. | 1629 // Match special cases. | 
| 1520 bool IsLiteralCompareTypeof(Expression** expr, Handle<String>* check); | 1630 bool IsLiteralCompareTypeof(Expression** expr, Handle<String>* check); | 
| 1521 bool IsLiteralCompareUndefined(Expression** expr); | 1631 bool IsLiteralCompareUndefined(Expression** expr); | 
| 1522 bool IsLiteralCompareNull(Expression** expr); | 1632 bool IsLiteralCompareNull(Expression** expr); | 
| (...skipping 23 matching lines...) Expand all Loading... | |
| 1546 else_expression_(else_expression), | 1656 else_expression_(else_expression), | 
| 1547 then_expression_position_(then_expression_position), | 1657 then_expression_position_(then_expression_position), | 
| 1548 else_expression_position_(else_expression_position), | 1658 else_expression_position_(else_expression_position), | 
| 1549 then_id_(GetNextId(isolate)), | 1659 then_id_(GetNextId(isolate)), | 
| 1550 else_id_(GetNextId(isolate)) { | 1660 else_id_(GetNextId(isolate)) { | 
| 1551 } | 1661 } | 
| 1552 | 1662 | 
| 1553 DECLARE_NODE_TYPE(Conditional) | 1663 DECLARE_NODE_TYPE(Conditional) | 
| 1554 | 1664 | 
| 1555 virtual bool IsInlineable() const; | 1665 virtual bool IsInlineable() const; | 
| 1666 virtual void CollectInfo(AstNodeType::Flag* flags, int* node_count) const; | |
| 1556 | 1667 | 
| 1557 Expression* condition() const { return condition_; } | 1668 Expression* condition() const { return condition_; } | 
| 1558 Expression* then_expression() const { return then_expression_; } | 1669 Expression* then_expression() const { return then_expression_; } | 
| 1559 Expression* else_expression() const { return else_expression_; } | 1670 Expression* else_expression() const { return else_expression_; } | 
| 1560 | 1671 | 
| 1561 int then_expression_position() const { return then_expression_position_; } | 1672 int then_expression_position() const { return then_expression_position_; } | 
| 1562 int else_expression_position() const { return else_expression_position_; } | 1673 int else_expression_position() const { return else_expression_position_; } | 
| 1563 | 1674 | 
| 1564 int ThenId() const { return then_id_; } | 1675 int ThenId() const { return then_id_; } | 
| 1565 int ElseId() const { return else_id_; } | 1676 int ElseId() const { return else_id_; } | 
| (...skipping 13 matching lines...) Expand all Loading... | |
| 1579 public: | 1690 public: | 
| 1580 Assignment(Isolate* isolate, | 1691 Assignment(Isolate* isolate, | 
| 1581 Token::Value op, | 1692 Token::Value op, | 
| 1582 Expression* target, | 1693 Expression* target, | 
| 1583 Expression* value, | 1694 Expression* value, | 
| 1584 int pos); | 1695 int pos); | 
| 1585 | 1696 | 
| 1586 DECLARE_NODE_TYPE(Assignment) | 1697 DECLARE_NODE_TYPE(Assignment) | 
| 1587 | 1698 | 
| 1588 virtual bool IsInlineable() const; | 1699 virtual bool IsInlineable() const; | 
| 1700 virtual void CollectInfo(AstNodeType::Flag* flags, int* node_count) const; | |
| 1589 | 1701 | 
| 1590 Assignment* AsSimpleAssignment() { return !is_compound() ? this : NULL; } | 1702 Assignment* AsSimpleAssignment() { return !is_compound() ? this : NULL; } | 
| 1591 | 1703 | 
| 1592 Token::Value binary_op() const; | 1704 Token::Value binary_op() const; | 
| 1593 | 1705 | 
| 1594 Token::Value op() const { return op_; } | 1706 Token::Value op() const { return op_; } | 
| 1595 Expression* target() const { return target_; } | 1707 Expression* target() const { return target_; } | 
| 1596 Expression* value() const { return value_; } | 1708 Expression* value() const { return value_; } | 
| 1597 virtual int position() const { return pos_; } | 1709 virtual int position() const { return pos_; } | 
| 1598 BinaryOperation* binary_operation() const { return binary_operation_; } | 1710 BinaryOperation* binary_operation() const { return binary_operation_; } | 
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1638 class Throw: public Expression { | 1750 class Throw: public Expression { | 
| 1639 public: | 1751 public: | 
| 1640 Throw(Isolate* isolate, Expression* exception, int pos) | 1752 Throw(Isolate* isolate, Expression* exception, int pos) | 
| 1641 : Expression(isolate), exception_(exception), pos_(pos) {} | 1753 : Expression(isolate), exception_(exception), pos_(pos) {} | 
| 1642 | 1754 | 
| 1643 DECLARE_NODE_TYPE(Throw) | 1755 DECLARE_NODE_TYPE(Throw) | 
| 1644 | 1756 | 
| 1645 Expression* exception() const { return exception_; } | 1757 Expression* exception() const { return exception_; } | 
| 1646 virtual int position() const { return pos_; } | 1758 virtual int position() const { return pos_; } | 
| 1647 virtual bool IsInlineable() const; | 1759 virtual bool IsInlineable() const; | 
| 1760 virtual void CollectInfo(AstNodeType::Flag* flags, int* node_count) const; | |
| 1648 | 1761 | 
| 1649 private: | 1762 private: | 
| 1650 Expression* exception_; | 1763 Expression* exception_; | 
| 1651 int pos_; | 1764 int pos_; | 
| 1652 }; | 1765 }; | 
| 1653 | 1766 | 
| 1654 | 1767 | 
| 1655 class FunctionLiteral: public Expression { | 1768 class FunctionLiteral: public Expression { | 
| 1656 public: | 1769 public: | 
| 1657 enum Type { | 1770 enum Type { | 
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1725 } | 1838 } | 
| 1726 | 1839 | 
| 1727 Handle<String> inferred_name() const { return inferred_name_; } | 1840 Handle<String> inferred_name() const { return inferred_name_; } | 
| 1728 void set_inferred_name(Handle<String> inferred_name) { | 1841 void set_inferred_name(Handle<String> inferred_name) { | 
| 1729 inferred_name_ = inferred_name; | 1842 inferred_name_ = inferred_name; | 
| 1730 } | 1843 } | 
| 1731 | 1844 | 
| 1732 bool pretenure() { return Pretenure::decode(bitfield_); } | 1845 bool pretenure() { return Pretenure::decode(bitfield_); } | 
| 1733 void set_pretenure() { bitfield_ |= Pretenure::encode(true); } | 1846 void set_pretenure() { bitfield_ |= Pretenure::encode(true); } | 
| 1734 virtual bool IsInlineable() const; | 1847 virtual bool IsInlineable() const; | 
| 1848 virtual void CollectInfo(AstNodeType::Flag* flags, int* node_count) const; | |
| 1735 | 1849 | 
| 1736 bool has_duplicate_parameters() { | 1850 bool has_duplicate_parameters() { | 
| 1737 return HasDuplicateParameters::decode(bitfield_); | 1851 return HasDuplicateParameters::decode(bitfield_); | 
| 1738 } | 1852 } | 
| 1739 | 1853 | 
| 1854 bool ShouldSelfOptimize(); | |
| 1855 int AstNodeCount(); | |
| 1856 | |
| 1740 private: | 1857 private: | 
| 1741 Handle<String> name_; | 1858 Handle<String> name_; | 
| 1742 Scope* scope_; | 1859 Scope* scope_; | 
| 1743 ZoneList<Statement*>* body_; | 1860 ZoneList<Statement*>* body_; | 
| 1744 Handle<FixedArray> this_property_assignments_; | 1861 Handle<FixedArray> this_property_assignments_; | 
| 1745 Handle<String> inferred_name_; | 1862 Handle<String> inferred_name_; | 
| 1746 | 1863 | 
| 1747 int materialized_literal_count_; | 1864 int materialized_literal_count_; | 
| 1748 int expected_property_count_; | 1865 int expected_property_count_; | 
| 1749 int handler_count_; | 1866 int handler_count_; | 
| (...skipping 15 matching lines...) Expand all Loading... | |
| 1765 Isolate* isolate, | 1882 Isolate* isolate, | 
| 1766 Handle<SharedFunctionInfo> shared_function_info) | 1883 Handle<SharedFunctionInfo> shared_function_info) | 
| 1767 : Expression(isolate), shared_function_info_(shared_function_info) { } | 1884 : Expression(isolate), shared_function_info_(shared_function_info) { } | 
| 1768 | 1885 | 
| 1769 DECLARE_NODE_TYPE(SharedFunctionInfoLiteral) | 1886 DECLARE_NODE_TYPE(SharedFunctionInfoLiteral) | 
| 1770 | 1887 | 
| 1771 Handle<SharedFunctionInfo> shared_function_info() const { | 1888 Handle<SharedFunctionInfo> shared_function_info() const { | 
| 1772 return shared_function_info_; | 1889 return shared_function_info_; | 
| 1773 } | 1890 } | 
| 1774 virtual bool IsInlineable() const; | 1891 virtual bool IsInlineable() const; | 
| 1892 virtual void CollectInfo(AstNodeType::Flag* flags, int* node_count) const; | |
| 1775 | 1893 | 
| 1776 private: | 1894 private: | 
| 1777 Handle<SharedFunctionInfo> shared_function_info_; | 1895 Handle<SharedFunctionInfo> shared_function_info_; | 
| 1778 }; | 1896 }; | 
| 1779 | 1897 | 
| 1780 | 1898 | 
| 1781 class ThisFunction: public Expression { | 1899 class ThisFunction: public Expression { | 
| 1782 public: | 1900 public: | 
| 1783 explicit ThisFunction(Isolate* isolate) : Expression(isolate) {} | 1901 explicit ThisFunction(Isolate* isolate) : Expression(isolate) {} | 
| 1784 DECLARE_NODE_TYPE(ThisFunction) | 1902 DECLARE_NODE_TYPE(ThisFunction) | 
| 1785 virtual bool IsInlineable() const; | 1903 virtual bool IsInlineable() const; | 
| 1904 virtual void CollectInfo(AstNodeType::Flag* flags, int* node_count) const; | |
| 1786 }; | 1905 }; | 
| 1787 | 1906 | 
| 1788 | 1907 | 
| 1789 // ---------------------------------------------------------------------------- | 1908 // ---------------------------------------------------------------------------- | 
| 1790 // Regular expressions | 1909 // Regular expressions | 
| 1791 | 1910 | 
| 1792 | 1911 | 
| 1793 class RegExpVisitor BASE_EMBEDDED { | 1912 class RegExpVisitor BASE_EMBEDDED { | 
| 1794 public: | 1913 public: | 
| 1795 virtual ~RegExpVisitor() { } | 1914 virtual ~RegExpVisitor() { } | 
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2182 | 2301 | 
| 2183 private: | 2302 private: | 
| 2184 Isolate* isolate_; | 2303 Isolate* isolate_; | 
| 2185 bool stack_overflow_; | 2304 bool stack_overflow_; | 
| 2186 }; | 2305 }; | 
| 2187 | 2306 | 
| 2188 | 2307 | 
| 2189 } } // namespace v8::internal | 2308 } } // namespace v8::internal | 
| 2190 | 2309 | 
| 2191 #endif // V8_AST_H_ | 2310 #endif // V8_AST_H_ | 
| OLD | NEW |