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

Side by Side Diff: src/ast.cc

Issue 564203003: Exact black-list of AST nodes for TurboFan. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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
« no previous file with comments | « src/ast.h ('k') | test/cctest/cctest.status » ('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 979 matching lines...) Expand 10 before | Expand all | Expand 10 after
990 CaseClause::CaseClause(Zone* zone, Expression* label, 990 CaseClause::CaseClause(Zone* zone, Expression* label,
991 ZoneList<Statement*>* statements, int pos, IdGen* id_gen) 991 ZoneList<Statement*>* statements, int pos, IdGen* id_gen)
992 : Expression(zone, pos, id_gen), 992 : Expression(zone, pos, id_gen),
993 label_(label), 993 label_(label),
994 statements_(statements), 994 statements_(statements),
995 compare_type_(Type::None(zone)), 995 compare_type_(Type::None(zone)),
996 compare_id_(id_gen->GetNextId()), 996 compare_id_(id_gen->GetNextId()),
997 entry_id_(id_gen->GetNextId()) {} 997 entry_id_(id_gen->GetNextId()) {}
998 998
999 999
1000 #define REGULAR_NODE(NodeType) \ 1000 #define REGULAR_NODE(NodeType) \
1001 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ 1001 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \
1002 increase_node_count(); \ 1002 increase_node_count(); \
1003 } 1003 }
1004 #define REGULAR_NODE_WITH_FEEDBACK_SLOTS(NodeType) \ 1004 #define REGULAR_NODE_WITH_FEEDBACK_SLOTS(NodeType) \
1005 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ 1005 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \
1006 increase_node_count(); \ 1006 increase_node_count(); \
1007 add_slot_node(node); \ 1007 add_slot_node(node); \
1008 } 1008 }
1009 #define DONT_OPTIMIZE_NODE(NodeType) \ 1009 #define DONT_OPTIMIZE_NODE(NodeType) \
1010 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ 1010 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \
1011 increase_node_count(); \ 1011 increase_node_count(); \
1012 set_dont_optimize_reason(k##NodeType); \ 1012 set_dont_crankshaft_reason(k##NodeType); \
1013 add_flag(kDontSelfOptimize); \ 1013 add_flag(kDontSelfOptimize); \
1014 } 1014 }
1015 #define DONT_OPTIMIZE_NODE_WITH_FEEDBACK_SLOTS(NodeType) \ 1015 #define DONT_OPTIMIZE_NODE_WITH_FEEDBACK_SLOTS(NodeType) \
1016 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ 1016 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \
1017 increase_node_count(); \ 1017 increase_node_count(); \
1018 add_slot_node(node); \ 1018 add_slot_node(node); \
1019 set_dont_optimize_reason(k##NodeType); \ 1019 set_dont_crankshaft_reason(k##NodeType); \
1020 add_flag(kDontSelfOptimize); \ 1020 add_flag(kDontSelfOptimize); \
1021 }
1022 #define DONT_TURBOFAN_NODE(NodeType) \
1023 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \
1024 increase_node_count(); \
1025 set_dont_crankshaft_reason(k##NodeType); \
1026 set_dont_turbofan_reason(k##NodeType); \
1027 add_flag(kDontSelfOptimize); \
1021 } 1028 }
1022 #define DONT_SELFOPTIMIZE_NODE(NodeType) \ 1029 #define DONT_SELFOPTIMIZE_NODE(NodeType) \
1023 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ 1030 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \
1024 increase_node_count(); \ 1031 increase_node_count(); \
1025 add_flag(kDontSelfOptimize); \ 1032 add_flag(kDontSelfOptimize); \
1026 } 1033 }
1027 #define DONT_SELFOPTIMIZE_NODE_WITH_FEEDBACK_SLOTS(NodeType) \ 1034 #define DONT_SELFOPTIMIZE_NODE_WITH_FEEDBACK_SLOTS(NodeType) \
1028 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ 1035 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \
1029 increase_node_count(); \ 1036 increase_node_count(); \
1030 add_slot_node(node); \ 1037 add_slot_node(node); \
1031 add_flag(kDontSelfOptimize); \ 1038 add_flag(kDontSelfOptimize); \
1032 } 1039 }
1033 #define DONT_CACHE_NODE(NodeType) \ 1040 #define DONT_CACHE_NODE(NodeType) \
1034 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ 1041 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \
1035 increase_node_count(); \ 1042 increase_node_count(); \
1036 set_dont_optimize_reason(k##NodeType); \ 1043 set_dont_crankshaft_reason(k##NodeType); \
1037 add_flag(kDontSelfOptimize); \ 1044 add_flag(kDontSelfOptimize); \
1038 add_flag(kDontCache); \ 1045 add_flag(kDontCache); \
1039 } 1046 }
1040 1047
1041 REGULAR_NODE(VariableDeclaration) 1048 REGULAR_NODE(VariableDeclaration)
1042 REGULAR_NODE(FunctionDeclaration) 1049 REGULAR_NODE(FunctionDeclaration)
1043 REGULAR_NODE(Block) 1050 REGULAR_NODE(Block)
1044 REGULAR_NODE(ExpressionStatement) 1051 REGULAR_NODE(ExpressionStatement)
1045 REGULAR_NODE(EmptyStatement) 1052 REGULAR_NODE(EmptyStatement)
1046 REGULAR_NODE(IfStatement) 1053 REGULAR_NODE(IfStatement)
1047 REGULAR_NODE(ContinueStatement) 1054 REGULAR_NODE(ContinueStatement)
1048 REGULAR_NODE(BreakStatement) 1055 REGULAR_NODE(BreakStatement)
(...skipping 26 matching lines...) Expand all
1075 1082
1076 // We currently do not optimize any modules. 1083 // We currently do not optimize any modules.
1077 DONT_OPTIMIZE_NODE(ModuleDeclaration) 1084 DONT_OPTIMIZE_NODE(ModuleDeclaration)
1078 DONT_OPTIMIZE_NODE(ImportDeclaration) 1085 DONT_OPTIMIZE_NODE(ImportDeclaration)
1079 DONT_OPTIMIZE_NODE(ExportDeclaration) 1086 DONT_OPTIMIZE_NODE(ExportDeclaration)
1080 DONT_OPTIMIZE_NODE(ModuleVariable) 1087 DONT_OPTIMIZE_NODE(ModuleVariable)
1081 DONT_OPTIMIZE_NODE(ModulePath) 1088 DONT_OPTIMIZE_NODE(ModulePath)
1082 DONT_OPTIMIZE_NODE(ModuleUrl) 1089 DONT_OPTIMIZE_NODE(ModuleUrl)
1083 DONT_OPTIMIZE_NODE(ModuleStatement) 1090 DONT_OPTIMIZE_NODE(ModuleStatement)
1084 DONT_OPTIMIZE_NODE(WithStatement) 1091 DONT_OPTIMIZE_NODE(WithStatement)
1085 DONT_OPTIMIZE_NODE(ForOfStatement)
1086 DONT_OPTIMIZE_NODE(TryCatchStatement)
1087 DONT_OPTIMIZE_NODE(TryFinallyStatement)
1088 DONT_OPTIMIZE_NODE(DebuggerStatement) 1092 DONT_OPTIMIZE_NODE(DebuggerStatement)
1089 DONT_OPTIMIZE_NODE(NativeFunctionLiteral) 1093 DONT_OPTIMIZE_NODE(NativeFunctionLiteral)
1090 DONT_OPTIMIZE_NODE(SuperReference) 1094 DONT_OPTIMIZE_NODE(SuperReference)
1091 1095
1092 DONT_OPTIMIZE_NODE_WITH_FEEDBACK_SLOTS(Yield) 1096 DONT_OPTIMIZE_NODE_WITH_FEEDBACK_SLOTS(Yield)
1093 1097
1098 // TODO(turbofan): Remove the dont_turbofan_reason once this list is empty.
1099 DONT_TURBOFAN_NODE(ForOfStatement)
1100 DONT_TURBOFAN_NODE(TryCatchStatement)
1101 DONT_TURBOFAN_NODE(TryFinallyStatement)
1102
1094 DONT_SELFOPTIMIZE_NODE(DoWhileStatement) 1103 DONT_SELFOPTIMIZE_NODE(DoWhileStatement)
1095 DONT_SELFOPTIMIZE_NODE(WhileStatement) 1104 DONT_SELFOPTIMIZE_NODE(WhileStatement)
1096 DONT_SELFOPTIMIZE_NODE(ForStatement) 1105 DONT_SELFOPTIMIZE_NODE(ForStatement)
1097 1106
1098 DONT_SELFOPTIMIZE_NODE_WITH_FEEDBACK_SLOTS(ForInStatement) 1107 DONT_SELFOPTIMIZE_NODE_WITH_FEEDBACK_SLOTS(ForInStatement)
1099 1108
1100 DONT_CACHE_NODE(ModuleLiteral) 1109 DONT_CACHE_NODE(ModuleLiteral)
1101 1110
1102 1111
1103 void AstConstructionVisitor::VisitCallRuntime(CallRuntime* node) { 1112 void AstConstructionVisitor::VisitCallRuntime(CallRuntime* node) {
1104 increase_node_count(); 1113 increase_node_count();
1105 add_slot_node(node); 1114 add_slot_node(node);
1106 if (node->is_jsruntime()) { 1115 if (node->is_jsruntime()) {
1107 // 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.
1108 set_dont_optimize_reason(kCallToAJavaScriptRuntimeFunction); 1117 set_dont_crankshaft_reason(kCallToAJavaScriptRuntimeFunction);
1109 } 1118 }
1110 } 1119 }
1111 1120
1112 #undef REGULAR_NODE 1121 #undef REGULAR_NODE
1113 #undef DONT_OPTIMIZE_NODE 1122 #undef DONT_OPTIMIZE_NODE
1114 #undef DONT_SELFOPTIMIZE_NODE 1123 #undef DONT_SELFOPTIMIZE_NODE
1115 #undef DONT_CACHE_NODE 1124 #undef DONT_CACHE_NODE
1116 1125
1117 1126
1118 Handle<String> Literal::ToString() { 1127 Handle<String> Literal::ToString() {
1119 if (value_->IsString()) return value_->AsString()->string(); 1128 if (value_->IsString()) return value_->AsString()->string();
1120 DCHECK(value_->IsNumber()); 1129 DCHECK(value_->IsNumber());
1121 char arr[100]; 1130 char arr[100];
1122 Vector<char> buffer(arr, arraysize(arr)); 1131 Vector<char> buffer(arr, arraysize(arr));
1123 const char* str; 1132 const char* str;
1124 if (value()->IsSmi()) { 1133 if (value()->IsSmi()) {
1125 // Optimization only, the heap number case would subsume this. 1134 // Optimization only, the heap number case would subsume this.
1126 SNPrintF(buffer, "%d", Smi::cast(*value())->value()); 1135 SNPrintF(buffer, "%d", Smi::cast(*value())->value());
1127 str = arr; 1136 str = arr;
1128 } else { 1137 } else {
1129 str = DoubleToCString(value()->Number(), buffer); 1138 str = DoubleToCString(value()->Number(), buffer);
1130 } 1139 }
1131 return isolate_->factory()->NewStringFromAsciiChecked(str); 1140 return isolate_->factory()->NewStringFromAsciiChecked(str);
1132 } 1141 }
1133 1142
1134 1143
1135 } } // namespace v8::internal 1144 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ast.h ('k') | test/cctest/cctest.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698