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

Side by Side Diff: src/ast.cc

Issue 3146037: Cleanup the AST code by removing unused parts and get rid of the... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 3 months 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
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 10 matching lines...) Expand all
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #include "v8.h" 28 #include "v8.h"
29 29
30 #include "ast.h" 30 #include "ast.h"
31 #include "data-flow.h"
32 #include "parser.h" 31 #include "parser.h"
33 #include "scopes.h" 32 #include "scopes.h"
34 #include "string-stream.h" 33 #include "string-stream.h"
35 #include "ast-inl.h" 34 #include "ast-inl.h"
36 #include "jump-target-inl.h" 35 #include "jump-target-inl.h"
37 36
38 namespace v8 { 37 namespace v8 {
39 namespace internal { 38 namespace internal {
40 39
41 40
(...skipping 29 matching lines...) Expand all
71 } 70 }
72 71
73 72
74 VariableProxy::VariableProxy(Handle<String> name, 73 VariableProxy::VariableProxy(Handle<String> name,
75 bool is_this, 74 bool is_this,
76 bool inside_with) 75 bool inside_with)
77 : name_(name), 76 : name_(name),
78 var_(NULL), 77 var_(NULL),
79 is_this_(is_this), 78 is_this_(is_this),
80 inside_with_(inside_with), 79 inside_with_(inside_with),
81 is_trivial_(false), 80 is_trivial_(false) {
82 reaching_definitions_(NULL),
83 is_primitive_(false) {
84 // names must be canonicalized for fast equality checks 81 // names must be canonicalized for fast equality checks
85 ASSERT(name->IsSymbol()); 82 ASSERT(name->IsSymbol());
86 } 83 }
87 84
88 85
89 VariableProxy::VariableProxy(bool is_this) 86 VariableProxy::VariableProxy(bool is_this)
90 : is_this_(is_this), 87 : is_this_(is_this) {
91 reaching_definitions_(NULL),
92 is_primitive_(false) {
93 } 88 }
94 89
95 90
96 void VariableProxy::BindTo(Variable* var) { 91 void VariableProxy::BindTo(Variable* var) {
97 ASSERT(var_ == NULL); // must be bound only once 92 ASSERT(var_ == NULL); // must be bound only once
98 ASSERT(var != NULL); // must bind 93 ASSERT(var != NULL); // must bind
99 ASSERT((is_this() && var->is_this()) || name_.is_identical_to(var->name())); 94 ASSERT((is_this() && var->is_this()) || name_.is_identical_to(var->name()));
100 // Ideally CONST-ness should match. However, this is very hard to achieve 95 // Ideally CONST-ness should match. However, this is very hard to achieve
101 // because we don't know the exact semantics of conflicting (const and 96 // because we don't know the exact semantics of conflicting (const and
102 // non-const) multiple variable declarations, const vars introduced via 97 // non-const) multiple variable declarations, const vars introduced via
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 return false; 225 return false;
231 break; 226 break;
232 } 227 }
233 default: 228 default:
234 UNREACHABLE(); 229 UNREACHABLE();
235 break; 230 break;
236 } 231 }
237 return false; 232 return false;
238 } 233 }
239 234
235
236 void Expression::CopyAnalysisResultsFrom(Expression* other) {
237 bitfields_ = other->bitfields_;
238 type_ = other->type_;
239 }
240
241
240 // ---------------------------------------------------------------------------- 242 // ----------------------------------------------------------------------------
241 // Implementation of AstVisitor 243 // Implementation of AstVisitor
242 244
243 bool AstVisitor::CheckStackOverflow() { 245 bool AstVisitor::CheckStackOverflow() {
244 if (stack_overflow_) return true; 246 if (stack_overflow_) return true;
245 StackLimitCheck check; 247 StackLimitCheck check;
246 if (!check.HasOverflowed()) return false; 248 if (!check.HasOverflowed()) return false;
247 return (stack_overflow_ = true); 249 return (stack_overflow_ = true);
248 } 250 }
249 251
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 min_match_ += node->min_match(); 570 min_match_ += node->min_match();
569 int node_max_match = node->max_match(); 571 int node_max_match = node->max_match();
570 if (kInfinity - max_match_ < node_max_match) { 572 if (kInfinity - max_match_ < node_max_match) {
571 max_match_ = kInfinity; 573 max_match_ = kInfinity;
572 } else { 574 } else {
573 max_match_ += node->max_match(); 575 max_match_ += node->max_match();
574 } 576 }
575 } 577 }
576 } 578 }
577 579
578 // IsPrimitive implementation. IsPrimitive is true if the value of an
579 // expression is known at compile-time to be any JS type other than Object
580 // (e.g, it is Undefined, Null, Boolean, String, or Number).
581
582 // The following expression types are never primitive because they express
583 // Object values.
584 bool FunctionLiteral::IsPrimitive() { return false; }
585 bool SharedFunctionInfoLiteral::IsPrimitive() { return false; }
586 bool RegExpLiteral::IsPrimitive() { return false; }
587 bool ObjectLiteral::IsPrimitive() { return false; }
588 bool ArrayLiteral::IsPrimitive() { return false; }
589 bool CatchExtensionObject::IsPrimitive() { return false; }
590 bool CallNew::IsPrimitive() { return false; }
591 bool ThisFunction::IsPrimitive() { return false; }
592
593
594 // The following expression types are not always primitive because we do not
595 // have enough information to conclude that they are.
596 bool Property::IsPrimitive() { return false; }
597 bool Call::IsPrimitive() { return false; }
598 bool CallRuntime::IsPrimitive() { return false; }
599
600
601 // A variable use is not primitive unless the primitive-type analysis
602 // determines otherwise.
603 bool VariableProxy::IsPrimitive() {
604 ASSERT(!is_primitive_ || (var() != NULL && var()->IsStackAllocated()));
605 return is_primitive_;
606 }
607
608 // The value of a conditional is the value of one of the alternatives. It's
609 // always primitive if both alternatives are always primitive.
610 bool Conditional::IsPrimitive() {
611 return then_expression()->IsPrimitive() && else_expression()->IsPrimitive();
612 }
613
614
615 // A literal is primitive when it is not a JSObject.
616 bool Literal::IsPrimitive() { return !handle()->IsJSObject(); }
617
618
619 // The value of an assignment is the value of its right-hand side.
620 bool Assignment::IsPrimitive() {
621 switch (op()) {
622 case Token::INIT_VAR:
623 case Token::INIT_CONST:
624 case Token::ASSIGN:
625 return value()->IsPrimitive();
626
627 default:
628 // {|=, ^=, &=, <<=, >>=, >>>=, +=, -=, *=, /=, %=}
629 // Arithmetic operations are always primitive. They express Numbers
630 // with the exception of +, which expresses a Number or a String.
631 return true;
632 }
633 }
634
635
636 // Throw does not express a value, so it's trivially always primitive.
637 bool Throw::IsPrimitive() { return true; }
638
639
640 // Unary operations always express primitive values. delete and ! express
641 // Booleans, void Undefined, typeof String, +, -, and ~ Numbers.
642 bool UnaryOperation::IsPrimitive() { return true; }
643
644
645 // Count operations (pre- and post-fix increment and decrement) always
646 // express primitive values (Numbers). See ECMA-262-3, 11.3.1, 11.3.2,
647 // 11.4.4, ane 11.4.5.
648 bool CountOperation::IsPrimitive() { return true; }
649
650
651 // Binary operations depend on the operator.
652 bool BinaryOperation::IsPrimitive() {
653 switch (op()) {
654 case Token::COMMA:
655 // Value is the value of the right subexpression.
656 return right()->IsPrimitive();
657
658 case Token::OR:
659 case Token::AND:
660 // Value is the value one of the subexpressions.
661 return left()->IsPrimitive() && right()->IsPrimitive();
662
663 default:
664 // {|, ^, &, <<, >>, >>>, +, -, *, /, %}
665 // Arithmetic operations are always primitive. They express Numbers
666 // with the exception of +, which expresses a Number or a String.
667 return true;
668 }
669 }
670
671
672 // Compare operations always express Boolean values.
673 bool CompareOperation::IsPrimitive() { return true; }
674
675
676 // Overridden IsCritical member functions. IsCritical is true for AST nodes
677 // whose evaluation is absolutely required (they are never dead) because
678 // they are externally visible.
679
680 // References to global variables or lookup slots are critical because they
681 // may have getters. All others, including parameters rewritten to explicit
682 // property references, are not critical.
683 bool VariableProxy::IsCritical() {
684 Variable* var = AsVariable();
685 return var != NULL &&
686 (var->slot() == NULL || var->slot()->type() == Slot::LOOKUP);
687 }
688
689
690 // Literals are never critical.
691 bool Literal::IsCritical() { return false; }
692
693
694 // Property assignments and throwing of reference errors are always
695 // critical. Assignments to escaping variables are also critical. In
696 // addition the operation of compound assignments is critical if either of
697 // its operands is non-primitive (the arithmetic operations all use one of
698 // ToPrimitive, ToNumber, ToInt32, or ToUint32 on each of their operands).
699 // In this case, we mark the entire AST node as critical because there is
700 // no binary operation node to mark.
701 bool Assignment::IsCritical() {
702 Variable* var = AssignedVariable();
703 return var == NULL ||
704 !var->IsStackAllocated() ||
705 (is_compound() && (!target()->IsPrimitive() || !value()->IsPrimitive()));
706 }
707
708
709 // Property references are always critical, because they may have getters.
710 bool Property::IsCritical() { return true; }
711
712
713 // Calls are always critical.
714 bool Call::IsCritical() { return true; }
715
716
717 // +,- use ToNumber on the value of their operand.
718 bool UnaryOperation::IsCritical() {
719 ASSERT(op() == Token::ADD || op() == Token::SUB);
720 return !expression()->IsPrimitive();
721 }
722
723
724 // Count operations targeting properties and reference errors are always
725 // critical. Count operations on escaping variables are critical. Count
726 // operations targeting non-primitives are also critical because they use
727 // ToNumber.
728 bool CountOperation::IsCritical() {
729 Variable* var = AssignedVariable();
730 return var == NULL ||
731 !var->IsStackAllocated() ||
732 !expression()->IsPrimitive();
733 }
734
735
736 // Arithmetic operations all use one of ToPrimitive, ToNumber, ToInt32, or
737 // ToUint32 on each of their operands.
738 bool BinaryOperation::IsCritical() {
739 ASSERT(op() != Token::COMMA);
740 ASSERT(op() != Token::OR);
741 ASSERT(op() != Token::AND);
742 return !left()->IsPrimitive() || !right()->IsPrimitive();
743 }
744
745
746 // <, >, <=, and >= all use ToPrimitive on both their operands.
747 bool CompareOperation::IsCritical() {
748 ASSERT(op() != Token::EQ);
749 ASSERT(op() != Token::NE);
750 ASSERT(op() != Token::EQ_STRICT);
751 ASSERT(op() != Token::NE_STRICT);
752 ASSERT(op() != Token::INSTANCEOF);
753 ASSERT(op() != Token::IN);
754 return !left()->IsPrimitive() || !right()->IsPrimitive();
755 }
756
757
758 // Implementation of a copy visitor. The visitor create a deep copy
759 // of ast nodes. Nodes that do not require a deep copy are copied
760 // with the default copy constructor.
761
762 AstNode::AstNode(AstNode* other) : num_(kNoNumber) {
763 // AST node number should be unique. Assert that we only copy AstNodes
764 // before node numbers are assigned.
765 ASSERT(other->num_ == kNoNumber);
766 }
767
768
769 Statement::Statement(Statement* other)
770 : AstNode(other), statement_pos_(other->statement_pos_) {}
771
772
773 Expression::Expression(Expression* other)
774 : AstNode(other),
775 bitfields_(other->bitfields_),
776 type_(other->type_) {}
777
778
779 BreakableStatement::BreakableStatement(BreakableStatement* other)
780 : Statement(other), labels_(other->labels_), type_(other->type_) {}
781
782
783 Block::Block(Block* other, ZoneList<Statement*>* statements)
784 : BreakableStatement(other),
785 statements_(statements->length()),
786 is_initializer_block_(other->is_initializer_block_) {
787 statements_.AddAll(*statements);
788 }
789
790 580
791 WhileStatement::WhileStatement(ZoneStringList* labels) 581 WhileStatement::WhileStatement(ZoneStringList* labels)
792 : IterationStatement(labels), 582 : IterationStatement(labels),
793 cond_(NULL), 583 cond_(NULL),
794 may_have_function_literal_(true) { 584 may_have_function_literal_(true) {
795 } 585 }
796 586
797 587
798 ExpressionStatement::ExpressionStatement(ExpressionStatement* other,
799 Expression* expression)
800 : Statement(other), expression_(expression) {}
801
802
803 IfStatement::IfStatement(IfStatement* other,
804 Expression* condition,
805 Statement* then_statement,
806 Statement* else_statement)
807 : Statement(other),
808 condition_(condition),
809 then_statement_(then_statement),
810 else_statement_(else_statement) {}
811
812
813 EmptyStatement::EmptyStatement(EmptyStatement* other) : Statement(other) {}
814
815
816 IterationStatement::IterationStatement(IterationStatement* other,
817 Statement* body)
818 : BreakableStatement(other), body_(body) {}
819
820
821 CaseClause::CaseClause(Expression* label, ZoneList<Statement*>* statements) 588 CaseClause::CaseClause(Expression* label, ZoneList<Statement*>* statements)
822 : label_(label), statements_(statements) { 589 : label_(label), statements_(statements) {
823 } 590 }
824 591
825
826 ForStatement::ForStatement(ForStatement* other,
827 Statement* init,
828 Expression* cond,
829 Statement* next,
830 Statement* body)
831 : IterationStatement(other, body),
832 init_(init),
833 cond_(cond),
834 next_(next),
835 may_have_function_literal_(other->may_have_function_literal_),
836 loop_variable_(other->loop_variable_),
837 peel_this_loop_(other->peel_this_loop_) {}
838
839
840 Assignment::Assignment(Assignment* other,
841 Expression* target,
842 Expression* value)
843 : Expression(other),
844 op_(other->op_),
845 target_(target),
846 value_(value),
847 pos_(other->pos_),
848 block_start_(other->block_start_),
849 block_end_(other->block_end_) {}
850
851
852 Property::Property(Property* other, Expression* obj, Expression* key)
853 : Expression(other),
854 obj_(obj),
855 key_(key),
856 pos_(other->pos_),
857 type_(other->type_) {}
858
859
860 Call::Call(Call* other,
861 Expression* expression,
862 ZoneList<Expression*>* arguments)
863 : Expression(other),
864 expression_(expression),
865 arguments_(arguments),
866 pos_(other->pos_) {}
867
868
869 UnaryOperation::UnaryOperation(UnaryOperation* other, Expression* expression)
870 : Expression(other), op_(other->op_), expression_(expression) {}
871
872
873 BinaryOperation::BinaryOperation(Expression* other,
874 Token::Value op,
875 Expression* left,
876 Expression* right)
877 : Expression(other), op_(op), left_(left), right_(right) {}
878
879
880 CountOperation::CountOperation(CountOperation* other, Expression* expression)
881 : Expression(other),
882 is_prefix_(other->is_prefix_),
883 op_(other->op_),
884 expression_(expression) {}
885
886
887 CompareOperation::CompareOperation(CompareOperation* other,
888 Expression* left,
889 Expression* right)
890 : Expression(other),
891 op_(other->op_),
892 left_(left),
893 right_(right) {}
894
895
896 Expression* CopyAstVisitor::DeepCopyExpr(Expression* expr) {
897 expr_ = NULL;
898 if (expr != NULL) Visit(expr);
899 return expr_;
900 }
901
902
903 Statement* CopyAstVisitor::DeepCopyStmt(Statement* stmt) {
904 stmt_ = NULL;
905 if (stmt != NULL) Visit(stmt);
906 return stmt_;
907 }
908
909
910 ZoneList<Expression*>* CopyAstVisitor::DeepCopyExprList(
911 ZoneList<Expression*>* expressions) {
912 ZoneList<Expression*>* copy =
913 new ZoneList<Expression*>(expressions->length());
914 for (int i = 0; i < expressions->length(); i++) {
915 copy->Add(DeepCopyExpr(expressions->at(i)));
916 }
917 return copy;
918 }
919
920
921 ZoneList<Statement*>* CopyAstVisitor::DeepCopyStmtList(
922 ZoneList<Statement*>* statements) {
923 ZoneList<Statement*>* copy = new ZoneList<Statement*>(statements->length());
924 for (int i = 0; i < statements->length(); i++) {
925 copy->Add(DeepCopyStmt(statements->at(i)));
926 }
927 return copy;
928 }
929
930
931 void CopyAstVisitor::VisitBlock(Block* stmt) {
932 stmt_ = new Block(stmt,
933 DeepCopyStmtList(stmt->statements()));
934 }
935
936
937 void CopyAstVisitor::VisitExpressionStatement(
938 ExpressionStatement* stmt) {
939 stmt_ = new ExpressionStatement(stmt, DeepCopyExpr(stmt->expression()));
940 }
941
942
943 void CopyAstVisitor::VisitEmptyStatement(EmptyStatement* stmt) {
944 stmt_ = new EmptyStatement(stmt);
945 }
946
947
948 void CopyAstVisitor::VisitIfStatement(IfStatement* stmt) {
949 stmt_ = new IfStatement(stmt,
950 DeepCopyExpr(stmt->condition()),
951 DeepCopyStmt(stmt->then_statement()),
952 DeepCopyStmt(stmt->else_statement()));
953 }
954
955
956 void CopyAstVisitor::VisitContinueStatement(ContinueStatement* stmt) {
957 SetStackOverflow();
958 }
959
960
961 void CopyAstVisitor::VisitBreakStatement(BreakStatement* stmt) {
962 SetStackOverflow();
963 }
964
965
966 void CopyAstVisitor::VisitReturnStatement(ReturnStatement* stmt) {
967 SetStackOverflow();
968 }
969
970
971 void CopyAstVisitor::VisitWithEnterStatement(
972 WithEnterStatement* stmt) {
973 SetStackOverflow();
974 }
975
976
977 void CopyAstVisitor::VisitWithExitStatement(WithExitStatement* stmt) {
978 SetStackOverflow();
979 }
980
981
982 void CopyAstVisitor::VisitSwitchStatement(SwitchStatement* stmt) {
983 SetStackOverflow();
984 }
985
986
987 void CopyAstVisitor::VisitDoWhileStatement(DoWhileStatement* stmt) {
988 SetStackOverflow();
989 }
990
991
992 void CopyAstVisitor::VisitWhileStatement(WhileStatement* stmt) {
993 SetStackOverflow();
994 }
995
996
997 void CopyAstVisitor::VisitForStatement(ForStatement* stmt) {
998 stmt_ = new ForStatement(stmt,
999 DeepCopyStmt(stmt->init()),
1000 DeepCopyExpr(stmt->cond()),
1001 DeepCopyStmt(stmt->next()),
1002 DeepCopyStmt(stmt->body()));
1003 }
1004
1005
1006 void CopyAstVisitor::VisitForInStatement(ForInStatement* stmt) {
1007 SetStackOverflow();
1008 }
1009
1010
1011 void CopyAstVisitor::VisitTryCatchStatement(TryCatchStatement* stmt) {
1012 SetStackOverflow();
1013 }
1014
1015
1016 void CopyAstVisitor::VisitTryFinallyStatement(
1017 TryFinallyStatement* stmt) {
1018 SetStackOverflow();
1019 }
1020
1021
1022 void CopyAstVisitor::VisitDebuggerStatement(
1023 DebuggerStatement* stmt) {
1024 SetStackOverflow();
1025 }
1026
1027
1028 void CopyAstVisitor::VisitFunctionLiteral(FunctionLiteral* expr) {
1029 SetStackOverflow();
1030 }
1031
1032
1033 void CopyAstVisitor::VisitSharedFunctionInfoLiteral(
1034 SharedFunctionInfoLiteral* expr) {
1035 SetStackOverflow();
1036 }
1037
1038
1039 void CopyAstVisitor::VisitConditional(Conditional* expr) {
1040 SetStackOverflow();
1041 }
1042
1043
1044 void CopyAstVisitor::VisitSlot(Slot* expr) {
1045 UNREACHABLE();
1046 }
1047
1048
1049 void CopyAstVisitor::VisitVariableProxy(VariableProxy* expr) {
1050 expr_ = new VariableProxy(*expr);
1051 }
1052
1053
1054 void CopyAstVisitor::VisitLiteral(Literal* expr) {
1055 expr_ = new Literal(*expr);
1056 }
1057
1058
1059 void CopyAstVisitor::VisitRegExpLiteral(RegExpLiteral* expr) {
1060 SetStackOverflow();
1061 }
1062
1063
1064 void CopyAstVisitor::VisitObjectLiteral(ObjectLiteral* expr) {
1065 SetStackOverflow();
1066 }
1067
1068
1069 void CopyAstVisitor::VisitArrayLiteral(ArrayLiteral* expr) {
1070 SetStackOverflow();
1071 }
1072
1073
1074 void CopyAstVisitor::VisitCatchExtensionObject(
1075 CatchExtensionObject* expr) {
1076 SetStackOverflow();
1077 }
1078
1079
1080 void CopyAstVisitor::VisitAssignment(Assignment* expr) {
1081 expr_ = new Assignment(expr,
1082 DeepCopyExpr(expr->target()),
1083 DeepCopyExpr(expr->value()));
1084 }
1085
1086
1087 void CopyAstVisitor::VisitThrow(Throw* expr) {
1088 SetStackOverflow();
1089 }
1090
1091
1092 void CopyAstVisitor::VisitProperty(Property* expr) {
1093 expr_ = new Property(expr,
1094 DeepCopyExpr(expr->obj()),
1095 DeepCopyExpr(expr->key()));
1096 }
1097
1098
1099 void CopyAstVisitor::VisitCall(Call* expr) {
1100 expr_ = new Call(expr,
1101 DeepCopyExpr(expr->expression()),
1102 DeepCopyExprList(expr->arguments()));
1103 }
1104
1105
1106 void CopyAstVisitor::VisitCallNew(CallNew* expr) {
1107 SetStackOverflow();
1108 }
1109
1110
1111 void CopyAstVisitor::VisitCallRuntime(CallRuntime* expr) {
1112 SetStackOverflow();
1113 }
1114
1115
1116 void CopyAstVisitor::VisitUnaryOperation(UnaryOperation* expr) {
1117 expr_ = new UnaryOperation(expr, DeepCopyExpr(expr->expression()));
1118 }
1119
1120
1121 void CopyAstVisitor::VisitCountOperation(CountOperation* expr) {
1122 expr_ = new CountOperation(expr,
1123 DeepCopyExpr(expr->expression()));
1124 }
1125
1126
1127 void CopyAstVisitor::VisitBinaryOperation(BinaryOperation* expr) {
1128 expr_ = new BinaryOperation(expr,
1129 expr->op(),
1130 DeepCopyExpr(expr->left()),
1131 DeepCopyExpr(expr->right()));
1132 }
1133
1134
1135 void CopyAstVisitor::VisitCompareOperation(CompareOperation* expr) {
1136 expr_ = new CompareOperation(expr,
1137 DeepCopyExpr(expr->left()),
1138 DeepCopyExpr(expr->right()));
1139 }
1140
1141
1142 void CopyAstVisitor::VisitThisFunction(ThisFunction* expr) {
1143 SetStackOverflow();
1144 }
1145
1146
1147 void CopyAstVisitor::VisitDeclaration(Declaration* decl) {
1148 UNREACHABLE();
1149 }
1150
1151
1152 } } // namespace v8::internal 592 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ast.h ('k') | src/ast-inl.h » ('j') | src/x64/full-codegen-x64.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698