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 bool operator==(CallFunctionWithSpreadParameters const& lhs, |
| 122 CallFunctionWithSpreadParameters const& rhs) { |
| 123 return lhs.arity() == rhs.arity(); |
| 124 } |
| 125 |
| 126 bool operator!=(CallFunctionWithSpreadParameters const& lhs, |
| 127 CallFunctionWithSpreadParameters const& rhs) { |
| 128 return !(lhs == rhs); |
| 129 } |
| 130 |
| 131 size_t hash_value(CallFunctionWithSpreadParameters const& p) { |
| 132 return base::hash_combine(p.arity()); |
| 133 } |
| 134 |
| 135 std::ostream& operator<<(std::ostream& os, |
| 136 CallFunctionWithSpreadParameters const& p) { |
| 137 return os << p.arity(); |
| 138 } |
| 139 |
| 140 CallFunctionWithSpreadParameters const& CallFunctionWithSpreadParametersOf( |
| 141 Operator const* op) { |
| 142 DCHECK_EQ(IrOpcode::kJSCallFunctionWithSpread, op->opcode()); |
| 143 return OpParameter<CallFunctionWithSpreadParameters>(op); |
| 144 } |
121 | 145 |
122 bool operator==(CallRuntimeParameters const& lhs, | 146 bool operator==(CallRuntimeParameters const& lhs, |
123 CallRuntimeParameters const& rhs) { | 147 CallRuntimeParameters const& rhs) { |
124 return lhs.id() == rhs.id() && lhs.arity() == rhs.arity(); | 148 return lhs.id() == rhs.id() && lhs.arity() == rhs.arity(); |
125 } | 149 } |
126 | 150 |
127 | 151 |
128 bool operator!=(CallRuntimeParameters const& lhs, | 152 bool operator!=(CallRuntimeParameters const& lhs, |
129 CallRuntimeParameters const& rhs) { | 153 CallRuntimeParameters const& rhs) { |
130 return !(lhs == rhs); | 154 return !(lhs == rhs); |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
705 ConvertReceiverMode convert_mode, TailCallMode tail_call_mode) { | 729 ConvertReceiverMode convert_mode, TailCallMode tail_call_mode) { |
706 CallFunctionParameters parameters(arity, frequency, feedback, tail_call_mode, | 730 CallFunctionParameters parameters(arity, frequency, feedback, tail_call_mode, |
707 convert_mode); | 731 convert_mode); |
708 return new (zone()) Operator1<CallFunctionParameters>( // -- | 732 return new (zone()) Operator1<CallFunctionParameters>( // -- |
709 IrOpcode::kJSCallFunction, Operator::kNoProperties, // opcode | 733 IrOpcode::kJSCallFunction, Operator::kNoProperties, // opcode |
710 "JSCallFunction", // name | 734 "JSCallFunction", // name |
711 parameters.arity(), 1, 1, 1, 1, 2, // inputs/outputs | 735 parameters.arity(), 1, 1, 1, 1, 2, // inputs/outputs |
712 parameters); // parameter | 736 parameters); // parameter |
713 } | 737 } |
714 | 738 |
| 739 const Operator* JSOperatorBuilder::CallFunctionWithSpread(uint32_t arity) { |
| 740 CallFunctionWithSpreadParameters parameters(arity); |
| 741 return new (zone()) Operator1<CallFunctionWithSpreadParameters>( // -- |
| 742 IrOpcode::kJSCallFunctionWithSpread, Operator::kNoProperties, // opcode |
| 743 "JSCallFunctionWithSpread", // name |
| 744 parameters.arity(), 1, 1, 1, 1, 2, // counts |
| 745 parameters); // parameter |
| 746 } |
715 | 747 |
716 const Operator* JSOperatorBuilder::CallRuntime(Runtime::FunctionId id) { | 748 const Operator* JSOperatorBuilder::CallRuntime(Runtime::FunctionId id) { |
717 const Runtime::Function* f = Runtime::FunctionForId(id); | 749 const Runtime::Function* f = Runtime::FunctionForId(id); |
718 return CallRuntime(f, f->nargs); | 750 return CallRuntime(f, f->nargs); |
719 } | 751 } |
720 | 752 |
721 | 753 |
722 const Operator* JSOperatorBuilder::CallRuntime(Runtime::FunctionId id, | 754 const Operator* JSOperatorBuilder::CallRuntime(Runtime::FunctionId id, |
723 size_t arity) { | 755 size_t arity) { |
724 const Runtime::Function* f = Runtime::FunctionForId(id); | 756 const Runtime::Function* f = Runtime::FunctionForId(id); |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1008 return new (zone()) Operator1<Handle<ScopeInfo>>( // -- | 1040 return new (zone()) Operator1<Handle<ScopeInfo>>( // -- |
1009 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode | 1041 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode |
1010 "JSCreateScriptContext", // name | 1042 "JSCreateScriptContext", // name |
1011 1, 1, 1, 1, 1, 2, // counts | 1043 1, 1, 1, 1, 1, 2, // counts |
1012 scope_info); // parameter | 1044 scope_info); // parameter |
1013 } | 1045 } |
1014 | 1046 |
1015 } // namespace compiler | 1047 } // namespace compiler |
1016 } // namespace internal | 1048 } // namespace internal |
1017 } // namespace v8 | 1049 } // namespace v8 |
OLD | NEW |