Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/compiler/js-operator.h

Issue 2890023004: [turbofan] Avoid allocating rest parameters for spread calls. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/js-generic-lowering.cc ('k') | src/compiler/js-operator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 #ifndef V8_COMPILER_JS_OPERATOR_H_ 5 #ifndef V8_COMPILER_JS_OPERATOR_H_
6 #define V8_COMPILER_JS_OPERATOR_H_ 6 #define V8_COMPILER_JS_OPERATOR_H_
7 7
8 #include "src/base/compiler-specific.h" 8 #include "src/base/compiler-specific.h"
9 #include "src/globals.h" 9 #include "src/globals.h"
10 #include "src/handles.h" 10 #include "src/handles.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 size_t hash_value(VectorSlotPair const&); 83 size_t hash_value(VectorSlotPair const&);
84 84
85 85
86 // The ConvertReceiverMode is used as parameter by JSConvertReceiver operators. 86 // The ConvertReceiverMode is used as parameter by JSConvertReceiver operators.
87 ConvertReceiverMode ConvertReceiverModeOf(Operator const* op); 87 ConvertReceiverMode ConvertReceiverModeOf(Operator const* op);
88 88
89 89
90 // The ToBooleanHints are used as parameter by JSToBoolean operators. 90 // The ToBooleanHints are used as parameter by JSToBoolean operators.
91 ToBooleanHints ToBooleanHintsOf(Operator const* op); 91 ToBooleanHints ToBooleanHintsOf(Operator const* op);
92 92
93 // Defines the flags for a JavaScript call forwarding parameters. This
94 // is used as parameter by JSConstructForwardVarargs operators.
95 class ConstructForwardVarargsParameters final {
96 public:
97 ConstructForwardVarargsParameters(size_t arity, uint32_t start_index)
98 : bit_field_(ArityField::encode(arity) |
99 StartIndexField::encode(start_index)) {}
100
101 size_t arity() const { return ArityField::decode(bit_field_); }
102 uint32_t start_index() const { return StartIndexField::decode(bit_field_); }
103
104 bool operator==(ConstructForwardVarargsParameters const& that) const {
105 return this->bit_field_ == that.bit_field_;
106 }
107 bool operator!=(ConstructForwardVarargsParameters const& that) const {
108 return !(*this == that);
109 }
110
111 private:
112 friend size_t hash_value(ConstructForwardVarargsParameters const& p) {
113 return p.bit_field_;
114 }
115
116 typedef BitField<size_t, 0, 16> ArityField;
117 typedef BitField<uint32_t, 16, 16> StartIndexField;
118
119 uint32_t const bit_field_;
120 };
121
122 std::ostream& operator<<(std::ostream&,
123 ConstructForwardVarargsParameters const&);
124
125 ConstructForwardVarargsParameters const& ConstructForwardVarargsParametersOf(
126 Operator const*) WARN_UNUSED_RESULT;
93 127
94 // Defines the arity and the feedback for a JavaScript constructor call. This is 128 // Defines the arity and the feedback for a JavaScript constructor call. This is
95 // used as a parameter by JSConstruct operators. 129 // used as a parameter by JSConstruct operators.
96 class ConstructParameters final { 130 class ConstructParameters final {
97 public: 131 public:
98 ConstructParameters(uint32_t arity, CallFrequency frequency, 132 ConstructParameters(uint32_t arity, CallFrequency frequency,
99 VectorSlotPair const& feedback) 133 VectorSlotPair const& feedback)
100 : arity_(arity), frequency_(frequency), feedback_(feedback) {} 134 : arity_(arity), frequency_(frequency), feedback_(feedback) {}
101 135
102 uint32_t arity() const { return arity_; } 136 uint32_t arity() const { return arity_; }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 size_t hash_value(SpreadWithArityParameter const&); 173 size_t hash_value(SpreadWithArityParameter const&);
140 174
141 std::ostream& operator<<(std::ostream&, SpreadWithArityParameter const&); 175 std::ostream& operator<<(std::ostream&, SpreadWithArityParameter const&);
142 176
143 SpreadWithArityParameter const& SpreadWithArityParameterOf(Operator const*); 177 SpreadWithArityParameter const& SpreadWithArityParameterOf(Operator const*);
144 178
145 // Defines the flags for a JavaScript call forwarding parameters. This 179 // Defines the flags for a JavaScript call forwarding parameters. This
146 // is used as parameter by JSCallForwardVarargs operators. 180 // is used as parameter by JSCallForwardVarargs operators.
147 class CallForwardVarargsParameters final { 181 class CallForwardVarargsParameters final {
148 public: 182 public:
149 CallForwardVarargsParameters(uint32_t start_index, 183 CallForwardVarargsParameters(size_t arity, uint32_t start_index,
150 TailCallMode tail_call_mode) 184 TailCallMode tail_call_mode)
151 : bit_field_(StartIndexField::encode(start_index) | 185 : bit_field_(ArityField::encode(arity) |
186 StartIndexField::encode(start_index) |
152 TailCallModeField::encode(tail_call_mode)) {} 187 TailCallModeField::encode(tail_call_mode)) {}
153 188
189 size_t arity() const { return ArityField::decode(bit_field_); }
154 uint32_t start_index() const { return StartIndexField::decode(bit_field_); } 190 uint32_t start_index() const { return StartIndexField::decode(bit_field_); }
155 TailCallMode tail_call_mode() const { 191 TailCallMode tail_call_mode() const {
156 return TailCallModeField::decode(bit_field_); 192 return TailCallModeField::decode(bit_field_);
157 } 193 }
158 194
159 bool operator==(CallForwardVarargsParameters const& that) const { 195 bool operator==(CallForwardVarargsParameters const& that) const {
160 return this->bit_field_ == that.bit_field_; 196 return this->bit_field_ == that.bit_field_;
161 } 197 }
162 bool operator!=(CallForwardVarargsParameters const& that) const { 198 bool operator!=(CallForwardVarargsParameters const& that) const {
163 return !(*this == that); 199 return !(*this == that);
164 } 200 }
165 201
166 private: 202 private:
167 friend size_t hash_value(CallForwardVarargsParameters const& p) { 203 friend size_t hash_value(CallForwardVarargsParameters const& p) {
168 return p.bit_field_; 204 return p.bit_field_;
169 } 205 }
170 206
171 typedef BitField<uint32_t, 0, 30> StartIndexField; 207 typedef BitField<size_t, 0, 15> ArityField;
172 typedef BitField<TailCallMode, 31, 1> TailCallModeField; 208 typedef BitField<uint32_t, 15, 15> StartIndexField;
209 typedef BitField<TailCallMode, 30, 1> TailCallModeField;
173 210
174 uint32_t const bit_field_; 211 uint32_t const bit_field_;
175 }; 212 };
176 213
177 std::ostream& operator<<(std::ostream&, CallForwardVarargsParameters const&); 214 std::ostream& operator<<(std::ostream&, CallForwardVarargsParameters const&);
178 215
179 CallForwardVarargsParameters const& CallForwardVarargsParametersOf( 216 CallForwardVarargsParameters const& CallForwardVarargsParametersOf(
180 Operator const*) WARN_UNUSED_RESULT; 217 Operator const*) WARN_UNUSED_RESULT;
181 218
182 // Defines the arity and the call flags for a JavaScript function call. This is 219 // Defines the arity and the call flags for a JavaScript function call. This is
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 const Operator* CreateKeyValueArray(); 695 const Operator* CreateKeyValueArray();
659 const Operator* CreateLiteralArray(Handle<ConstantElementsPair> constant, 696 const Operator* CreateLiteralArray(Handle<ConstantElementsPair> constant,
660 int literal_flags, int literal_index, 697 int literal_flags, int literal_index,
661 int number_of_elements); 698 int number_of_elements);
662 const Operator* CreateLiteralObject(Handle<BoilerplateDescription> constant, 699 const Operator* CreateLiteralObject(Handle<BoilerplateDescription> constant,
663 int literal_flags, int literal_index, 700 int literal_flags, int literal_index,
664 int number_of_properties); 701 int number_of_properties);
665 const Operator* CreateLiteralRegExp(Handle<String> constant_pattern, 702 const Operator* CreateLiteralRegExp(Handle<String> constant_pattern,
666 int literal_flags, int literal_index); 703 int literal_flags, int literal_index);
667 704
668 const Operator* CallForwardVarargs(uint32_t start_index, 705 const Operator* CallForwardVarargs(size_t arity, uint32_t start_index,
669 TailCallMode tail_call_mode); 706 TailCallMode tail_call_mode);
670 const Operator* Call( 707 const Operator* Call(
671 size_t arity, CallFrequency frequency = CallFrequency(), 708 size_t arity, CallFrequency frequency = CallFrequency(),
672 VectorSlotPair const& feedback = VectorSlotPair(), 709 VectorSlotPair const& feedback = VectorSlotPair(),
673 ConvertReceiverMode convert_mode = ConvertReceiverMode::kAny, 710 ConvertReceiverMode convert_mode = ConvertReceiverMode::kAny,
674 TailCallMode tail_call_mode = TailCallMode::kDisallow); 711 TailCallMode tail_call_mode = TailCallMode::kDisallow);
675 const Operator* CallWithSpread(uint32_t arity); 712 const Operator* CallWithSpread(uint32_t arity);
676 const Operator* CallRuntime(Runtime::FunctionId id); 713 const Operator* CallRuntime(Runtime::FunctionId id);
677 const Operator* CallRuntime(Runtime::FunctionId id, size_t arity); 714 const Operator* CallRuntime(Runtime::FunctionId id, size_t arity);
678 const Operator* CallRuntime(const Runtime::Function* function, size_t arity); 715 const Operator* CallRuntime(const Runtime::Function* function, size_t arity);
716
717 const Operator* ConstructForwardVarargs(size_t arity, uint32_t start_index);
679 const Operator* Construct(uint32_t arity, 718 const Operator* Construct(uint32_t arity,
680 CallFrequency frequency = CallFrequency(), 719 CallFrequency frequency = CallFrequency(),
681 VectorSlotPair const& feedback = VectorSlotPair()); 720 VectorSlotPair const& feedback = VectorSlotPair());
682 const Operator* ConstructWithSpread(uint32_t arity); 721 const Operator* ConstructWithSpread(uint32_t arity);
683 722
684 const Operator* ConvertReceiver(ConvertReceiverMode convert_mode); 723 const Operator* ConvertReceiver(ConvertReceiverMode convert_mode);
685 724
686 const Operator* LoadProperty(VectorSlotPair const& feedback); 725 const Operator* LoadProperty(VectorSlotPair const& feedback);
687 const Operator* LoadNamed(Handle<Name> name, VectorSlotPair const& feedback); 726 const Operator* LoadNamed(Handle<Name> name, VectorSlotPair const& feedback);
688 727
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 Zone* const zone_; 792 Zone* const zone_;
754 793
755 DISALLOW_COPY_AND_ASSIGN(JSOperatorBuilder); 794 DISALLOW_COPY_AND_ASSIGN(JSOperatorBuilder);
756 }; 795 };
757 796
758 } // namespace compiler 797 } // namespace compiler
759 } // namespace internal 798 } // namespace internal
760 } // namespace v8 799 } // namespace v8
761 800
762 #endif // V8_COMPILER_JS_OPERATOR_H_ 801 #endif // V8_COMPILER_JS_OPERATOR_H_
OLDNEW
« no previous file with comments | « src/compiler/js-generic-lowering.cc ('k') | src/compiler/js-operator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698