OLD | NEW |
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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 | 183 |
184 size_t hash_value(ResolvedFeedbackSlot const& p) { | 184 size_t hash_value(ResolvedFeedbackSlot const& p) { |
185 base::hash<int> h; | 185 base::hash<int> h; |
186 return h(p.slot().ToInt()); | 186 return h(p.slot().ToInt()); |
187 } | 187 } |
188 | 188 |
189 | 189 |
190 bool operator==(LoadNamedParameters const& lhs, | 190 bool operator==(LoadNamedParameters const& lhs, |
191 LoadNamedParameters const& rhs) { | 191 LoadNamedParameters const& rhs) { |
192 return lhs.name() == rhs.name() && | 192 return lhs.name() == rhs.name() && |
193 lhs.language_mode() == rhs.language_mode() && | |
194 lhs.contextual_mode() == rhs.contextual_mode() && | 193 lhs.contextual_mode() == rhs.contextual_mode() && |
195 lhs.feedback() == rhs.feedback(); | 194 lhs.feedback() == rhs.feedback(); |
196 } | 195 } |
197 | 196 |
198 | 197 |
199 bool operator!=(LoadNamedParameters const& lhs, | 198 bool operator!=(LoadNamedParameters const& lhs, |
200 LoadNamedParameters const& rhs) { | 199 LoadNamedParameters const& rhs) { |
201 return !(lhs == rhs); | 200 return !(lhs == rhs); |
202 } | 201 } |
203 | 202 |
204 | 203 |
205 size_t hash_value(LoadNamedParameters const& p) { | 204 size_t hash_value(LoadNamedParameters const& p) { |
206 return base::hash_combine(p.name(), p.language_mode(), p.contextual_mode(), | 205 return base::hash_combine(p.name(), p.contextual_mode(), p.feedback()); |
207 p.feedback()); | |
208 } | 206 } |
209 | 207 |
210 | 208 |
211 std::ostream& operator<<(std::ostream& os, LoadNamedParameters const& p) { | 209 std::ostream& operator<<(std::ostream& os, LoadNamedParameters const& p) { |
212 return os << Brief(*p.name().handle()) << ", " << p.language_mode() << ", " | 210 return os << Brief(*p.name().handle()) << ", " << p.contextual_mode(); |
213 << p.contextual_mode(); | |
214 } | 211 } |
215 | 212 |
216 | 213 |
217 std::ostream& operator<<(std::ostream& os, LoadPropertyParameters const& p) { | 214 std::ostream& operator<<(std::ostream& os, LoadPropertyParameters const& p) { |
218 return os << p.language_mode(); | 215 // Nothing special to print. |
| 216 return os; |
219 } | 217 } |
220 | 218 |
221 | 219 |
222 bool operator==(LoadPropertyParameters const& lhs, | 220 bool operator==(LoadPropertyParameters const& lhs, |
223 LoadPropertyParameters const& rhs) { | 221 LoadPropertyParameters const& rhs) { |
224 return lhs.language_mode() == rhs.language_mode() && | 222 return lhs.feedback() == rhs.feedback(); |
225 lhs.feedback() == rhs.feedback(); | |
226 } | 223 } |
227 | 224 |
228 | 225 |
229 bool operator!=(LoadPropertyParameters const& lhs, | 226 bool operator!=(LoadPropertyParameters const& lhs, |
230 LoadPropertyParameters const& rhs) { | 227 LoadPropertyParameters const& rhs) { |
231 return !(lhs == rhs); | 228 return !(lhs == rhs); |
232 } | 229 } |
233 | 230 |
234 | 231 |
235 const LoadPropertyParameters& LoadPropertyParametersOf(const Operator* op) { | 232 const LoadPropertyParameters& LoadPropertyParametersOf(const Operator* op) { |
236 DCHECK_EQ(IrOpcode::kJSLoadProperty, op->opcode()); | 233 DCHECK_EQ(IrOpcode::kJSLoadProperty, op->opcode()); |
237 return OpParameter<LoadPropertyParameters>(op); | 234 return OpParameter<LoadPropertyParameters>(op); |
238 } | 235 } |
239 | 236 |
240 | 237 |
241 size_t hash_value(LoadPropertyParameters const& p) { | 238 size_t hash_value(LoadPropertyParameters const& p) { |
242 return base::hash_combine(p.language_mode(), p.feedback()); | 239 return hash_value(p.feedback()); |
243 } | 240 } |
244 | 241 |
245 | 242 |
246 const LoadNamedParameters& LoadNamedParametersOf(const Operator* op) { | 243 const LoadNamedParameters& LoadNamedParametersOf(const Operator* op) { |
247 DCHECK_EQ(IrOpcode::kJSLoadNamed, op->opcode()); | 244 DCHECK_EQ(IrOpcode::kJSLoadNamed, op->opcode()); |
248 return OpParameter<LoadNamedParameters>(op); | 245 return OpParameter<LoadNamedParameters>(op); |
249 } | 246 } |
250 | 247 |
251 | 248 |
252 bool operator==(StoreNamedParameters const& lhs, | 249 bool operator==(StoreNamedParameters const& lhs, |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 return new (zone()) Operator1<int>( // -- | 452 return new (zone()) Operator1<int>( // -- |
456 IrOpcode::kJSCallConstruct, Operator::kNoProperties, // opcode | 453 IrOpcode::kJSCallConstruct, Operator::kNoProperties, // opcode |
457 "JSCallConstruct", // name | 454 "JSCallConstruct", // name |
458 arguments, 1, 1, 1, 1, 2, // counts | 455 arguments, 1, 1, 1, 1, 2, // counts |
459 arguments); // parameter | 456 arguments); // parameter |
460 } | 457 } |
461 | 458 |
462 | 459 |
463 const Operator* JSOperatorBuilder::LoadNamed( | 460 const Operator* JSOperatorBuilder::LoadNamed( |
464 const Unique<Name>& name, const ResolvedFeedbackSlot& feedback, | 461 const Unique<Name>& name, const ResolvedFeedbackSlot& feedback, |
465 LanguageMode language_mode, ContextualMode contextual_mode) { | 462 ContextualMode contextual_mode) { |
466 LoadNamedParameters parameters(name, feedback, language_mode, | 463 LoadNamedParameters parameters(name, feedback, contextual_mode); |
467 contextual_mode); | |
468 return new (zone()) Operator1<LoadNamedParameters>( // -- | 464 return new (zone()) Operator1<LoadNamedParameters>( // -- |
469 IrOpcode::kJSLoadNamed, Operator::kNoProperties, // opcode | 465 IrOpcode::kJSLoadNamed, Operator::kNoProperties, // opcode |
470 "JSLoadNamed", // name | 466 "JSLoadNamed", // name |
471 2, 1, 1, 1, 1, 2, // counts | 467 2, 1, 1, 1, 1, 2, // counts |
472 parameters); // parameter | 468 parameters); // parameter |
473 } | 469 } |
474 | 470 |
475 | 471 |
476 const Operator* JSOperatorBuilder::LoadProperty( | 472 const Operator* JSOperatorBuilder::LoadProperty( |
477 const ResolvedFeedbackSlot& feedback, LanguageMode language_mode) { | 473 const ResolvedFeedbackSlot& feedback) { |
478 LoadPropertyParameters parameters(feedback, language_mode); | 474 LoadPropertyParameters parameters(feedback); |
479 return new (zone()) Operator1<LoadPropertyParameters>( // -- | 475 return new (zone()) Operator1<LoadPropertyParameters>( // -- |
480 IrOpcode::kJSLoadProperty, Operator::kNoProperties, // opcode | 476 IrOpcode::kJSLoadProperty, Operator::kNoProperties, // opcode |
481 "JSLoadProperty", // name | 477 "JSLoadProperty", // name |
482 3, 1, 1, 1, 1, 2, // counts | 478 3, 1, 1, 1, 1, 2, // counts |
483 parameters); // parameter | 479 parameters); // parameter |
484 } | 480 } |
485 | 481 |
486 | 482 |
487 const Operator* JSOperatorBuilder::StoreNamed(LanguageMode language_mode, | 483 const Operator* JSOperatorBuilder::StoreNamed(LanguageMode language_mode, |
488 const Unique<Name>& name) { | 484 const Unique<Name>& name) { |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 return new (zone()) Operator1<Unique<String>>( // -- | 582 return new (zone()) Operator1<Unique<String>>( // -- |
587 IrOpcode::kJSCreateCatchContext, Operator::kNoProperties, // opcode | 583 IrOpcode::kJSCreateCatchContext, Operator::kNoProperties, // opcode |
588 "JSCreateCatchContext", // name | 584 "JSCreateCatchContext", // name |
589 2, 1, 1, 1, 1, 2, // counts | 585 2, 1, 1, 1, 1, 2, // counts |
590 name); // parameter | 586 name); // parameter |
591 } | 587 } |
592 | 588 |
593 } // namespace compiler | 589 } // namespace compiler |
594 } // namespace internal | 590 } // namespace internal |
595 } // namespace v8 | 591 } // namespace v8 |
OLD | NEW |