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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 CreateFunctionContextParameters const& parameters) { | 239 CreateFunctionContextParameters const& parameters) { |
240 return os << parameters.slot_count() << ", " << parameters.scope_type(); | 240 return os << parameters.slot_count() << ", " << parameters.scope_type(); |
241 } | 241 } |
242 | 242 |
243 CreateFunctionContextParameters const& CreateFunctionContextParametersOf( | 243 CreateFunctionContextParameters const& CreateFunctionContextParametersOf( |
244 Operator const* op) { | 244 Operator const* op) { |
245 DCHECK_EQ(IrOpcode::kJSCreateFunctionContext, op->opcode()); | 245 DCHECK_EQ(IrOpcode::kJSCreateFunctionContext, op->opcode()); |
246 return OpParameter<CreateFunctionContextParameters>(op); | 246 return OpParameter<CreateFunctionContextParameters>(op); |
247 } | 247 } |
248 | 248 |
| 249 bool operator==(DataPropertyParameters const& lhs, |
| 250 DataPropertyParameters const& rhs) { |
| 251 return lhs.feedback() == rhs.feedback(); |
| 252 } |
| 253 |
| 254 bool operator!=(DataPropertyParameters const& lhs, |
| 255 DataPropertyParameters const& rhs) { |
| 256 return !(lhs == rhs); |
| 257 } |
| 258 |
| 259 size_t hash_value(DataPropertyParameters const& p) { |
| 260 return base::hash_combine(p.feedback()); |
| 261 } |
| 262 |
| 263 std::ostream& operator<<(std::ostream& os, DataPropertyParameters const& p) { |
| 264 return os; |
| 265 } |
| 266 |
| 267 DataPropertyParameters const& DataPropertyParametersOf(const Operator* op) { |
| 268 DCHECK(op->opcode() == IrOpcode::kJSStoreDataPropertyInLiteral); |
| 269 return OpParameter<DataPropertyParameters>(op); |
| 270 } |
| 271 |
249 bool operator==(NamedAccess const& lhs, NamedAccess const& rhs) { | 272 bool operator==(NamedAccess const& lhs, NamedAccess const& rhs) { |
250 return lhs.name().location() == rhs.name().location() && | 273 return lhs.name().location() == rhs.name().location() && |
251 lhs.language_mode() == rhs.language_mode() && | 274 lhs.language_mode() == rhs.language_mode() && |
252 lhs.feedback() == rhs.feedback(); | 275 lhs.feedback() == rhs.feedback(); |
253 } | 276 } |
254 | 277 |
255 | 278 |
256 bool operator!=(NamedAccess const& lhs, NamedAccess const& rhs) { | 279 bool operator!=(NamedAccess const& lhs, NamedAccess const& rhs) { |
257 return !(lhs == rhs); | 280 return !(lhs == rhs); |
258 } | 281 } |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 V(HasProperty, Operator::kNoProperties, 2, 1) \ | 527 V(HasProperty, Operator::kNoProperties, 2, 1) \ |
505 V(TypeOf, Operator::kPure, 1, 1) \ | 528 V(TypeOf, Operator::kPure, 1, 1) \ |
506 V(InstanceOf, Operator::kNoProperties, 2, 1) \ | 529 V(InstanceOf, Operator::kNoProperties, 2, 1) \ |
507 V(OrdinaryHasInstance, Operator::kNoProperties, 2, 1) \ | 530 V(OrdinaryHasInstance, Operator::kNoProperties, 2, 1) \ |
508 V(ForInNext, Operator::kNoProperties, 4, 1) \ | 531 V(ForInNext, Operator::kNoProperties, 4, 1) \ |
509 V(ForInPrepare, Operator::kNoProperties, 1, 3) \ | 532 V(ForInPrepare, Operator::kNoProperties, 1, 3) \ |
510 V(LoadMessage, Operator::kNoThrow, 0, 1) \ | 533 V(LoadMessage, Operator::kNoThrow, 0, 1) \ |
511 V(StoreMessage, Operator::kNoThrow, 1, 0) \ | 534 V(StoreMessage, Operator::kNoThrow, 1, 0) \ |
512 V(GeneratorRestoreContinuation, Operator::kNoThrow, 1, 1) \ | 535 V(GeneratorRestoreContinuation, Operator::kNoThrow, 1, 1) \ |
513 V(StackCheck, Operator::kNoWrite, 0, 0) \ | 536 V(StackCheck, Operator::kNoWrite, 0, 0) \ |
514 V(GetSuperConstructor, Operator::kNoWrite, 1, 1) \ | 537 V(GetSuperConstructor, Operator::kNoWrite, 1, 1) |
515 V(StoreDataPropertyInLiteral, Operator::kNoProperties, 4, 0) | |
516 | 538 |
517 #define BINARY_OP_LIST(V) \ | 539 #define BINARY_OP_LIST(V) \ |
518 V(BitwiseOr) \ | 540 V(BitwiseOr) \ |
519 V(BitwiseXor) \ | 541 V(BitwiseXor) \ |
520 V(BitwiseAnd) \ | 542 V(BitwiseAnd) \ |
521 V(ShiftLeft) \ | 543 V(ShiftLeft) \ |
522 V(ShiftRight) \ | 544 V(ShiftRight) \ |
523 V(ShiftRightLogical) \ | 545 V(ShiftRightLogical) \ |
524 V(Add) \ | 546 V(Add) \ |
525 V(Subtract) \ | 547 V(Subtract) \ |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
644 return &cache_.k##Name##StringOperator; \ | 666 return &cache_.k##Name##StringOperator; \ |
645 case CompareOperationHint::kAny: \ | 667 case CompareOperationHint::kAny: \ |
646 return &cache_.k##Name##AnyOperator; \ | 668 return &cache_.k##Name##AnyOperator; \ |
647 } \ | 669 } \ |
648 UNREACHABLE(); \ | 670 UNREACHABLE(); \ |
649 return nullptr; \ | 671 return nullptr; \ |
650 } | 672 } |
651 COMPARE_OP_LIST(COMPARE_OP) | 673 COMPARE_OP_LIST(COMPARE_OP) |
652 #undef COMPARE_OP | 674 #undef COMPARE_OP |
653 | 675 |
| 676 const Operator* JSOperatorBuilder::StoreDataPropertyInLiteral( |
| 677 const VectorSlotPair& feedback) { |
| 678 DataPropertyParameters parameters(feedback); |
| 679 return new (zone()) Operator1<DataPropertyParameters>( // -- |
| 680 IrOpcode::kJSStoreDataPropertyInLiteral, |
| 681 Operator::kNoThrow, // opcode |
| 682 "JSStoreDataPropertyInLiteral", // name |
| 683 4, 1, 1, 0, 1, 0, // counts |
| 684 parameters); // parameter |
| 685 } |
| 686 |
654 const Operator* JSOperatorBuilder::ToBoolean(ToBooleanHints hints) { | 687 const Operator* JSOperatorBuilder::ToBoolean(ToBooleanHints hints) { |
655 // TODO(turbofan): Cache most important versions of this operator. | 688 // TODO(turbofan): Cache most important versions of this operator. |
656 return new (zone()) Operator1<ToBooleanHints>( //-- | 689 return new (zone()) Operator1<ToBooleanHints>( //-- |
657 IrOpcode::kJSToBoolean, Operator::kPure, // opcode | 690 IrOpcode::kJSToBoolean, Operator::kPure, // opcode |
658 "JSToBoolean", // name | 691 "JSToBoolean", // name |
659 1, 0, 0, 1, 0, 0, // inputs/outputs | 692 1, 0, 0, 1, 0, 0, // inputs/outputs |
660 hints); // parameter | 693 hints); // parameter |
661 } | 694 } |
662 | 695 |
663 const Operator* JSOperatorBuilder::CallFunction( | 696 const Operator* JSOperatorBuilder::CallFunction( |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
968 return new (zone()) Operator1<Handle<ScopeInfo>>( // -- | 1001 return new (zone()) Operator1<Handle<ScopeInfo>>( // -- |
969 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode | 1002 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode |
970 "JSCreateScriptContext", // name | 1003 "JSCreateScriptContext", // name |
971 1, 1, 1, 1, 1, 2, // counts | 1004 1, 1, 1, 1, 1, 2, // counts |
972 scope_info); // parameter | 1005 scope_info); // parameter |
973 } | 1006 } |
974 | 1007 |
975 } // namespace compiler | 1008 } // namespace compiler |
976 } // namespace internal | 1009 } // namespace internal |
977 } // namespace v8 | 1010 } // namespace v8 |
OLD | NEW |