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