| OLD | NEW |
| 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/runtime/runtime.h" | 10 #include "src/runtime/runtime.h" |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 | 140 |
| 141 uint32_t const bit_field_; | 141 uint32_t const bit_field_; |
| 142 }; | 142 }; |
| 143 | 143 |
| 144 std::ostream& operator<<(std::ostream&, CallForwardVarargsParameters const&); | 144 std::ostream& operator<<(std::ostream&, CallForwardVarargsParameters const&); |
| 145 | 145 |
| 146 CallForwardVarargsParameters const& CallForwardVarargsParametersOf( | 146 CallForwardVarargsParameters const& CallForwardVarargsParametersOf( |
| 147 Operator const*) WARN_UNUSED_RESULT; | 147 Operator const*) WARN_UNUSED_RESULT; |
| 148 | 148 |
| 149 // Defines the arity and the call flags for a JavaScript function call. This is | 149 // Defines the arity and the call flags for a JavaScript function call. This is |
| 150 // used as a parameter by JSCallFunction operators. | 150 // used as a parameter by JSCall operators. |
| 151 class CallFunctionParameters final { | 151 class CallParameters final { |
| 152 public: | 152 public: |
| 153 CallFunctionParameters(size_t arity, float frequency, | 153 CallParameters(size_t arity, float frequency, VectorSlotPair const& feedback, |
| 154 VectorSlotPair const& feedback, | 154 TailCallMode tail_call_mode, ConvertReceiverMode convert_mode) |
| 155 TailCallMode tail_call_mode, | |
| 156 ConvertReceiverMode convert_mode) | |
| 157 : bit_field_(ArityField::encode(arity) | | 155 : bit_field_(ArityField::encode(arity) | |
| 158 ConvertReceiverModeField::encode(convert_mode) | | 156 ConvertReceiverModeField::encode(convert_mode) | |
| 159 TailCallModeField::encode(tail_call_mode)), | 157 TailCallModeField::encode(tail_call_mode)), |
| 160 frequency_(frequency), | 158 frequency_(frequency), |
| 161 feedback_(feedback) {} | 159 feedback_(feedback) {} |
| 162 | 160 |
| 163 size_t arity() const { return ArityField::decode(bit_field_); } | 161 size_t arity() const { return ArityField::decode(bit_field_); } |
| 164 float frequency() const { return frequency_; } | 162 float frequency() const { return frequency_; } |
| 165 ConvertReceiverMode convert_mode() const { | 163 ConvertReceiverMode convert_mode() const { |
| 166 return ConvertReceiverModeField::decode(bit_field_); | 164 return ConvertReceiverModeField::decode(bit_field_); |
| 167 } | 165 } |
| 168 TailCallMode tail_call_mode() const { | 166 TailCallMode tail_call_mode() const { |
| 169 return TailCallModeField::decode(bit_field_); | 167 return TailCallModeField::decode(bit_field_); |
| 170 } | 168 } |
| 171 VectorSlotPair const& feedback() const { return feedback_; } | 169 VectorSlotPair const& feedback() const { return feedback_; } |
| 172 | 170 |
| 173 bool operator==(CallFunctionParameters const& that) const { | 171 bool operator==(CallParameters const& that) const { |
| 174 return this->bit_field_ == that.bit_field_ && | 172 return this->bit_field_ == that.bit_field_ && |
| 175 this->frequency_ == that.frequency_ && | 173 this->frequency_ == that.frequency_ && |
| 176 this->feedback_ == that.feedback_; | 174 this->feedback_ == that.feedback_; |
| 177 } | 175 } |
| 178 bool operator!=(CallFunctionParameters const& that) const { | 176 bool operator!=(CallParameters const& that) const { return !(*this == that); } |
| 179 return !(*this == that); | |
| 180 } | |
| 181 | 177 |
| 182 private: | 178 private: |
| 183 friend size_t hash_value(CallFunctionParameters const& p) { | 179 friend size_t hash_value(CallParameters const& p) { |
| 184 return base::hash_combine(p.bit_field_, p.frequency_, p.feedback_); | 180 return base::hash_combine(p.bit_field_, p.frequency_, p.feedback_); |
| 185 } | 181 } |
| 186 | 182 |
| 187 typedef BitField<size_t, 0, 29> ArityField; | 183 typedef BitField<size_t, 0, 29> ArityField; |
| 188 typedef BitField<ConvertReceiverMode, 29, 2> ConvertReceiverModeField; | 184 typedef BitField<ConvertReceiverMode, 29, 2> ConvertReceiverModeField; |
| 189 typedef BitField<TailCallMode, 31, 1> TailCallModeField; | 185 typedef BitField<TailCallMode, 31, 1> TailCallModeField; |
| 190 | 186 |
| 191 uint32_t const bit_field_; | 187 uint32_t const bit_field_; |
| 192 float const frequency_; | 188 float const frequency_; |
| 193 VectorSlotPair const feedback_; | 189 VectorSlotPair const feedback_; |
| 194 }; | 190 }; |
| 195 | 191 |
| 196 size_t hash_value(CallFunctionParameters const&); | 192 size_t hash_value(CallParameters const&); |
| 197 | 193 |
| 198 std::ostream& operator<<(std::ostream&, CallFunctionParameters const&); | 194 std::ostream& operator<<(std::ostream&, CallParameters const&); |
| 199 | 195 |
| 200 const CallFunctionParameters& CallFunctionParametersOf(const Operator* op); | 196 const CallParameters& CallParametersOf(const Operator* op); |
| 201 | 197 |
| 202 // Defines the arity for a JavaScript constructor call with a spread as the last | 198 // Defines the arity for a JavaScript constructor call with a spread as the last |
| 203 // parameters. This is used as a parameter by JSConstructWithSpread | 199 // parameters. This is used as a parameter by JSConstructWithSpread |
| 204 // operators. | 200 // operators. |
| 205 class CallFunctionWithSpreadParameters final { | 201 class CallWithSpreadParameters final { |
| 206 public: | 202 public: |
| 207 explicit CallFunctionWithSpreadParameters(uint32_t arity) : arity_(arity) {} | 203 explicit CallWithSpreadParameters(uint32_t arity) : arity_(arity) {} |
| 208 | 204 |
| 209 uint32_t arity() const { return arity_; } | 205 uint32_t arity() const { return arity_; } |
| 210 | 206 |
| 211 private: | 207 private: |
| 212 uint32_t const arity_; | 208 uint32_t const arity_; |
| 213 }; | 209 }; |
| 214 | 210 |
| 215 bool operator==(CallFunctionWithSpreadParameters const&, | 211 bool operator==(CallWithSpreadParameters const&, |
| 216 CallFunctionWithSpreadParameters const&); | 212 CallWithSpreadParameters const&); |
| 217 bool operator!=(CallFunctionWithSpreadParameters const&, | 213 bool operator!=(CallWithSpreadParameters const&, |
| 218 CallFunctionWithSpreadParameters const&); | 214 CallWithSpreadParameters const&); |
| 219 | 215 |
| 220 size_t hash_value(CallFunctionWithSpreadParameters const&); | 216 size_t hash_value(CallWithSpreadParameters const&); |
| 221 | 217 |
| 222 std::ostream& operator<<(std::ostream&, | 218 std::ostream& operator<<(std::ostream&, CallWithSpreadParameters const&); |
| 223 CallFunctionWithSpreadParameters const&); | |
| 224 | 219 |
| 225 CallFunctionWithSpreadParameters const& CallFunctionWithSpreadParametersOf( | 220 CallWithSpreadParameters const& CallWithSpreadParametersOf(Operator const*); |
| 226 Operator const*); | |
| 227 | 221 |
| 228 // Defines the arity and the ID for a runtime function call. This is used as a | 222 // Defines the arity and the ID for a runtime function call. This is used as a |
| 229 // parameter by JSCallRuntime operators. | 223 // parameter by JSCallRuntime operators. |
| 230 class CallRuntimeParameters final { | 224 class CallRuntimeParameters final { |
| 231 public: | 225 public: |
| 232 CallRuntimeParameters(Runtime::FunctionId id, size_t arity) | 226 CallRuntimeParameters(Runtime::FunctionId id, size_t arity) |
| 233 : id_(id), arity_(arity) {} | 227 : id_(id), arity_(arity) {} |
| 234 | 228 |
| 235 Runtime::FunctionId id() const { return id_; } | 229 Runtime::FunctionId id() const { return id_; } |
| 236 size_t arity() const { return arity_; } | 230 size_t arity() const { return arity_; } |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 int literal_flags, int literal_index, | 601 int literal_flags, int literal_index, |
| 608 int number_of_elements); | 602 int number_of_elements); |
| 609 const Operator* CreateLiteralObject(Handle<BoilerplateDescription> constant, | 603 const Operator* CreateLiteralObject(Handle<BoilerplateDescription> constant, |
| 610 int literal_flags, int literal_index, | 604 int literal_flags, int literal_index, |
| 611 int number_of_properties); | 605 int number_of_properties); |
| 612 const Operator* CreateLiteralRegExp(Handle<String> constant_pattern, | 606 const Operator* CreateLiteralRegExp(Handle<String> constant_pattern, |
| 613 int literal_flags, int literal_index); | 607 int literal_flags, int literal_index); |
| 614 | 608 |
| 615 const Operator* CallForwardVarargs(uint32_t start_index, | 609 const Operator* CallForwardVarargs(uint32_t start_index, |
| 616 TailCallMode tail_call_mode); | 610 TailCallMode tail_call_mode); |
| 617 const Operator* CallFunction( | 611 const Operator* Call( |
| 618 size_t arity, float frequency = 0.0f, | 612 size_t arity, float frequency = 0.0f, |
| 619 VectorSlotPair const& feedback = VectorSlotPair(), | 613 VectorSlotPair const& feedback = VectorSlotPair(), |
| 620 ConvertReceiverMode convert_mode = ConvertReceiverMode::kAny, | 614 ConvertReceiverMode convert_mode = ConvertReceiverMode::kAny, |
| 621 TailCallMode tail_call_mode = TailCallMode::kDisallow); | 615 TailCallMode tail_call_mode = TailCallMode::kDisallow); |
| 622 const Operator* CallFunctionWithSpread(uint32_t arity); | 616 const Operator* CallWithSpread(uint32_t arity); |
| 623 const Operator* CallRuntime(Runtime::FunctionId id); | 617 const Operator* CallRuntime(Runtime::FunctionId id); |
| 624 const Operator* CallRuntime(Runtime::FunctionId id, size_t arity); | 618 const Operator* CallRuntime(Runtime::FunctionId id, size_t arity); |
| 625 const Operator* CallRuntime(const Runtime::Function* function, size_t arity); | 619 const Operator* CallRuntime(const Runtime::Function* function, size_t arity); |
| 626 const Operator* Construct(uint32_t arity, float frequency, | 620 const Operator* Construct(uint32_t arity, float frequency, |
| 627 VectorSlotPair const& feedback); | 621 VectorSlotPair const& feedback); |
| 628 const Operator* ConstructWithSpread(uint32_t arity); | 622 const Operator* ConstructWithSpread(uint32_t arity); |
| 629 | 623 |
| 630 const Operator* ConvertReceiver(ConvertReceiverMode convert_mode); | 624 const Operator* ConvertReceiver(ConvertReceiverMode convert_mode); |
| 631 | 625 |
| 632 const Operator* LoadProperty(VectorSlotPair const& feedback); | 626 const Operator* LoadProperty(VectorSlotPair const& feedback); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 694 Zone* const zone_; | 688 Zone* const zone_; |
| 695 | 689 |
| 696 DISALLOW_COPY_AND_ASSIGN(JSOperatorBuilder); | 690 DISALLOW_COPY_AND_ASSIGN(JSOperatorBuilder); |
| 697 }; | 691 }; |
| 698 | 692 |
| 699 } // namespace compiler | 693 } // namespace compiler |
| 700 } // namespace internal | 694 } // namespace internal |
| 701 } // namespace v8 | 695 } // namespace v8 |
| 702 | 696 |
| 703 #endif // V8_COMPILER_JS_OPERATOR_H_ | 697 #endif // V8_COMPILER_JS_OPERATOR_H_ |
| OLD | NEW |