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) { |
| 21 if (f.IsUnknown()) return os << "unknown"; |
| 22 return os << f.value(); |
| 23 } |
| 24 |
20 VectorSlotPair::VectorSlotPair() {} | 25 VectorSlotPair::VectorSlotPair() {} |
21 | 26 |
22 | 27 |
23 int VectorSlotPair::index() const { | 28 int VectorSlotPair::index() const { |
24 return vector_.is_null() ? -1 : FeedbackVector::GetIndex(slot_); | 29 return vector_.is_null() ? -1 : FeedbackVector::GetIndex(slot_); |
25 } | 30 } |
26 | 31 |
27 | 32 |
28 bool operator==(VectorSlotPair const& lhs, VectorSlotPair const& rhs) { | 33 bool operator==(VectorSlotPair const& lhs, VectorSlotPair const& rhs) { |
29 return lhs.slot() == rhs.slot() && | 34 return lhs.slot() == rhs.slot() && |
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 const Operator* JSOperatorBuilder::CallForwardVarargs( | 745 const Operator* JSOperatorBuilder::CallForwardVarargs( |
741 uint32_t start_index, TailCallMode tail_call_mode) { | 746 uint32_t start_index, TailCallMode tail_call_mode) { |
742 CallForwardVarargsParameters parameters(start_index, tail_call_mode); | 747 CallForwardVarargsParameters parameters(start_index, tail_call_mode); |
743 return new (zone()) Operator1<CallForwardVarargsParameters>( // -- | 748 return new (zone()) Operator1<CallForwardVarargsParameters>( // -- |
744 IrOpcode::kJSCallForwardVarargs, Operator::kNoProperties, // opcode | 749 IrOpcode::kJSCallForwardVarargs, Operator::kNoProperties, // opcode |
745 "JSCallForwardVarargs", // name | 750 "JSCallForwardVarargs", // name |
746 2, 1, 1, 1, 1, 2, // counts | 751 2, 1, 1, 1, 1, 2, // counts |
747 parameters); // parameter | 752 parameters); // parameter |
748 } | 753 } |
749 | 754 |
750 const Operator* JSOperatorBuilder::Call(size_t arity, float frequency, | 755 const Operator* JSOperatorBuilder::Call(size_t arity, CallFrequency frequency, |
751 VectorSlotPair const& feedback, | 756 VectorSlotPair const& feedback, |
752 ConvertReceiverMode convert_mode, | 757 ConvertReceiverMode convert_mode, |
753 TailCallMode tail_call_mode) { | 758 TailCallMode tail_call_mode) { |
754 CallParameters parameters(arity, frequency, feedback, tail_call_mode, | 759 CallParameters parameters(arity, frequency, feedback, tail_call_mode, |
755 convert_mode); | 760 convert_mode); |
756 return new (zone()) Operator1<CallParameters>( // -- | 761 return new (zone()) Operator1<CallParameters>( // -- |
757 IrOpcode::kJSCall, Operator::kNoProperties, // opcode | 762 IrOpcode::kJSCall, Operator::kNoProperties, // opcode |
758 "JSCall", // name | 763 "JSCall", // name |
759 parameters.arity(), 1, 1, 1, 1, 2, // inputs/outputs | 764 parameters.arity(), 1, 1, 1, 1, 2, // inputs/outputs |
760 parameters); // parameter | 765 parameters); // parameter |
(...skipping 25 matching lines...) Expand all Loading... |
786 size_t arity) { | 791 size_t arity) { |
787 CallRuntimeParameters parameters(f->function_id, arity); | 792 CallRuntimeParameters parameters(f->function_id, arity); |
788 DCHECK(f->nargs == -1 || f->nargs == static_cast<int>(parameters.arity())); | 793 DCHECK(f->nargs == -1 || f->nargs == static_cast<int>(parameters.arity())); |
789 return new (zone()) Operator1<CallRuntimeParameters>( // -- | 794 return new (zone()) Operator1<CallRuntimeParameters>( // -- |
790 IrOpcode::kJSCallRuntime, Operator::kNoProperties, // opcode | 795 IrOpcode::kJSCallRuntime, Operator::kNoProperties, // opcode |
791 "JSCallRuntime", // name | 796 "JSCallRuntime", // name |
792 parameters.arity(), 1, 1, f->result_size, 1, 2, // inputs/outputs | 797 parameters.arity(), 1, 1, f->result_size, 1, 2, // inputs/outputs |
793 parameters); // parameter | 798 parameters); // parameter |
794 } | 799 } |
795 | 800 |
796 const Operator* JSOperatorBuilder::Construct(uint32_t arity, float frequency, | 801 const Operator* JSOperatorBuilder::Construct(uint32_t arity, |
| 802 CallFrequency frequency, |
797 VectorSlotPair const& feedback) { | 803 VectorSlotPair const& feedback) { |
798 ConstructParameters parameters(arity, frequency, feedback); | 804 ConstructParameters parameters(arity, frequency, feedback); |
799 return new (zone()) Operator1<ConstructParameters>( // -- | 805 return new (zone()) Operator1<ConstructParameters>( // -- |
800 IrOpcode::kJSConstruct, Operator::kNoProperties, // opcode | 806 IrOpcode::kJSConstruct, Operator::kNoProperties, // opcode |
801 "JSConstruct", // name | 807 "JSConstruct", // name |
802 parameters.arity(), 1, 1, 1, 1, 2, // counts | 808 parameters.arity(), 1, 1, 1, 1, 2, // counts |
803 parameters); // parameter | 809 parameters); // parameter |
804 } | 810 } |
805 | 811 |
806 const Operator* JSOperatorBuilder::ConstructWithSpread(uint32_t arity) { | 812 const Operator* JSOperatorBuilder::ConstructWithSpread(uint32_t arity) { |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1074 return new (zone()) Operator1<Handle<ScopeInfo>>( // -- | 1080 return new (zone()) Operator1<Handle<ScopeInfo>>( // -- |
1075 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode | 1081 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode |
1076 "JSCreateScriptContext", // name | 1082 "JSCreateScriptContext", // name |
1077 1, 1, 1, 1, 1, 2, // counts | 1083 1, 1, 1, 1, 1, 2, // counts |
1078 scope_info); // parameter | 1084 scope_info); // parameter |
1079 } | 1085 } |
1080 | 1086 |
1081 } // namespace compiler | 1087 } // namespace compiler |
1082 } // namespace internal | 1088 } // namespace internal |
1083 } // namespace v8 | 1089 } // namespace v8 |
OLD | NEW |