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

Side by Side Diff: src/compiler/js-operator.cc

Issue 633423002: Teach TurboFan to call vector-based ICs. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed nits. Created 6 years, 2 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/compiler/js-operator.h ('k') | src/ia32/lithium-codegen-ia32.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/compiler/js-operator.h" 5 #include "src/compiler/js-operator.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "src/base/lazy-instance.h" 9 #include "src/base/lazy-instance.h"
10 #include "src/compiler/opcodes.h" 10 #include "src/compiler/opcodes.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 } 101 }
102 102
103 103
104 ContextAccess const& ContextAccessOf(Operator const* op) { 104 ContextAccess const& ContextAccessOf(Operator const* op) {
105 DCHECK(op->opcode() == IrOpcode::kJSLoadContext || 105 DCHECK(op->opcode() == IrOpcode::kJSLoadContext ||
106 op->opcode() == IrOpcode::kJSStoreContext); 106 op->opcode() == IrOpcode::kJSStoreContext);
107 return OpParameter<ContextAccess>(op); 107 return OpParameter<ContextAccess>(op);
108 } 108 }
109 109
110 110
111 bool operator==(VectorSlotPair const& lhs, VectorSlotPair const& rhs) {
112 return lhs.slot() == rhs.slot() && lhs.vector().is_identical_to(rhs.vector());
113 }
114
115
116 size_t hash_value(VectorSlotPair const& p) {
117 // TODO(mvstanton): include the vector in the hash.
118 base::hash<int> h;
119 return h(p.slot());
120 }
121
122
111 bool operator==(LoadNamedParameters const& lhs, 123 bool operator==(LoadNamedParameters const& lhs,
112 LoadNamedParameters const& rhs) { 124 LoadNamedParameters const& rhs) {
113 return lhs.name() == rhs.name() && 125 return lhs.name() == rhs.name() &&
114 lhs.contextual_mode() == rhs.contextual_mode(); 126 lhs.contextual_mode() == rhs.contextual_mode() &&
127 lhs.feedback() == rhs.feedback();
115 } 128 }
116 129
117 130
118 bool operator!=(LoadNamedParameters const& lhs, 131 bool operator!=(LoadNamedParameters const& lhs,
119 LoadNamedParameters const& rhs) { 132 LoadNamedParameters const& rhs) {
120 return !(lhs == rhs); 133 return !(lhs == rhs);
121 } 134 }
122 135
123 136
124 size_t hash_value(LoadNamedParameters const& p) { 137 size_t hash_value(LoadNamedParameters const& p) {
125 return base::hash_combine(p.name(), p.contextual_mode()); 138 return base::hash_combine(p.name(), p.contextual_mode(), p.feedback());
126 } 139 }
127 140
128 141
129 std::ostream& operator<<(std::ostream& os, LoadNamedParameters const& p) { 142 std::ostream& operator<<(std::ostream& os, LoadNamedParameters const& p) {
130 return os << Brief(*p.name().handle()) << ", " << p.contextual_mode(); 143 return os << Brief(*p.name().handle()) << ", " << p.contextual_mode();
131 } 144 }
132 145
133 146
147 std::ostream& operator<<(std::ostream& os, LoadPropertyParameters const& p) {
148 // Nothing special to print.
149 return os;
150 }
151
152
153 bool operator==(LoadPropertyParameters const& lhs,
154 LoadPropertyParameters const& rhs) {
155 return lhs.feedback() == rhs.feedback();
156 }
157
158
159 bool operator!=(LoadPropertyParameters const& lhs,
160 LoadPropertyParameters const& rhs) {
161 return !(lhs == rhs);
162 }
163
164
165 const LoadPropertyParameters& LoadPropertyParametersOf(const Operator* op) {
166 DCHECK_EQ(IrOpcode::kJSLoadProperty, op->opcode());
167 return OpParameter<LoadPropertyParameters>(op);
168 }
169
170
171 size_t hash_value(LoadPropertyParameters const& p) {
172 return hash_value(p.feedback());
173 }
174
175
134 const LoadNamedParameters& LoadNamedParametersOf(const Operator* op) { 176 const LoadNamedParameters& LoadNamedParametersOf(const Operator* op) {
135 DCHECK_EQ(IrOpcode::kJSLoadNamed, op->opcode()); 177 DCHECK_EQ(IrOpcode::kJSLoadNamed, op->opcode());
136 return OpParameter<LoadNamedParameters>(op); 178 return OpParameter<LoadNamedParameters>(op);
137 } 179 }
138 180
139 181
140 bool operator==(StoreNamedParameters const& lhs, 182 bool operator==(StoreNamedParameters const& lhs,
141 StoreNamedParameters const& rhs) { 183 StoreNamedParameters const& rhs) {
142 return lhs.strict_mode() == rhs.strict_mode() && lhs.name() == rhs.name(); 184 return lhs.strict_mode() == rhs.strict_mode() && lhs.name() == rhs.name();
143 } 185 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 V(Divide, Operator::kNoProperties, 2, 1) \ 228 V(Divide, Operator::kNoProperties, 2, 1) \
187 V(Modulus, Operator::kNoProperties, 2, 1) \ 229 V(Modulus, Operator::kNoProperties, 2, 1) \
188 V(UnaryNot, Operator::kNoProperties, 1, 1) \ 230 V(UnaryNot, Operator::kNoProperties, 1, 1) \
189 V(ToBoolean, Operator::kNoProperties, 1, 1) \ 231 V(ToBoolean, Operator::kNoProperties, 1, 1) \
190 V(ToNumber, Operator::kNoProperties, 1, 1) \ 232 V(ToNumber, Operator::kNoProperties, 1, 1) \
191 V(ToString, Operator::kNoProperties, 1, 1) \ 233 V(ToString, Operator::kNoProperties, 1, 1) \
192 V(ToName, Operator::kNoProperties, 1, 1) \ 234 V(ToName, Operator::kNoProperties, 1, 1) \
193 V(ToObject, Operator::kNoProperties, 1, 1) \ 235 V(ToObject, Operator::kNoProperties, 1, 1) \
194 V(Yield, Operator::kNoProperties, 1, 1) \ 236 V(Yield, Operator::kNoProperties, 1, 1) \
195 V(Create, Operator::kEliminatable, 0, 1) \ 237 V(Create, Operator::kEliminatable, 0, 1) \
196 V(LoadProperty, Operator::kNoProperties, 2, 1) \
197 V(HasProperty, Operator::kNoProperties, 2, 1) \ 238 V(HasProperty, Operator::kNoProperties, 2, 1) \
198 V(TypeOf, Operator::kPure, 1, 1) \ 239 V(TypeOf, Operator::kPure, 1, 1) \
199 V(InstanceOf, Operator::kNoProperties, 2, 1) \ 240 V(InstanceOf, Operator::kNoProperties, 2, 1) \
200 V(Debugger, Operator::kNoProperties, 0, 0) \ 241 V(Debugger, Operator::kNoProperties, 0, 0) \
201 V(CreateFunctionContext, Operator::kNoProperties, 1, 1) \ 242 V(CreateFunctionContext, Operator::kNoProperties, 1, 1) \
202 V(CreateWithContext, Operator::kNoProperties, 2, 1) \ 243 V(CreateWithContext, Operator::kNoProperties, 2, 1) \
203 V(CreateBlockContext, Operator::kNoProperties, 2, 1) \ 244 V(CreateBlockContext, Operator::kNoProperties, 2, 1) \
204 V(CreateModuleContext, Operator::kNoProperties, 2, 1) \ 245 V(CreateModuleContext, Operator::kNoProperties, 2, 1) \
205 V(CreateGlobalContext, Operator::kNoProperties, 2, 1) 246 V(CreateGlobalContext, Operator::kNoProperties, 2, 1)
206 247
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 295
255 296
256 const Operator* JSOperatorBuilder::CallConstruct(int arguments) { 297 const Operator* JSOperatorBuilder::CallConstruct(int arguments) {
257 return new (zone()) 298 return new (zone())
258 Operator1<int>(IrOpcode::kJSCallConstruct, Operator::kNoProperties, 299 Operator1<int>(IrOpcode::kJSCallConstruct, Operator::kNoProperties,
259 arguments, 1, "JSCallConstruct", arguments); 300 arguments, 1, "JSCallConstruct", arguments);
260 } 301 }
261 302
262 303
263 const Operator* JSOperatorBuilder::LoadNamed(const Unique<Name>& name, 304 const Operator* JSOperatorBuilder::LoadNamed(const Unique<Name>& name,
305 const VectorSlotPair& feedback,
264 ContextualMode contextual_mode) { 306 ContextualMode contextual_mode) {
265 LoadNamedParameters parameters(name, contextual_mode); 307 LoadNamedParameters parameters(name, feedback, contextual_mode);
266 return new (zone()) Operator1<LoadNamedParameters>( 308 return new (zone()) Operator1<LoadNamedParameters>(
267 IrOpcode::kJSLoadNamed, Operator::kNoProperties, 1, 1, "JSLoadNamed", 309 IrOpcode::kJSLoadNamed, Operator::kNoProperties, 1, 1, "JSLoadNamed",
268 parameters); 310 parameters);
269 } 311 }
270 312
271 313
314 const Operator* JSOperatorBuilder::LoadProperty(
315 const VectorSlotPair& feedback) {
316 LoadPropertyParameters parameters(feedback);
317 return new (zone()) Operator1<LoadPropertyParameters>(
318 IrOpcode::kJSLoadProperty, Operator::kNoProperties, 2, 1,
319 "JSLoadProperty", parameters);
320 }
321
322
272 const Operator* JSOperatorBuilder::StoreProperty(StrictMode strict_mode) { 323 const Operator* JSOperatorBuilder::StoreProperty(StrictMode strict_mode) {
273 return new (zone()) 324 return new (zone())
274 Operator1<StrictMode>(IrOpcode::kJSStoreProperty, Operator::kNoProperties, 325 Operator1<StrictMode>(IrOpcode::kJSStoreProperty, Operator::kNoProperties,
275 3, 0, "JSStoreProperty", strict_mode); 326 3, 0, "JSStoreProperty", strict_mode);
276 } 327 }
277 328
278 329
279 const Operator* JSOperatorBuilder::StoreNamed(StrictMode strict_mode, 330 const Operator* JSOperatorBuilder::StoreNamed(StrictMode strict_mode,
280 const Unique<Name>& name) { 331 const Unique<Name>& name) {
281 StoreNamedParameters parameters(strict_mode, name); 332 StoreNamedParameters parameters(strict_mode, name);
(...skipping 30 matching lines...) Expand all
312 const Operator* JSOperatorBuilder::CreateCatchContext( 363 const Operator* JSOperatorBuilder::CreateCatchContext(
313 const Unique<String>& name) { 364 const Unique<String>& name) {
314 return new (zone()) Operator1<Unique<String>>(IrOpcode::kJSCreateCatchContext, 365 return new (zone()) Operator1<Unique<String>>(IrOpcode::kJSCreateCatchContext,
315 Operator::kNoProperties, 1, 1, 366 Operator::kNoProperties, 1, 1,
316 "JSCreateCatchContext", name); 367 "JSCreateCatchContext", name);
317 } 368 }
318 369
319 } // namespace compiler 370 } // namespace compiler
320 } // namespace internal 371 } // namespace internal
321 } // namespace v8 372 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-operator.h ('k') | src/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698