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

Side by Side Diff: src/ast.cc

Issue 675493002: Move AST node counting to post-pass (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix nits Created 6 years, 1 month 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 | « src/ast.h ('k') | src/ast-numbering.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/ast.h" 5 #include "src/ast.h"
6 6
7 #include <cmath> // For isfinite. 7 #include <cmath> // For isfinite.
8 #include "src/builtins.h" 8 #include "src/builtins.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/contexts.h" 10 #include "src/contexts.h"
(...skipping 980 matching lines...) Expand 10 before | Expand all | Expand 10 after
991 CaseClause::CaseClause(Zone* zone, Expression* label, 991 CaseClause::CaseClause(Zone* zone, Expression* label,
992 ZoneList<Statement*>* statements, int pos) 992 ZoneList<Statement*>* statements, int pos)
993 : Expression(zone, pos), 993 : Expression(zone, pos),
994 label_(label), 994 label_(label),
995 statements_(statements), 995 statements_(statements),
996 compare_type_(Type::None(zone)) {} 996 compare_type_(Type::None(zone)) {}
997 997
998 998
999 #define REGULAR_NODE(NodeType) \ 999 #define REGULAR_NODE(NodeType) \
1000 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ 1000 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \
1001 increase_node_count(); \
1002 } 1001 }
1003 #define REGULAR_NODE_WITH_FEEDBACK_SLOTS(NodeType) \ 1002 #define REGULAR_NODE_WITH_FEEDBACK_SLOTS(NodeType) \
1004 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ 1003 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \
1005 increase_node_count(); \
1006 add_slot_node(node); \ 1004 add_slot_node(node); \
1007 } 1005 }
1008 #define DONT_OPTIMIZE_NODE(NodeType) \ 1006 #define DONT_OPTIMIZE_NODE(NodeType) \
1009 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ 1007 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \
1010 increase_node_count(); \
1011 set_dont_crankshaft_reason(k##NodeType); \ 1008 set_dont_crankshaft_reason(k##NodeType); \
1012 add_flag(kDontSelfOptimize); \ 1009 add_flag(kDontSelfOptimize); \
1013 } 1010 }
1014 #define DONT_OPTIMIZE_NODE_WITH_FEEDBACK_SLOTS(NodeType) \ 1011 #define DONT_OPTIMIZE_NODE_WITH_FEEDBACK_SLOTS(NodeType) \
1015 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ 1012 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \
1016 increase_node_count(); \
1017 add_slot_node(node); \ 1013 add_slot_node(node); \
1018 set_dont_crankshaft_reason(k##NodeType); \ 1014 set_dont_crankshaft_reason(k##NodeType); \
1019 add_flag(kDontSelfOptimize); \ 1015 add_flag(kDontSelfOptimize); \
1020 } 1016 }
1021 #define DONT_TURBOFAN_NODE(NodeType) \ 1017 #define DONT_TURBOFAN_NODE(NodeType) \
1022 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ 1018 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \
1023 increase_node_count(); \
1024 set_dont_crankshaft_reason(k##NodeType); \ 1019 set_dont_crankshaft_reason(k##NodeType); \
1025 set_dont_turbofan_reason(k##NodeType); \ 1020 set_dont_turbofan_reason(k##NodeType); \
1026 add_flag(kDontSelfOptimize); \ 1021 add_flag(kDontSelfOptimize); \
1027 } 1022 }
1028 #define DONT_TURBOFAN_NODE_WITH_FEEDBACK_SLOTS(NodeType) \ 1023 #define DONT_TURBOFAN_NODE_WITH_FEEDBACK_SLOTS(NodeType) \
1029 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ 1024 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \
1030 increase_node_count(); \
1031 add_slot_node(node); \ 1025 add_slot_node(node); \
1032 set_dont_crankshaft_reason(k##NodeType); \ 1026 set_dont_crankshaft_reason(k##NodeType); \
1033 set_dont_turbofan_reason(k##NodeType); \ 1027 set_dont_turbofan_reason(k##NodeType); \
1034 add_flag(kDontSelfOptimize); \ 1028 add_flag(kDontSelfOptimize); \
1035 } 1029 }
1036 #define DONT_SELFOPTIMIZE_NODE(NodeType) \ 1030 #define DONT_SELFOPTIMIZE_NODE(NodeType) \
1037 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ 1031 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \
1038 increase_node_count(); \
1039 add_flag(kDontSelfOptimize); \ 1032 add_flag(kDontSelfOptimize); \
1040 } 1033 }
1041 #define DONT_SELFOPTIMIZE_NODE_WITH_FEEDBACK_SLOTS(NodeType) \ 1034 #define DONT_SELFOPTIMIZE_NODE_WITH_FEEDBACK_SLOTS(NodeType) \
1042 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ 1035 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \
1043 increase_node_count(); \
1044 add_slot_node(node); \ 1036 add_slot_node(node); \
1045 add_flag(kDontSelfOptimize); \ 1037 add_flag(kDontSelfOptimize); \
1046 } 1038 }
1047 #define DONT_CACHE_NODE(NodeType) \ 1039 #define DONT_CACHE_NODE(NodeType) \
1048 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ 1040 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \
1049 increase_node_count(); \
1050 set_dont_crankshaft_reason(k##NodeType); \ 1041 set_dont_crankshaft_reason(k##NodeType); \
1051 add_flag(kDontSelfOptimize); \ 1042 add_flag(kDontSelfOptimize); \
1052 add_flag(kDontCache); \ 1043 add_flag(kDontCache); \
1053 } 1044 }
1054 1045
1055 REGULAR_NODE(VariableDeclaration) 1046 REGULAR_NODE(VariableDeclaration)
1056 REGULAR_NODE(FunctionDeclaration) 1047 REGULAR_NODE(FunctionDeclaration)
1057 REGULAR_NODE(Block) 1048 REGULAR_NODE(Block)
1058 REGULAR_NODE(ExpressionStatement) 1049 REGULAR_NODE(ExpressionStatement)
1059 REGULAR_NODE(EmptyStatement) 1050 REGULAR_NODE(EmptyStatement)
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
1113 DONT_SELFOPTIMIZE_NODE(DoWhileStatement) 1104 DONT_SELFOPTIMIZE_NODE(DoWhileStatement)
1114 DONT_SELFOPTIMIZE_NODE(WhileStatement) 1105 DONT_SELFOPTIMIZE_NODE(WhileStatement)
1115 DONT_SELFOPTIMIZE_NODE(ForStatement) 1106 DONT_SELFOPTIMIZE_NODE(ForStatement)
1116 1107
1117 DONT_SELFOPTIMIZE_NODE_WITH_FEEDBACK_SLOTS(ForInStatement) 1108 DONT_SELFOPTIMIZE_NODE_WITH_FEEDBACK_SLOTS(ForInStatement)
1118 1109
1119 DONT_CACHE_NODE(ModuleLiteral) 1110 DONT_CACHE_NODE(ModuleLiteral)
1120 1111
1121 1112
1122 void AstConstructionVisitor::VisitCallRuntime(CallRuntime* node) { 1113 void AstConstructionVisitor::VisitCallRuntime(CallRuntime* node) {
1123 increase_node_count();
1124 add_slot_node(node); 1114 add_slot_node(node);
1125 if (node->is_jsruntime()) { 1115 if (node->is_jsruntime()) {
1126 // Don't try to optimize JS runtime calls because we bailout on them. 1116 // Don't try to optimize JS runtime calls because we bailout on them.
1127 set_dont_crankshaft_reason(kCallToAJavaScriptRuntimeFunction); 1117 set_dont_crankshaft_reason(kCallToAJavaScriptRuntimeFunction);
1128 } 1118 }
1129 } 1119 }
1130 1120
1131 #undef REGULAR_NODE 1121 #undef REGULAR_NODE
1132 #undef DONT_OPTIMIZE_NODE 1122 #undef DONT_OPTIMIZE_NODE
1133 #undef DONT_SELFOPTIMIZE_NODE 1123 #undef DONT_SELFOPTIMIZE_NODE
(...skipping 10 matching lines...) Expand all
1144 // static 1134 // static
1145 bool Literal::Match(void* literal1, void* literal2) { 1135 bool Literal::Match(void* literal1, void* literal2) {
1146 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); 1136 const AstValue* x = static_cast<Literal*>(literal1)->raw_value();
1147 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); 1137 const AstValue* y = static_cast<Literal*>(literal2)->raw_value();
1148 return (x->IsString() && y->IsString() && *x->AsString() == *y->AsString()) || 1138 return (x->IsString() && y->IsString() && *x->AsString() == *y->AsString()) ||
1149 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); 1139 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber());
1150 } 1140 }
1151 1141
1152 1142
1153 } } // namespace v8::internal 1143 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ast.h ('k') | src/ast-numbering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698