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

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: REBASE. 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
« no previous file with comments | « src/ast.h ('k') | src/bootstrapper.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 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 920 matching lines...) Expand 10 before | Expand all | Expand 10 after
1014 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ 1016 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \
1015 increase_node_count(); \ 1017 increase_node_count(); \
1016 add_slot_node(node); \ 1018 add_slot_node(node); \
1017 } 1019 }
1018 #define DONT_OPTIMIZE_NODE(NodeType) \ 1020 #define DONT_OPTIMIZE_NODE(NodeType) \
1019 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ 1021 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \
1020 increase_node_count(); \ 1022 increase_node_count(); \
1021 set_dont_optimize_reason(k##NodeType); \ 1023 set_dont_optimize_reason(k##NodeType); \
1022 add_flag(kDontSelfOptimize); \ 1024 add_flag(kDontSelfOptimize); \
1023 } 1025 }
1024 #define DONT_SELFOPTIMIZE_NODE(NodeType) \ 1026 #define DONT_OPTIMIZE_NODE_WITH_FEEDBACK_SLOTS(NodeType) \
1027 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \
1028 increase_node_count(); \
1029 add_slot_node(node); \
1030 set_dont_optimize_reason(k##NodeType); \
1031 add_flag(kDontSelfOptimize); \
1032 }
1033 #define DONT_SELFOPTIMIZE_NODE(NodeType) \
1025 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ 1034 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \
1026 increase_node_count(); \ 1035 increase_node_count(); \
1027 add_flag(kDontSelfOptimize); \ 1036 add_flag(kDontSelfOptimize); \
1028 } 1037 }
1029 #define DONT_SELFOPTIMIZE_NODE_WITH_FEEDBACK_SLOTS(NodeType) \ 1038 #define DONT_SELFOPTIMIZE_NODE_WITH_FEEDBACK_SLOTS(NodeType) \
1030 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ 1039 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \
1031 increase_node_count(); \ 1040 increase_node_count(); \
1032 add_slot_node(node); \ 1041 add_slot_node(node); \
1033 add_flag(kDontSelfOptimize); \ 1042 add_flag(kDontSelfOptimize); \
1034 } 1043 }
(...skipping 17 matching lines...) Expand all
1052 REGULAR_NODE(SwitchStatement) 1061 REGULAR_NODE(SwitchStatement)
1053 REGULAR_NODE(CaseClause) 1062 REGULAR_NODE(CaseClause)
1054 REGULAR_NODE(Conditional) 1063 REGULAR_NODE(Conditional)
1055 REGULAR_NODE(Literal) 1064 REGULAR_NODE(Literal)
1056 REGULAR_NODE(ArrayLiteral) 1065 REGULAR_NODE(ArrayLiteral)
1057 REGULAR_NODE(ObjectLiteral) 1066 REGULAR_NODE(ObjectLiteral)
1058 REGULAR_NODE(RegExpLiteral) 1067 REGULAR_NODE(RegExpLiteral)
1059 REGULAR_NODE(FunctionLiteral) 1068 REGULAR_NODE(FunctionLiteral)
1060 REGULAR_NODE(Assignment) 1069 REGULAR_NODE(Assignment)
1061 REGULAR_NODE(Throw) 1070 REGULAR_NODE(Throw)
1062 REGULAR_NODE(Property)
1063 REGULAR_NODE(UnaryOperation) 1071 REGULAR_NODE(UnaryOperation)
1064 REGULAR_NODE(CountOperation) 1072 REGULAR_NODE(CountOperation)
1065 REGULAR_NODE(BinaryOperation) 1073 REGULAR_NODE(BinaryOperation)
1066 REGULAR_NODE(CompareOperation) 1074 REGULAR_NODE(CompareOperation)
1067 REGULAR_NODE(ThisFunction) 1075 REGULAR_NODE(ThisFunction)
1076
1068 REGULAR_NODE_WITH_FEEDBACK_SLOTS(Call) 1077 REGULAR_NODE_WITH_FEEDBACK_SLOTS(Call)
1069 REGULAR_NODE_WITH_FEEDBACK_SLOTS(CallNew) 1078 REGULAR_NODE_WITH_FEEDBACK_SLOTS(CallNew)
1079 REGULAR_NODE_WITH_FEEDBACK_SLOTS(Property)
1070 // In theory, for VariableProxy we'd have to add: 1080 // In theory, for VariableProxy we'd have to add:
1071 // if (node->var()->IsLookupSlot()) 1081 // if (node->var()->IsLookupSlot())
1072 // set_dont_optimize_reason(kReferenceToAVariableWhichRequiresDynamicLookup); 1082 // set_dont_optimize_reason(kReferenceToAVariableWhichRequiresDynamicLookup);
1073 // But node->var() is usually not bound yet at VariableProxy creation time, and 1083 // But node->var() is usually not bound yet at VariableProxy creation time, and
1074 // LOOKUP variables only result from constructs that cannot be inlined anyway. 1084 // LOOKUP variables only result from constructs that cannot be inlined anyway.
1075 REGULAR_NODE(VariableProxy) 1085 REGULAR_NODE_WITH_FEEDBACK_SLOTS(VariableProxy)
1076 1086
1077 // We currently do not optimize any modules. 1087 // We currently do not optimize any modules.
1078 DONT_OPTIMIZE_NODE(ModuleDeclaration) 1088 DONT_OPTIMIZE_NODE(ModuleDeclaration)
1079 DONT_OPTIMIZE_NODE(ImportDeclaration) 1089 DONT_OPTIMIZE_NODE(ImportDeclaration)
1080 DONT_OPTIMIZE_NODE(ExportDeclaration) 1090 DONT_OPTIMIZE_NODE(ExportDeclaration)
1081 DONT_OPTIMIZE_NODE(ModuleVariable) 1091 DONT_OPTIMIZE_NODE(ModuleVariable)
1082 DONT_OPTIMIZE_NODE(ModulePath) 1092 DONT_OPTIMIZE_NODE(ModulePath)
1083 DONT_OPTIMIZE_NODE(ModuleUrl) 1093 DONT_OPTIMIZE_NODE(ModuleUrl)
1084 DONT_OPTIMIZE_NODE(ModuleStatement) 1094 DONT_OPTIMIZE_NODE(ModuleStatement)
1085 DONT_OPTIMIZE_NODE(Yield)
1086 DONT_OPTIMIZE_NODE(WithStatement) 1095 DONT_OPTIMIZE_NODE(WithStatement)
1087 DONT_OPTIMIZE_NODE(TryCatchStatement) 1096 DONT_OPTIMIZE_NODE(TryCatchStatement)
1088 DONT_OPTIMIZE_NODE(TryFinallyStatement) 1097 DONT_OPTIMIZE_NODE(TryFinallyStatement)
1089 DONT_OPTIMIZE_NODE(DebuggerStatement) 1098 DONT_OPTIMIZE_NODE(DebuggerStatement)
1090 DONT_OPTIMIZE_NODE(NativeFunctionLiteral) 1099 DONT_OPTIMIZE_NODE(NativeFunctionLiteral)
1091 1100
1101 DONT_OPTIMIZE_NODE_WITH_FEEDBACK_SLOTS(Yield)
1102
1092 DONT_SELFOPTIMIZE_NODE(DoWhileStatement) 1103 DONT_SELFOPTIMIZE_NODE(DoWhileStatement)
1093 DONT_SELFOPTIMIZE_NODE(WhileStatement) 1104 DONT_SELFOPTIMIZE_NODE(WhileStatement)
1094 DONT_SELFOPTIMIZE_NODE(ForStatement) 1105 DONT_SELFOPTIMIZE_NODE(ForStatement)
1106 DONT_SELFOPTIMIZE_NODE(ForOfStatement)
1107
1095 DONT_SELFOPTIMIZE_NODE_WITH_FEEDBACK_SLOTS(ForInStatement) 1108 DONT_SELFOPTIMIZE_NODE_WITH_FEEDBACK_SLOTS(ForInStatement)
1096 DONT_SELFOPTIMIZE_NODE(ForOfStatement)
1097 1109
1098 DONT_CACHE_NODE(ModuleLiteral) 1110 DONT_CACHE_NODE(ModuleLiteral)
1099 1111
1100 1112
1101 void AstConstructionVisitor::VisitCallRuntime(CallRuntime* node) { 1113 void AstConstructionVisitor::VisitCallRuntime(CallRuntime* node) {
1102 increase_node_count(); 1114 increase_node_count();
1115 add_slot_node(node);
1103 if (node->is_jsruntime()) { 1116 if (node->is_jsruntime()) {
1104 // Don't try to optimize JS runtime calls because we bailout on them. 1117 // Don't try to optimize JS runtime calls because we bailout on them.
1105 set_dont_optimize_reason(kCallToAJavaScriptRuntimeFunction); 1118 set_dont_optimize_reason(kCallToAJavaScriptRuntimeFunction);
1106 } 1119 }
1107 } 1120 }
1108 1121
1109 #undef REGULAR_NODE 1122 #undef REGULAR_NODE
1110 #undef DONT_OPTIMIZE_NODE 1123 #undef DONT_OPTIMIZE_NODE
1111 #undef DONT_SELFOPTIMIZE_NODE 1124 #undef DONT_SELFOPTIMIZE_NODE
1112 #undef DONT_CACHE_NODE 1125 #undef DONT_CACHE_NODE
(...skipping 10 matching lines...) Expand all
1123 SNPrintF(buffer, "%d", Smi::cast(*value())->value()); 1136 SNPrintF(buffer, "%d", Smi::cast(*value())->value());
1124 str = arr; 1137 str = arr;
1125 } else { 1138 } else {
1126 str = DoubleToCString(value()->Number(), buffer); 1139 str = DoubleToCString(value()->Number(), buffer);
1127 } 1140 }
1128 return isolate_->factory()->NewStringFromAsciiChecked(str); 1141 return isolate_->factory()->NewStringFromAsciiChecked(str);
1129 } 1142 }
1130 1143
1131 1144
1132 } } // namespace v8::internal 1145 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ast.h ('k') | src/bootstrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698