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

Side by Side Diff: src/ast.cc

Issue 398053002: Introduce FLAG_vector_ics. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Register passed in hydrogen, fixed some test failures. Created 6 years, 5 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 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 var_proxy->raw_name()->IsOneByteEqualTo("undefined"); 58 var_proxy->raw_name()->IsOneByteEqualTo("undefined");
59 } 59 }
60 60
61 61
62 VariableProxy::VariableProxy(Zone* zone, Variable* var, int position) 62 VariableProxy::VariableProxy(Zone* zone, Variable* var, int position)
63 : Expression(zone, position), 63 : Expression(zone, position),
64 name_(var->raw_name()), 64 name_(var->raw_name()),
65 var_(NULL), // Will be set by the call to BindTo. 65 var_(NULL), // Will be set by the call to BindTo.
66 is_this_(var->is_this()), 66 is_this_(var->is_this()),
67 is_assigned_(false), 67 is_assigned_(false),
68 interface_(var->interface()) { 68 interface_(var->interface()),
69 variable_feedback_slot_(kInvalidFeedbackSlot) {
69 BindTo(var); 70 BindTo(var);
70 } 71 }
71 72
72 73
73 VariableProxy::VariableProxy(Zone* zone, 74 VariableProxy::VariableProxy(Zone* zone,
74 const AstRawString* name, 75 const AstRawString* name,
75 bool is_this, 76 bool is_this,
76 Interface* interface, 77 Interface* interface,
77 int position) 78 int position)
78 : Expression(zone, position), 79 : Expression(zone, position),
79 name_(name), 80 name_(name),
80 var_(NULL), 81 var_(NULL),
81 is_this_(is_this), 82 is_this_(is_this),
82 is_assigned_(false), 83 is_assigned_(false),
83 interface_(interface) { 84 interface_(interface),
85 variable_feedback_slot_(kInvalidFeedbackSlot) {
84 } 86 }
85 87
86 88
87 void VariableProxy::BindTo(Variable* var) { 89 void VariableProxy::BindTo(Variable* var) {
88 ASSERT(var_ == NULL); // must be bound only once 90 ASSERT(var_ == NULL); // must be bound only once
89 ASSERT(var != NULL); // must bind 91 ASSERT(var != NULL); // must bind
90 ASSERT(!FLAG_harmony_modules || interface_->IsUnified(var->interface())); 92 ASSERT(!FLAG_harmony_modules || interface_->IsUnified(var->interface()));
91 ASSERT((is_this() && var->is_this()) || name_ == var->raw_name()); 93 ASSERT((is_this() && var->is_this()) || name_ == var->raw_name());
92 // Ideally CONST-ness should match. However, this is very hard to achieve 94 // Ideally CONST-ness should match. However, this is very hard to achieve
93 // because we don't know the exact semantics of conflicting (const and 95 // because we don't know the exact semantics of conflicting (const and
(...skipping 929 matching lines...) Expand 10 before | Expand all | Expand 10 after
1023 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ 1025 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \
1024 increase_node_count(); \ 1026 increase_node_count(); \
1025 add_slot_node(node); \ 1027 add_slot_node(node); \
1026 } 1028 }
1027 #define DONT_OPTIMIZE_NODE(NodeType) \ 1029 #define DONT_OPTIMIZE_NODE(NodeType) \
1028 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ 1030 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \
1029 increase_node_count(); \ 1031 increase_node_count(); \
1030 set_dont_optimize_reason(k##NodeType); \ 1032 set_dont_optimize_reason(k##NodeType); \
1031 add_flag(kDontSelfOptimize); \ 1033 add_flag(kDontSelfOptimize); \
1032 } 1034 }
1033 #define DONT_SELFOPTIMIZE_NODE(NodeType) \ 1035 #define DONT_OPTIMIZE_NODE_WITH_FEEDBACK_SLOTS(NodeType) \
1036 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \
1037 increase_node_count(); \
1038 add_slot_node(node); \
1039 set_dont_optimize_reason(k##NodeType); \
1040 add_flag(kDontSelfOptimize); \
1041 }
1042 #define DONT_SELFOPTIMIZE_NODE(NodeType) \
1034 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ 1043 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \
1035 increase_node_count(); \ 1044 increase_node_count(); \
1036 add_flag(kDontSelfOptimize); \ 1045 add_flag(kDontSelfOptimize); \
1037 } 1046 }
1038 #define DONT_SELFOPTIMIZE_NODE_WITH_FEEDBACK_SLOTS(NodeType) \ 1047 #define DONT_SELFOPTIMIZE_NODE_WITH_FEEDBACK_SLOTS(NodeType) \
1039 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ 1048 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \
1040 increase_node_count(); \ 1049 increase_node_count(); \
1041 add_slot_node(node); \ 1050 add_slot_node(node); \
1042 add_flag(kDontSelfOptimize); \ 1051 add_flag(kDontSelfOptimize); \
1043 } 1052 }
(...skipping 17 matching lines...) Expand all
1061 REGULAR_NODE(SwitchStatement) 1070 REGULAR_NODE(SwitchStatement)
1062 REGULAR_NODE(CaseClause) 1071 REGULAR_NODE(CaseClause)
1063 REGULAR_NODE(Conditional) 1072 REGULAR_NODE(Conditional)
1064 REGULAR_NODE(Literal) 1073 REGULAR_NODE(Literal)
1065 REGULAR_NODE(ArrayLiteral) 1074 REGULAR_NODE(ArrayLiteral)
1066 REGULAR_NODE(ObjectLiteral) 1075 REGULAR_NODE(ObjectLiteral)
1067 REGULAR_NODE(RegExpLiteral) 1076 REGULAR_NODE(RegExpLiteral)
1068 REGULAR_NODE(FunctionLiteral) 1077 REGULAR_NODE(FunctionLiteral)
1069 REGULAR_NODE(Assignment) 1078 REGULAR_NODE(Assignment)
1070 REGULAR_NODE(Throw) 1079 REGULAR_NODE(Throw)
1071 REGULAR_NODE(Property) 1080 REGULAR_NODE_WITH_FEEDBACK_SLOTS(Property)
1072 REGULAR_NODE(UnaryOperation) 1081 REGULAR_NODE(UnaryOperation)
1073 REGULAR_NODE(CountOperation) 1082 REGULAR_NODE(CountOperation)
1074 REGULAR_NODE(BinaryOperation) 1083 REGULAR_NODE(BinaryOperation)
1075 REGULAR_NODE(CompareOperation) 1084 REGULAR_NODE(CompareOperation)
1076 REGULAR_NODE(ThisFunction) 1085 REGULAR_NODE(ThisFunction)
1077 REGULAR_NODE_WITH_FEEDBACK_SLOTS(Call) 1086 REGULAR_NODE_WITH_FEEDBACK_SLOTS(Call)
1078 REGULAR_NODE_WITH_FEEDBACK_SLOTS(CallNew) 1087 REGULAR_NODE_WITH_FEEDBACK_SLOTS(CallNew)
1079 // In theory, for VariableProxy we'd have to add: 1088 // In theory, for VariableProxy we'd have to add:
1080 // if (node->var()->IsLookupSlot()) 1089 // if (node->var()->IsLookupSlot())
1081 // set_dont_optimize_reason(kReferenceToAVariableWhichRequiresDynamicLookup); 1090 // set_dont_optimize_reason(kReferenceToAVariableWhichRequiresDynamicLookup);
1082 // But node->var() is usually not bound yet at VariableProxy creation time, and 1091 // But node->var() is usually not bound yet at VariableProxy creation time, and
1083 // LOOKUP variables only result from constructs that cannot be inlined anyway. 1092 // LOOKUP variables only result from constructs that cannot be inlined anyway.
1084 REGULAR_NODE(VariableProxy) 1093
1094 REGULAR_NODE_WITH_FEEDBACK_SLOTS(VariableProxy)
1085 1095
1086 // We currently do not optimize any modules. 1096 // We currently do not optimize any modules.
1087 DONT_OPTIMIZE_NODE(ModuleDeclaration) 1097 DONT_OPTIMIZE_NODE(ModuleDeclaration)
1088 DONT_OPTIMIZE_NODE(ImportDeclaration) 1098 DONT_OPTIMIZE_NODE(ImportDeclaration)
1089 DONT_OPTIMIZE_NODE(ExportDeclaration) 1099 DONT_OPTIMIZE_NODE(ExportDeclaration)
1090 DONT_OPTIMIZE_NODE(ModuleVariable) 1100 DONT_OPTIMIZE_NODE(ModuleVariable)
1091 DONT_OPTIMIZE_NODE(ModulePath) 1101 DONT_OPTIMIZE_NODE(ModulePath)
1092 DONT_OPTIMIZE_NODE(ModuleUrl) 1102 DONT_OPTIMIZE_NODE(ModuleUrl)
1093 DONT_OPTIMIZE_NODE(ModuleStatement) 1103 DONT_OPTIMIZE_NODE(ModuleStatement)
1094 DONT_OPTIMIZE_NODE(Yield) 1104 DONT_OPTIMIZE_NODE_WITH_FEEDBACK_SLOTS(Yield)
Toon Verwaest 2014/07/18 09:52:16 Some sorting would be nice...
mvstanton 2014/07/18 13:35:04 Done.
1095 DONT_OPTIMIZE_NODE(WithStatement) 1105 DONT_OPTIMIZE_NODE(WithStatement)
1096 DONT_OPTIMIZE_NODE(TryCatchStatement) 1106 DONT_OPTIMIZE_NODE(TryCatchStatement)
1097 DONT_OPTIMIZE_NODE(TryFinallyStatement) 1107 DONT_OPTIMIZE_NODE(TryFinallyStatement)
1098 DONT_OPTIMIZE_NODE(DebuggerStatement) 1108 DONT_OPTIMIZE_NODE(DebuggerStatement)
1099 DONT_OPTIMIZE_NODE(NativeFunctionLiteral) 1109 DONT_OPTIMIZE_NODE(NativeFunctionLiteral)
1100 1110
1101 DONT_SELFOPTIMIZE_NODE(DoWhileStatement) 1111 DONT_SELFOPTIMIZE_NODE(DoWhileStatement)
1102 DONT_SELFOPTIMIZE_NODE(WhileStatement) 1112 DONT_SELFOPTIMIZE_NODE(WhileStatement)
1103 DONT_SELFOPTIMIZE_NODE(ForStatement) 1113 DONT_SELFOPTIMIZE_NODE(ForStatement)
1104 DONT_SELFOPTIMIZE_NODE_WITH_FEEDBACK_SLOTS(ForInStatement) 1114 DONT_SELFOPTIMIZE_NODE_WITH_FEEDBACK_SLOTS(ForInStatement)
1105 DONT_SELFOPTIMIZE_NODE(ForOfStatement) 1115 DONT_SELFOPTIMIZE_NODE(ForOfStatement)
1106 1116
1107 DONT_CACHE_NODE(ModuleLiteral) 1117 DONT_CACHE_NODE(ModuleLiteral)
1108 1118
1109 1119
1110 void AstConstructionVisitor::VisitCallRuntime(CallRuntime* node) { 1120 void AstConstructionVisitor::VisitCallRuntime(CallRuntime* node) {
1111 increase_node_count(); 1121 increase_node_count();
1122 add_slot_node(node);
1112 if (node->is_jsruntime()) { 1123 if (node->is_jsruntime()) {
1113 // Don't try to optimize JS runtime calls because we bailout on them. 1124 // Don't try to optimize JS runtime calls because we bailout on them.
1114 set_dont_optimize_reason(kCallToAJavaScriptRuntimeFunction); 1125 set_dont_optimize_reason(kCallToAJavaScriptRuntimeFunction);
1115 } 1126 }
1116 } 1127 }
1117 1128
1118 #undef REGULAR_NODE 1129 #undef REGULAR_NODE
1119 #undef DONT_OPTIMIZE_NODE 1130 #undef DONT_OPTIMIZE_NODE
1120 #undef DONT_SELFOPTIMIZE_NODE 1131 #undef DONT_SELFOPTIMIZE_NODE
1121 #undef DONT_CACHE_NODE 1132 #undef DONT_CACHE_NODE
(...skipping 10 matching lines...) Expand all
1132 SNPrintF(buffer, "%d", Smi::cast(*value())->value()); 1143 SNPrintF(buffer, "%d", Smi::cast(*value())->value());
1133 str = arr; 1144 str = arr;
1134 } else { 1145 } else {
1135 str = DoubleToCString(value()->Number(), buffer); 1146 str = DoubleToCString(value()->Number(), buffer);
1136 } 1147 }
1137 return isolate_->factory()->NewStringFromAsciiChecked(str); 1148 return isolate_->factory()->NewStringFromAsciiChecked(str);
1138 } 1149 }
1139 1150
1140 1151
1141 } } // namespace v8::internal 1152 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ast.h ('k') | src/bootstrapper.cc » ('j') | src/flag-definitions.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698