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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 DCHECK_EQ(IrOpcode::kJSConvertReceiver, op->opcode()); | 50 DCHECK_EQ(IrOpcode::kJSConvertReceiver, op->opcode()); |
51 return OpParameter<ConvertReceiverMode>(op); | 51 return OpParameter<ConvertReceiverMode>(op); |
52 } | 52 } |
53 | 53 |
54 | 54 |
55 ToBooleanHints ToBooleanHintsOf(Operator const* op) { | 55 ToBooleanHints ToBooleanHintsOf(Operator const* op) { |
56 DCHECK_EQ(IrOpcode::kJSToBoolean, op->opcode()); | 56 DCHECK_EQ(IrOpcode::kJSToBoolean, op->opcode()); |
57 return OpParameter<ToBooleanHints>(op); | 57 return OpParameter<ToBooleanHints>(op); |
58 } | 58 } |
59 | 59 |
| 60 std::ostream& operator<<(std::ostream& os, |
| 61 ConstructForwardVarargsParameters const& p) { |
| 62 return os << p.arity() << ", " << p.start_index(); |
| 63 } |
| 64 |
| 65 ConstructForwardVarargsParameters const& ConstructForwardVarargsParametersOf( |
| 66 Operator const* op) { |
| 67 DCHECK_EQ(IrOpcode::kJSConstructForwardVarargs, op->opcode()); |
| 68 return OpParameter<ConstructForwardVarargsParameters>(op); |
| 69 } |
| 70 |
60 bool operator==(ConstructParameters const& lhs, | 71 bool operator==(ConstructParameters const& lhs, |
61 ConstructParameters const& rhs) { | 72 ConstructParameters const& rhs) { |
62 return lhs.arity() == rhs.arity() && lhs.frequency() == rhs.frequency() && | 73 return lhs.arity() == rhs.arity() && lhs.frequency() == rhs.frequency() && |
63 lhs.feedback() == rhs.feedback(); | 74 lhs.feedback() == rhs.feedback(); |
64 } | 75 } |
65 | 76 |
66 bool operator!=(ConstructParameters const& lhs, | 77 bool operator!=(ConstructParameters const& lhs, |
67 ConstructParameters const& rhs) { | 78 ConstructParameters const& rhs) { |
68 return !(lhs == rhs); | 79 return !(lhs == rhs); |
69 } | 80 } |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 return os; | 122 return os; |
112 } | 123 } |
113 | 124 |
114 const CallParameters& CallParametersOf(const Operator* op) { | 125 const CallParameters& CallParametersOf(const Operator* op) { |
115 DCHECK_EQ(IrOpcode::kJSCall, op->opcode()); | 126 DCHECK_EQ(IrOpcode::kJSCall, op->opcode()); |
116 return OpParameter<CallParameters>(op); | 127 return OpParameter<CallParameters>(op); |
117 } | 128 } |
118 | 129 |
119 std::ostream& operator<<(std::ostream& os, | 130 std::ostream& operator<<(std::ostream& os, |
120 CallForwardVarargsParameters const& p) { | 131 CallForwardVarargsParameters const& p) { |
121 return os << p.start_index() << ", " << p.tail_call_mode(); | 132 return os << p.arity() << ", " << p.start_index() << ", " |
| 133 << p.tail_call_mode(); |
122 } | 134 } |
123 | 135 |
124 CallForwardVarargsParameters const& CallForwardVarargsParametersOf( | 136 CallForwardVarargsParameters const& CallForwardVarargsParametersOf( |
125 Operator const* op) { | 137 Operator const* op) { |
126 DCHECK_EQ(IrOpcode::kJSCallForwardVarargs, op->opcode()); | 138 DCHECK_EQ(IrOpcode::kJSCallForwardVarargs, op->opcode()); |
127 return OpParameter<CallForwardVarargsParameters>(op); | 139 return OpParameter<CallForwardVarargsParameters>(op); |
128 } | 140 } |
129 | 141 |
130 | 142 |
131 bool operator==(CallRuntimeParameters const& lhs, | 143 bool operator==(CallRuntimeParameters const& lhs, |
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 const Operator* JSOperatorBuilder::ToBoolean(ToBooleanHints hints) { | 748 const Operator* JSOperatorBuilder::ToBoolean(ToBooleanHints hints) { |
737 // TODO(turbofan): Cache most important versions of this operator. | 749 // TODO(turbofan): Cache most important versions of this operator. |
738 return new (zone()) Operator1<ToBooleanHints>( //-- | 750 return new (zone()) Operator1<ToBooleanHints>( //-- |
739 IrOpcode::kJSToBoolean, Operator::kPure, // opcode | 751 IrOpcode::kJSToBoolean, Operator::kPure, // opcode |
740 "JSToBoolean", // name | 752 "JSToBoolean", // name |
741 1, 0, 0, 1, 0, 0, // inputs/outputs | 753 1, 0, 0, 1, 0, 0, // inputs/outputs |
742 hints); // parameter | 754 hints); // parameter |
743 } | 755 } |
744 | 756 |
745 const Operator* JSOperatorBuilder::CallForwardVarargs( | 757 const Operator* JSOperatorBuilder::CallForwardVarargs( |
746 uint32_t start_index, TailCallMode tail_call_mode) { | 758 size_t arity, uint32_t start_index, TailCallMode tail_call_mode) { |
747 CallForwardVarargsParameters parameters(start_index, tail_call_mode); | 759 CallForwardVarargsParameters parameters(arity, start_index, tail_call_mode); |
748 return new (zone()) Operator1<CallForwardVarargsParameters>( // -- | 760 return new (zone()) Operator1<CallForwardVarargsParameters>( // -- |
749 IrOpcode::kJSCallForwardVarargs, Operator::kNoProperties, // opcode | 761 IrOpcode::kJSCallForwardVarargs, Operator::kNoProperties, // opcode |
750 "JSCallForwardVarargs", // name | 762 "JSCallForwardVarargs", // name |
751 2, 1, 1, 1, 1, 2, // counts | 763 parameters.arity(), 1, 1, 1, 1, 2, // counts |
752 parameters); // parameter | 764 parameters); // parameter |
753 } | 765 } |
754 | 766 |
755 const Operator* JSOperatorBuilder::Call(size_t arity, CallFrequency frequency, | 767 const Operator* JSOperatorBuilder::Call(size_t arity, CallFrequency frequency, |
756 VectorSlotPair const& feedback, | 768 VectorSlotPair const& feedback, |
757 ConvertReceiverMode convert_mode, | 769 ConvertReceiverMode convert_mode, |
758 TailCallMode tail_call_mode) { | 770 TailCallMode tail_call_mode) { |
759 CallParameters parameters(arity, frequency, feedback, tail_call_mode, | 771 CallParameters parameters(arity, frequency, feedback, tail_call_mode, |
760 convert_mode); | 772 convert_mode); |
761 return new (zone()) Operator1<CallParameters>( // -- | 773 return new (zone()) Operator1<CallParameters>( // -- |
(...skipping 29 matching lines...) Expand all Loading... |
791 size_t arity) { | 803 size_t arity) { |
792 CallRuntimeParameters parameters(f->function_id, arity); | 804 CallRuntimeParameters parameters(f->function_id, arity); |
793 DCHECK(f->nargs == -1 || f->nargs == static_cast<int>(parameters.arity())); | 805 DCHECK(f->nargs == -1 || f->nargs == static_cast<int>(parameters.arity())); |
794 return new (zone()) Operator1<CallRuntimeParameters>( // -- | 806 return new (zone()) Operator1<CallRuntimeParameters>( // -- |
795 IrOpcode::kJSCallRuntime, Operator::kNoProperties, // opcode | 807 IrOpcode::kJSCallRuntime, Operator::kNoProperties, // opcode |
796 "JSCallRuntime", // name | 808 "JSCallRuntime", // name |
797 parameters.arity(), 1, 1, f->result_size, 1, 2, // inputs/outputs | 809 parameters.arity(), 1, 1, f->result_size, 1, 2, // inputs/outputs |
798 parameters); // parameter | 810 parameters); // parameter |
799 } | 811 } |
800 | 812 |
| 813 const Operator* JSOperatorBuilder::ConstructForwardVarargs( |
| 814 size_t arity, uint32_t start_index) { |
| 815 ConstructForwardVarargsParameters parameters(arity, start_index); |
| 816 return new (zone()) Operator1<ConstructForwardVarargsParameters>( // -- |
| 817 IrOpcode::kJSConstructForwardVarargs, Operator::kNoProperties, // opcode |
| 818 "JSConstructForwardVarargs", // name |
| 819 parameters.arity(), 1, 1, 1, 1, 2, // counts |
| 820 parameters); // parameter |
| 821 } |
| 822 |
801 const Operator* JSOperatorBuilder::Construct(uint32_t arity, | 823 const Operator* JSOperatorBuilder::Construct(uint32_t arity, |
802 CallFrequency frequency, | 824 CallFrequency frequency, |
803 VectorSlotPair const& feedback) { | 825 VectorSlotPair const& feedback) { |
804 ConstructParameters parameters(arity, frequency, feedback); | 826 ConstructParameters parameters(arity, frequency, feedback); |
805 return new (zone()) Operator1<ConstructParameters>( // -- | 827 return new (zone()) Operator1<ConstructParameters>( // -- |
806 IrOpcode::kJSConstruct, Operator::kNoProperties, // opcode | 828 IrOpcode::kJSConstruct, Operator::kNoProperties, // opcode |
807 "JSConstruct", // name | 829 "JSConstruct", // name |
808 parameters.arity(), 1, 1, 1, 1, 2, // counts | 830 parameters.arity(), 1, 1, 1, 1, 2, // counts |
809 parameters); // parameter | 831 parameters); // parameter |
810 } | 832 } |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1086 return new (zone()) Operator1<Handle<ScopeInfo>>( // -- | 1108 return new (zone()) Operator1<Handle<ScopeInfo>>( // -- |
1087 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode | 1109 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode |
1088 "JSCreateScriptContext", // name | 1110 "JSCreateScriptContext", // name |
1089 1, 1, 1, 1, 1, 2, // counts | 1111 1, 1, 1, 1, 1, 2, // counts |
1090 scope_info); // parameter | 1112 scope_info); // parameter |
1091 } | 1113 } |
1092 | 1114 |
1093 } // namespace compiler | 1115 } // namespace compiler |
1094 } // namespace internal | 1116 } // namespace internal |
1095 } // namespace v8 | 1117 } // namespace v8 |
OLD | NEW |