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" |
11 #include "src/compiler/operator.h" | 11 #include "src/compiler/operator.h" |
12 #include "src/feedback-vector.h" | 12 #include "src/feedback-vector.h" |
13 #include "src/handles-inl.h" | 13 #include "src/handles-inl.h" |
14 #include "src/objects-inl.h" | 14 #include "src/objects-inl.h" |
15 | 15 |
16 namespace v8 { | 16 namespace v8 { |
17 namespace internal { | 17 namespace internal { |
18 namespace compiler { | 18 namespace compiler { |
19 | 19 |
20 std::ostream& operator<<(std::ostream& os, CallFrequency f) { | 20 std::ostream& operator<<(std::ostream& os, CallFrequency f) { |
21 if (f.IsUnknown()) return os << "unknown"; | 21 if (f.IsUnknown()) return os << "unknown"; |
22 return os << f.value(); | 22 return os << f.value(); |
23 } | 23 } |
24 | 24 |
| 25 CallFrequency CallFrequencyOf(Operator const* op) { |
| 26 DCHECK_EQ(IrOpcode::kJSCallWithArrayLike, op->opcode()); |
| 27 return OpParameter<CallFrequency>(op); |
| 28 } |
| 29 |
25 VectorSlotPair::VectorSlotPair() {} | 30 VectorSlotPair::VectorSlotPair() {} |
26 | 31 |
27 | 32 |
28 int VectorSlotPair::index() const { | 33 int VectorSlotPair::index() const { |
29 return vector_.is_null() ? -1 : FeedbackVector::GetIndex(slot_); | 34 return vector_.is_null() ? -1 : FeedbackVector::GetIndex(slot_); |
30 } | 35 } |
31 | 36 |
32 | 37 |
33 bool operator==(VectorSlotPair const& lhs, VectorSlotPair const& rhs) { | 38 bool operator==(VectorSlotPair const& lhs, VectorSlotPair const& rhs) { |
34 return lhs.slot() == rhs.slot() && | 39 return lhs.slot() == rhs.slot() && |
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
814 TailCallMode tail_call_mode) { | 819 TailCallMode tail_call_mode) { |
815 CallParameters parameters(arity, frequency, feedback, tail_call_mode, | 820 CallParameters parameters(arity, frequency, feedback, tail_call_mode, |
816 convert_mode); | 821 convert_mode); |
817 return new (zone()) Operator1<CallParameters>( // -- | 822 return new (zone()) Operator1<CallParameters>( // -- |
818 IrOpcode::kJSCall, Operator::kNoProperties, // opcode | 823 IrOpcode::kJSCall, Operator::kNoProperties, // opcode |
819 "JSCall", // name | 824 "JSCall", // name |
820 parameters.arity(), 1, 1, 1, 1, 2, // inputs/outputs | 825 parameters.arity(), 1, 1, 1, 1, 2, // inputs/outputs |
821 parameters); // parameter | 826 parameters); // parameter |
822 } | 827 } |
823 | 828 |
| 829 const Operator* JSOperatorBuilder::CallWithArrayLike(CallFrequency frequency) { |
| 830 return new (zone()) Operator1<CallFrequency>( // -- |
| 831 IrOpcode::kJSCallWithArrayLike, Operator::kNoProperties, // opcode |
| 832 "JSCallWithArrayLike", // name |
| 833 3, 1, 1, 1, 1, 2, // counts |
| 834 frequency); // parameter |
| 835 } |
| 836 |
824 const Operator* JSOperatorBuilder::CallWithSpread(uint32_t arity) { | 837 const Operator* JSOperatorBuilder::CallWithSpread(uint32_t arity) { |
825 SpreadWithArityParameter parameters(arity); | 838 SpreadWithArityParameter parameters(arity); |
826 return new (zone()) Operator1<SpreadWithArityParameter>( // -- | 839 return new (zone()) Operator1<SpreadWithArityParameter>( // -- |
827 IrOpcode::kJSCallWithSpread, Operator::kNoProperties, // opcode | 840 IrOpcode::kJSCallWithSpread, Operator::kNoProperties, // opcode |
828 "JSCallWithSpread", // name | 841 "JSCallWithSpread", // name |
829 parameters.arity(), 1, 1, 1, 1, 2, // counts | 842 parameters.arity(), 1, 1, 1, 1, 2, // counts |
830 parameters); // parameter | 843 parameters); // parameter |
831 } | 844 } |
832 | 845 |
833 const Operator* JSOperatorBuilder::CallRuntime(Runtime::FunctionId id) { | 846 const Operator* JSOperatorBuilder::CallRuntime(Runtime::FunctionId id) { |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1151 return new (zone()) Operator1<Handle<ScopeInfo>>( // -- | 1164 return new (zone()) Operator1<Handle<ScopeInfo>>( // -- |
1152 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode | 1165 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode |
1153 "JSCreateScriptContext", // name | 1166 "JSCreateScriptContext", // name |
1154 1, 1, 1, 1, 1, 2, // counts | 1167 1, 1, 1, 1, 1, 2, // counts |
1155 scope_info); // parameter | 1168 scope_info); // parameter |
1156 } | 1169 } |
1157 | 1170 |
1158 } // namespace compiler | 1171 } // namespace compiler |
1159 } // namespace internal | 1172 } // namespace internal |
1160 } // namespace v8 | 1173 } // namespace v8 |
OLD | NEW |