| 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) { | 25 CallFrequency CallFrequencyOf(Operator const* op) { |
| 26 DCHECK_EQ(IrOpcode::kJSCallWithArrayLike, op->opcode()); | 26 DCHECK(op->opcode() == IrOpcode::kJSCallWithArrayLike || |
| 27 op->opcode() == IrOpcode::kJSConstructWithArrayLike); |
| 27 return OpParameter<CallFrequency>(op); | 28 return OpParameter<CallFrequency>(op); |
| 28 } | 29 } |
| 29 | 30 |
| 30 VectorSlotPair::VectorSlotPair() {} | 31 VectorSlotPair::VectorSlotPair() {} |
| 31 | 32 |
| 32 | 33 |
| 33 int VectorSlotPair::index() const { | 34 int VectorSlotPair::index() const { |
| 34 return vector_.is_null() ? -1 : FeedbackVector::GetIndex(slot_); | 35 return vector_.is_null() ? -1 : FeedbackVector::GetIndex(slot_); |
| 35 } | 36 } |
| 36 | 37 |
| (...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 881 CallFrequency frequency, | 882 CallFrequency frequency, |
| 882 VectorSlotPair const& feedback) { | 883 VectorSlotPair const& feedback) { |
| 883 ConstructParameters parameters(arity, frequency, feedback); | 884 ConstructParameters parameters(arity, frequency, feedback); |
| 884 return new (zone()) Operator1<ConstructParameters>( // -- | 885 return new (zone()) Operator1<ConstructParameters>( // -- |
| 885 IrOpcode::kJSConstruct, Operator::kNoProperties, // opcode | 886 IrOpcode::kJSConstruct, Operator::kNoProperties, // opcode |
| 886 "JSConstruct", // name | 887 "JSConstruct", // name |
| 887 parameters.arity(), 1, 1, 1, 1, 2, // counts | 888 parameters.arity(), 1, 1, 1, 1, 2, // counts |
| 888 parameters); // parameter | 889 parameters); // parameter |
| 889 } | 890 } |
| 890 | 891 |
| 892 const Operator* JSOperatorBuilder::ConstructWithArrayLike( |
| 893 CallFrequency frequency) { |
| 894 return new (zone()) Operator1<CallFrequency>( // -- |
| 895 IrOpcode::kJSConstructWithArrayLike, // opcode |
| 896 Operator::kNoProperties, // properties |
| 897 "JSConstructWithArrayLike", // name |
| 898 3, 1, 1, 1, 1, 2, // counts |
| 899 frequency); // parameter |
| 900 } |
| 901 |
| 891 const Operator* JSOperatorBuilder::ConstructWithSpread(uint32_t arity) { | 902 const Operator* JSOperatorBuilder::ConstructWithSpread(uint32_t arity) { |
| 892 SpreadWithArityParameter parameters(arity); | 903 SpreadWithArityParameter parameters(arity); |
| 893 return new (zone()) Operator1<SpreadWithArityParameter>( // -- | 904 return new (zone()) Operator1<SpreadWithArityParameter>( // -- |
| 894 IrOpcode::kJSConstructWithSpread, Operator::kNoProperties, // opcode | 905 IrOpcode::kJSConstructWithSpread, Operator::kNoProperties, // opcode |
| 895 "JSConstructWithSpread", // name | 906 "JSConstructWithSpread", // name |
| 896 parameters.arity(), 1, 1, 1, 1, 2, // counts | 907 parameters.arity(), 1, 1, 1, 1, 2, // counts |
| 897 parameters); // parameter | 908 parameters); // parameter |
| 898 } | 909 } |
| 899 | 910 |
| 900 const Operator* JSOperatorBuilder::ConvertReceiver( | 911 const Operator* JSOperatorBuilder::ConvertReceiver( |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1164 return new (zone()) Operator1<Handle<ScopeInfo>>( // -- | 1175 return new (zone()) Operator1<Handle<ScopeInfo>>( // -- |
| 1165 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode | 1176 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode |
| 1166 "JSCreateScriptContext", // name | 1177 "JSCreateScriptContext", // name |
| 1167 1, 1, 1, 1, 1, 2, // counts | 1178 1, 1, 1, 1, 1, 2, // counts |
| 1168 scope_info); // parameter | 1179 scope_info); // parameter |
| 1169 } | 1180 } |
| 1170 | 1181 |
| 1171 } // namespace compiler | 1182 } // namespace compiler |
| 1172 } // namespace internal | 1183 } // namespace internal |
| 1173 } // namespace v8 | 1184 } // namespace v8 |
| OLD | NEW |