| 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 << p.tail_call_mode(); | 150 << p.tail_call_mode(); |
| 151 return os; | 151 return os; |
| 152 } | 152 } |
| 153 | 153 |
| 154 const CallParameters& CallParametersOf(const Operator* op) { | 154 const CallParameters& CallParametersOf(const Operator* op) { |
| 155 DCHECK_EQ(IrOpcode::kJSCall, op->opcode()); | 155 DCHECK_EQ(IrOpcode::kJSCall, op->opcode()); |
| 156 return OpParameter<CallParameters>(op); | 156 return OpParameter<CallParameters>(op); |
| 157 } | 157 } |
| 158 | 158 |
| 159 std::ostream& operator<<(std::ostream& os, | 159 std::ostream& operator<<(std::ostream& os, |
| 160 CallVarargsParameters const& p) { |
| 161 return os << p.arity(); |
| 162 } |
| 163 |
| 164 CallVarargsParameters const& CallVarargsParametersOf( |
| 165 Operator const* op) { |
| 166 DCHECK_EQ(IrOpcode::kJSCallVarargs, op->opcode()); |
| 167 return OpParameter<CallVarargsParameters>(op); |
| 168 } |
| 169 |
| 170 std::ostream& operator<<(std::ostream& os, |
| 160 CallForwardVarargsParameters const& p) { | 171 CallForwardVarargsParameters const& p) { |
| 161 return os << p.arity() << ", " << p.start_index() << ", " | 172 return os << p.arity() << ", " << p.start_index() << ", " |
| 162 << p.tail_call_mode(); | 173 << p.tail_call_mode(); |
| 163 } | 174 } |
| 164 | 175 |
| 165 CallForwardVarargsParameters const& CallForwardVarargsParametersOf( | 176 CallForwardVarargsParameters const& CallForwardVarargsParametersOf( |
| 166 Operator const* op) { | 177 Operator const* op) { |
| 167 DCHECK_EQ(IrOpcode::kJSCallForwardVarargs, op->opcode()); | 178 DCHECK_EQ(IrOpcode::kJSCallForwardVarargs, op->opcode()); |
| 168 return OpParameter<CallForwardVarargsParameters>(op); | 179 return OpParameter<CallForwardVarargsParameters>(op); |
| 169 } | 180 } |
| (...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 797 | 808 |
| 798 const Operator* JSOperatorBuilder::ToBoolean(ToBooleanHints hints) { | 809 const Operator* JSOperatorBuilder::ToBoolean(ToBooleanHints hints) { |
| 799 // TODO(turbofan): Cache most important versions of this operator. | 810 // TODO(turbofan): Cache most important versions of this operator. |
| 800 return new (zone()) Operator1<ToBooleanHints>( //-- | 811 return new (zone()) Operator1<ToBooleanHints>( //-- |
| 801 IrOpcode::kJSToBoolean, Operator::kPure, // opcode | 812 IrOpcode::kJSToBoolean, Operator::kPure, // opcode |
| 802 "JSToBoolean", // name | 813 "JSToBoolean", // name |
| 803 1, 0, 0, 1, 0, 0, // inputs/outputs | 814 1, 0, 0, 1, 0, 0, // inputs/outputs |
| 804 hints); // parameter | 815 hints); // parameter |
| 805 } | 816 } |
| 806 | 817 |
| 807 const Operator* JSOperatorBuilder::CallForwardVarargs( | |
| 808 size_t arity, uint32_t start_index, TailCallMode tail_call_mode) { | |
| 809 CallForwardVarargsParameters parameters(arity, start_index, tail_call_mode); | |
| 810 return new (zone()) Operator1<CallForwardVarargsParameters>( // -- | |
| 811 IrOpcode::kJSCallForwardVarargs, Operator::kNoProperties, // opcode | |
| 812 "JSCallForwardVarargs", // name | |
| 813 parameters.arity(), 1, 1, 1, 1, 2, // counts | |
| 814 parameters); // parameter | |
| 815 } | |
| 816 | |
| 817 const Operator* JSOperatorBuilder::Call(size_t arity, CallFrequency frequency, | 818 const Operator* JSOperatorBuilder::Call(size_t arity, CallFrequency frequency, |
| 818 VectorSlotPair const& feedback, | 819 VectorSlotPair const& feedback, |
| 819 ConvertReceiverMode convert_mode, | 820 ConvertReceiverMode convert_mode, |
| 820 TailCallMode tail_call_mode) { | 821 TailCallMode tail_call_mode) { |
| 821 CallParameters parameters(arity, frequency, feedback, tail_call_mode, | 822 CallParameters parameters(arity, frequency, feedback, tail_call_mode, |
| 822 convert_mode); | 823 convert_mode); |
| 823 return new (zone()) Operator1<CallParameters>( // -- | 824 return new (zone()) Operator1<CallParameters>( // -- |
| 824 IrOpcode::kJSCall, Operator::kNoProperties, // opcode | 825 IrOpcode::kJSCall, Operator::kNoProperties, // opcode |
| 825 "JSCall", // name | 826 "JSCall", // name |
| 826 parameters.arity(), 1, 1, 1, 1, 2, // inputs/outputs | 827 parameters.arity(), 1, 1, 1, 1, 2, // inputs/outputs |
| 827 parameters); // parameter | 828 parameters); // parameter |
| 828 } | 829 } |
| 829 | 830 |
| 831 const Operator* JSOperatorBuilder::CallForwardVarargs( |
| 832 size_t arity, uint32_t start_index, TailCallMode tail_call_mode) { |
| 833 CallForwardVarargsParameters parameters(arity, start_index, tail_call_mode); |
| 834 return new (zone()) Operator1<CallForwardVarargsParameters>( // -- |
| 835 IrOpcode::kJSCallForwardVarargs, Operator::kNoProperties, // opcode |
| 836 "JSCallForwardVarargs", // name |
| 837 parameters.arity(), 1, 1, 1, 1, 2, // counts |
| 838 parameters); // parameter |
| 839 } |
| 840 |
| 841 const Operator* JSOperatorBuilder::CallVarargs( |
| 842 size_t arity) { |
| 843 CallVarargsParameters parameters(arity); |
| 844 return new (zone()) Operator1<CallVarargsParameters>( // -- |
| 845 IrOpcode::kJSCallVarargs, Operator::kNoProperties, // opcode |
| 846 "JSCallVarargs", // name |
| 847 parameters.arity() + 2, 1, 1, 1, 1, 2, // counts |
| 848 parameters); // parameter |
| 849 } |
| 850 |
| 830 const Operator* JSOperatorBuilder::CallWithArrayLike(CallFrequency frequency) { | 851 const Operator* JSOperatorBuilder::CallWithArrayLike(CallFrequency frequency) { |
| 831 return new (zone()) Operator1<CallFrequency>( // -- | 852 return new (zone()) Operator1<CallFrequency>( // -- |
| 832 IrOpcode::kJSCallWithArrayLike, Operator::kNoProperties, // opcode | 853 IrOpcode::kJSCallWithArrayLike, Operator::kNoProperties, // opcode |
| 833 "JSCallWithArrayLike", // name | 854 "JSCallWithArrayLike", // name |
| 834 3, 1, 1, 1, 1, 2, // counts | 855 3, 1, 1, 1, 1, 2, // counts |
| 835 frequency); // parameter | 856 frequency); // parameter |
| 836 } | 857 } |
| 837 | 858 |
| 838 const Operator* JSOperatorBuilder::CallWithSpread(uint32_t arity) { | 859 const Operator* JSOperatorBuilder::CallWithSpread(uint32_t arity) { |
| 839 SpreadWithArityParameter parameters(arity); | 860 SpreadWithArityParameter parameters(arity); |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1175 return new (zone()) Operator1<Handle<ScopeInfo>>( // -- | 1196 return new (zone()) Operator1<Handle<ScopeInfo>>( // -- |
| 1176 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode | 1197 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode |
| 1177 "JSCreateScriptContext", // name | 1198 "JSCreateScriptContext", // name |
| 1178 1, 1, 1, 1, 1, 2, // counts | 1199 1, 1, 1, 1, 1, 2, // counts |
| 1179 scope_info); // parameter | 1200 scope_info); // parameter |
| 1180 } | 1201 } |
| 1181 | 1202 |
| 1182 } // namespace compiler | 1203 } // namespace compiler |
| 1183 } // namespace internal | 1204 } // namespace internal |
| 1184 } // namespace v8 | 1205 } // namespace v8 |
| OLD | NEW |