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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 std::ostream& operator<<(std::ostream& os, CallConstructParameters const& p) { | 73 std::ostream& operator<<(std::ostream& os, CallConstructParameters const& p) { |
74 return os << p.arity() << ", " << p.frequency(); | 74 return os << p.arity() << ", " << p.frequency(); |
75 } | 75 } |
76 | 76 |
77 | 77 |
78 CallConstructParameters const& CallConstructParametersOf(Operator const* op) { | 78 CallConstructParameters const& CallConstructParametersOf(Operator const* op) { |
79 DCHECK_EQ(IrOpcode::kJSCallConstruct, op->opcode()); | 79 DCHECK_EQ(IrOpcode::kJSCallConstruct, op->opcode()); |
80 return OpParameter<CallConstructParameters>(op); | 80 return OpParameter<CallConstructParameters>(op); |
81 } | 81 } |
82 | 82 |
| 83 bool operator==(CallConstructWithSpreadParameters const& lhs, |
| 84 CallConstructWithSpreadParameters const& rhs) { |
| 85 return lhs.arity() == rhs.arity(); |
| 86 } |
| 87 |
| 88 bool operator!=(CallConstructWithSpreadParameters const& lhs, |
| 89 CallConstructWithSpreadParameters const& rhs) { |
| 90 return !(lhs == rhs); |
| 91 } |
| 92 |
| 93 size_t hash_value(CallConstructWithSpreadParameters const& p) { |
| 94 return base::hash_combine(p.arity()); |
| 95 } |
| 96 |
| 97 std::ostream& operator<<(std::ostream& os, |
| 98 CallConstructWithSpreadParameters const& p) { |
| 99 return os << p.arity(); |
| 100 } |
| 101 |
| 102 CallConstructWithSpreadParameters const& CallConstructWithSpreadParametersOf( |
| 103 Operator const* op) { |
| 104 DCHECK_EQ(IrOpcode::kJSCallConstructWithSpread, op->opcode()); |
| 105 return OpParameter<CallConstructWithSpreadParameters>(op); |
| 106 } |
83 | 107 |
84 std::ostream& operator<<(std::ostream& os, CallFunctionParameters const& p) { | 108 std::ostream& operator<<(std::ostream& os, CallFunctionParameters const& p) { |
85 os << p.arity() << ", " << p.frequency() << ", " << p.convert_mode() << ", " | 109 os << p.arity() << ", " << p.frequency() << ", " << p.convert_mode() << ", " |
86 << p.tail_call_mode(); | 110 << p.tail_call_mode(); |
87 return os; | 111 return os; |
88 } | 112 } |
89 | 113 |
90 | 114 |
91 const CallFunctionParameters& CallFunctionParametersOf(const Operator* op) { | 115 const CallFunctionParameters& CallFunctionParametersOf(const Operator* op) { |
92 DCHECK_EQ(IrOpcode::kJSCallFunction, op->opcode()); | 116 DCHECK_EQ(IrOpcode::kJSCallFunction, op->opcode()); |
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 const Operator* JSOperatorBuilder::CallConstruct( | 664 const Operator* JSOperatorBuilder::CallConstruct( |
641 uint32_t arity, float frequency, VectorSlotPair const& feedback) { | 665 uint32_t arity, float frequency, VectorSlotPair const& feedback) { |
642 CallConstructParameters parameters(arity, frequency, feedback); | 666 CallConstructParameters parameters(arity, frequency, feedback); |
643 return new (zone()) Operator1<CallConstructParameters>( // -- | 667 return new (zone()) Operator1<CallConstructParameters>( // -- |
644 IrOpcode::kJSCallConstruct, Operator::kNoProperties, // opcode | 668 IrOpcode::kJSCallConstruct, Operator::kNoProperties, // opcode |
645 "JSCallConstruct", // name | 669 "JSCallConstruct", // name |
646 parameters.arity(), 1, 1, 1, 1, 2, // counts | 670 parameters.arity(), 1, 1, 1, 1, 2, // counts |
647 parameters); // parameter | 671 parameters); // parameter |
648 } | 672 } |
649 | 673 |
| 674 const Operator* JSOperatorBuilder::CallConstructWithSpread(uint32_t arity) { |
| 675 CallConstructWithSpreadParameters parameters(arity); |
| 676 return new (zone()) Operator1<CallConstructWithSpreadParameters>( // -- |
| 677 IrOpcode::kJSCallConstructWithSpread, Operator::kNoProperties, // opcode |
| 678 "JSCallConstructWithSpread", // name |
| 679 parameters.arity(), 1, 1, 1, 1, 2, // counts |
| 680 parameters); // parameter |
| 681 } |
650 | 682 |
651 const Operator* JSOperatorBuilder::ConvertReceiver( | 683 const Operator* JSOperatorBuilder::ConvertReceiver( |
652 ConvertReceiverMode convert_mode) { | 684 ConvertReceiverMode convert_mode) { |
653 return new (zone()) Operator1<ConvertReceiverMode>( // -- | 685 return new (zone()) Operator1<ConvertReceiverMode>( // -- |
654 IrOpcode::kJSConvertReceiver, Operator::kEliminatable, // opcode | 686 IrOpcode::kJSConvertReceiver, Operator::kEliminatable, // opcode |
655 "JSConvertReceiver", // name | 687 "JSConvertReceiver", // name |
656 1, 1, 1, 1, 1, 0, // counts | 688 1, 1, 1, 1, 1, 0, // counts |
657 convert_mode); // parameter | 689 convert_mode); // parameter |
658 } | 690 } |
659 | 691 |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
900 return new (zone()) Operator1<Handle<ScopeInfo>>( // -- | 932 return new (zone()) Operator1<Handle<ScopeInfo>>( // -- |
901 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode | 933 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode |
902 "JSCreateScriptContext", // name | 934 "JSCreateScriptContext", // name |
903 1, 1, 1, 1, 1, 2, // counts | 935 1, 1, 1, 1, 1, 2, // counts |
904 scpope_info); // parameter | 936 scpope_info); // parameter |
905 } | 937 } |
906 | 938 |
907 } // namespace compiler | 939 } // namespace compiler |
908 } // namespace internal | 940 } // namespace internal |
909 } // namespace v8 | 941 } // namespace v8 |
OLD | NEW |