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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 << p.tail_call_mode(); | 111 << p.tail_call_mode(); |
112 return os; | 112 return os; |
113 } | 113 } |
114 | 114 |
115 | 115 |
116 const CallFunctionParameters& CallFunctionParametersOf(const Operator* op) { | 116 const CallFunctionParameters& CallFunctionParametersOf(const Operator* op) { |
117 DCHECK_EQ(IrOpcode::kJSCallFunction, op->opcode()); | 117 DCHECK_EQ(IrOpcode::kJSCallFunction, op->opcode()); |
118 return OpParameter<CallFunctionParameters>(op); | 118 return OpParameter<CallFunctionParameters>(op); |
119 } | 119 } |
120 | 120 |
| 121 std::ostream& operator<<(std::ostream& os, |
| 122 CallForwardVarargsParameters const& p) { |
| 123 return os << p.start_index() << ", " << p.tail_call_mode(); |
| 124 } |
| 125 |
| 126 CallForwardVarargsParameters const& CallForwardVarargsParametersOf( |
| 127 Operator const* op) { |
| 128 DCHECK_EQ(IrOpcode::kJSCallForwardVarargs, op->opcode()); |
| 129 return OpParameter<CallForwardVarargsParameters>(op); |
| 130 } |
| 131 |
121 bool operator==(CallFunctionWithSpreadParameters const& lhs, | 132 bool operator==(CallFunctionWithSpreadParameters const& lhs, |
122 CallFunctionWithSpreadParameters const& rhs) { | 133 CallFunctionWithSpreadParameters const& rhs) { |
123 return lhs.arity() == rhs.arity(); | 134 return lhs.arity() == rhs.arity(); |
124 } | 135 } |
125 | 136 |
126 bool operator!=(CallFunctionWithSpreadParameters const& lhs, | 137 bool operator!=(CallFunctionWithSpreadParameters const& lhs, |
127 CallFunctionWithSpreadParameters const& rhs) { | 138 CallFunctionWithSpreadParameters const& rhs) { |
128 return !(lhs == rhs); | 139 return !(lhs == rhs); |
129 } | 140 } |
130 | 141 |
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
717 | 728 |
718 const Operator* JSOperatorBuilder::ToBoolean(ToBooleanHints hints) { | 729 const Operator* JSOperatorBuilder::ToBoolean(ToBooleanHints hints) { |
719 // TODO(turbofan): Cache most important versions of this operator. | 730 // TODO(turbofan): Cache most important versions of this operator. |
720 return new (zone()) Operator1<ToBooleanHints>( //-- | 731 return new (zone()) Operator1<ToBooleanHints>( //-- |
721 IrOpcode::kJSToBoolean, Operator::kPure, // opcode | 732 IrOpcode::kJSToBoolean, Operator::kPure, // opcode |
722 "JSToBoolean", // name | 733 "JSToBoolean", // name |
723 1, 0, 0, 1, 0, 0, // inputs/outputs | 734 1, 0, 0, 1, 0, 0, // inputs/outputs |
724 hints); // parameter | 735 hints); // parameter |
725 } | 736 } |
726 | 737 |
| 738 const Operator* JSOperatorBuilder::CallForwardVarargs( |
| 739 uint32_t start_index, TailCallMode tail_call_mode) { |
| 740 CallForwardVarargsParameters parameters(start_index, tail_call_mode); |
| 741 return new (zone()) Operator1<CallForwardVarargsParameters>( // -- |
| 742 IrOpcode::kJSCallForwardVarargs, Operator::kNoProperties, // opcode |
| 743 "JSCallForwardVarargs", // name |
| 744 2, 1, 1, 1, 1, 2, // counts |
| 745 parameters); // parameter |
| 746 } |
| 747 |
727 const Operator* JSOperatorBuilder::CallFunction( | 748 const Operator* JSOperatorBuilder::CallFunction( |
728 size_t arity, float frequency, VectorSlotPair const& feedback, | 749 size_t arity, float frequency, VectorSlotPair const& feedback, |
729 ConvertReceiverMode convert_mode, TailCallMode tail_call_mode) { | 750 ConvertReceiverMode convert_mode, TailCallMode tail_call_mode) { |
730 CallFunctionParameters parameters(arity, frequency, feedback, tail_call_mode, | 751 CallFunctionParameters parameters(arity, frequency, feedback, tail_call_mode, |
731 convert_mode); | 752 convert_mode); |
732 return new (zone()) Operator1<CallFunctionParameters>( // -- | 753 return new (zone()) Operator1<CallFunctionParameters>( // -- |
733 IrOpcode::kJSCallFunction, Operator::kNoProperties, // opcode | 754 IrOpcode::kJSCallFunction, Operator::kNoProperties, // opcode |
734 "JSCallFunction", // name | 755 "JSCallFunction", // name |
735 parameters.arity(), 1, 1, 1, 1, 2, // inputs/outputs | 756 parameters.arity(), 1, 1, 1, 1, 2, // inputs/outputs |
736 parameters); // parameter | 757 parameters); // parameter |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1040 return new (zone()) Operator1<Handle<ScopeInfo>>( // -- | 1061 return new (zone()) Operator1<Handle<ScopeInfo>>( // -- |
1041 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode | 1062 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode |
1042 "JSCreateScriptContext", // name | 1063 "JSCreateScriptContext", // name |
1043 1, 1, 1, 1, 1, 2, // counts | 1064 1, 1, 1, 1, 1, 2, // counts |
1044 scope_info); // parameter | 1065 scope_info); // parameter |
1045 } | 1066 } |
1046 | 1067 |
1047 } // namespace compiler | 1068 } // namespace compiler |
1048 } // namespace internal | 1069 } // namespace internal |
1049 } // namespace v8 | 1070 } // namespace v8 |
OLD | NEW |