| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 | 51 |
| 52 // The ConvertReceiverMode is used as parameter by JSConvertReceiver operators. | 52 // The ConvertReceiverMode is used as parameter by JSConvertReceiver operators. |
| 53 ConvertReceiverMode ConvertReceiverModeOf(Operator const* op); | 53 ConvertReceiverMode ConvertReceiverModeOf(Operator const* op); |
| 54 | 54 |
| 55 | 55 |
| 56 // The ToBooleanHints are used as parameter by JSToBoolean operators. | 56 // The ToBooleanHints are used as parameter by JSToBoolean operators. |
| 57 ToBooleanHints ToBooleanHintsOf(Operator const* op); | 57 ToBooleanHints ToBooleanHintsOf(Operator const* op); |
| 58 | 58 |
| 59 | 59 |
| 60 // Defines the arity and the feedback for a JavaScript constructor call. This is | 60 // Defines the arity and the feedback for a JavaScript constructor call. This is |
| 61 // used as a parameter by JSCallConstruct operators. | 61 // used as a parameter by JSConstruct operators. |
| 62 class CallConstructParameters final { | 62 class ConstructParameters final { |
| 63 public: | 63 public: |
| 64 CallConstructParameters(uint32_t arity, float frequency, | 64 ConstructParameters(uint32_t arity, float frequency, |
| 65 VectorSlotPair const& feedback) | 65 VectorSlotPair const& feedback) |
| 66 : arity_(arity), frequency_(frequency), feedback_(feedback) {} | 66 : arity_(arity), frequency_(frequency), feedback_(feedback) {} |
| 67 | 67 |
| 68 uint32_t arity() const { return arity_; } | 68 uint32_t arity() const { return arity_; } |
| 69 float frequency() const { return frequency_; } | 69 float frequency() const { return frequency_; } |
| 70 VectorSlotPair const& feedback() const { return feedback_; } | 70 VectorSlotPair const& feedback() const { return feedback_; } |
| 71 | 71 |
| 72 private: | 72 private: |
| 73 uint32_t const arity_; | 73 uint32_t const arity_; |
| 74 float const frequency_; | 74 float const frequency_; |
| 75 VectorSlotPair const feedback_; | 75 VectorSlotPair const feedback_; |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 bool operator==(CallConstructParameters const&, CallConstructParameters const&); | 78 bool operator==(ConstructParameters const&, ConstructParameters const&); |
| 79 bool operator!=(CallConstructParameters const&, CallConstructParameters const&); | 79 bool operator!=(ConstructParameters const&, ConstructParameters const&); |
| 80 | 80 |
| 81 size_t hash_value(CallConstructParameters const&); | 81 size_t hash_value(ConstructParameters const&); |
| 82 | 82 |
| 83 std::ostream& operator<<(std::ostream&, CallConstructParameters const&); | 83 std::ostream& operator<<(std::ostream&, ConstructParameters const&); |
| 84 | 84 |
| 85 CallConstructParameters const& CallConstructParametersOf(Operator const*); | 85 ConstructParameters const& ConstructParametersOf(Operator const*); |
| 86 | 86 |
| 87 // Defines the arity for a JavaScript constructor call with a spread as the last | 87 // Defines the arity for a JavaScript constructor call with a spread as the last |
| 88 // parameters. This is used as a parameter by JSCallConstructWithSpread | 88 // parameters. This is used as a parameter by JSConstructWithSpread |
| 89 // operators. | 89 // operators. |
| 90 class CallConstructWithSpreadParameters final { | 90 class ConstructWithSpreadParameters final { |
| 91 public: | 91 public: |
| 92 explicit CallConstructWithSpreadParameters(uint32_t arity) : arity_(arity) {} | 92 explicit ConstructWithSpreadParameters(uint32_t arity) : arity_(arity) {} |
| 93 | 93 |
| 94 uint32_t arity() const { return arity_; } | 94 uint32_t arity() const { return arity_; } |
| 95 | 95 |
| 96 private: | 96 private: |
| 97 uint32_t const arity_; | 97 uint32_t const arity_; |
| 98 }; | 98 }; |
| 99 | 99 |
| 100 bool operator==(CallConstructWithSpreadParameters const&, | 100 bool operator==(ConstructWithSpreadParameters const&, |
| 101 CallConstructWithSpreadParameters const&); | 101 ConstructWithSpreadParameters const&); |
| 102 bool operator!=(CallConstructWithSpreadParameters const&, | 102 bool operator!=(ConstructWithSpreadParameters const&, |
| 103 CallConstructWithSpreadParameters const&); | 103 ConstructWithSpreadParameters const&); |
| 104 | 104 |
| 105 size_t hash_value(CallConstructWithSpreadParameters const&); | 105 size_t hash_value(ConstructWithSpreadParameters const&); |
| 106 | 106 |
| 107 std::ostream& operator<<(std::ostream&, | 107 std::ostream& operator<<(std::ostream&, ConstructWithSpreadParameters const&); |
| 108 CallConstructWithSpreadParameters const&); | |
| 109 | 108 |
| 110 CallConstructWithSpreadParameters const& CallConstructWithSpreadParametersOf( | 109 ConstructWithSpreadParameters const& ConstructWithSpreadParametersOf( |
| 111 Operator const*); | 110 Operator const*); |
| 112 | 111 |
| 113 // Defines the flags for a JavaScript call forwarding parameters. This | 112 // Defines the flags for a JavaScript call forwarding parameters. This |
| 114 // is used as parameter by JSCallForwardVarargs operators. | 113 // is used as parameter by JSCallForwardVarargs operators. |
| 115 class CallForwardVarargsParameters final { | 114 class CallForwardVarargsParameters final { |
| 116 public: | 115 public: |
| 117 CallForwardVarargsParameters(uint32_t start_index, | 116 CallForwardVarargsParameters(uint32_t start_index, |
| 118 TailCallMode tail_call_mode) | 117 TailCallMode tail_call_mode) |
| 119 : bit_field_(StartIndexField::encode(start_index) | | 118 : bit_field_(StartIndexField::encode(start_index) | |
| 120 TailCallModeField::encode(tail_call_mode)) {} | 119 TailCallModeField::encode(tail_call_mode)) {} |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 VectorSlotPair const feedback_; | 193 VectorSlotPair const feedback_; |
| 195 }; | 194 }; |
| 196 | 195 |
| 197 size_t hash_value(CallFunctionParameters const&); | 196 size_t hash_value(CallFunctionParameters const&); |
| 198 | 197 |
| 199 std::ostream& operator<<(std::ostream&, CallFunctionParameters const&); | 198 std::ostream& operator<<(std::ostream&, CallFunctionParameters const&); |
| 200 | 199 |
| 201 const CallFunctionParameters& CallFunctionParametersOf(const Operator* op); | 200 const CallFunctionParameters& CallFunctionParametersOf(const Operator* op); |
| 202 | 201 |
| 203 // Defines the arity for a JavaScript constructor call with a spread as the last | 202 // Defines the arity for a JavaScript constructor call with a spread as the last |
| 204 // parameters. This is used as a parameter by JSCallConstructWithSpread | 203 // parameters. This is used as a parameter by JSConstructWithSpread |
| 205 // operators. | 204 // operators. |
| 206 class CallFunctionWithSpreadParameters final { | 205 class CallFunctionWithSpreadParameters final { |
| 207 public: | 206 public: |
| 208 explicit CallFunctionWithSpreadParameters(uint32_t arity) : arity_(arity) {} | 207 explicit CallFunctionWithSpreadParameters(uint32_t arity) : arity_(arity) {} |
| 209 | 208 |
| 210 uint32_t arity() const { return arity_; } | 209 uint32_t arity() const { return arity_; } |
| 211 | 210 |
| 212 private: | 211 private: |
| 213 uint32_t const arity_; | 212 uint32_t const arity_; |
| 214 }; | 213 }; |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 TailCallMode tail_call_mode); | 616 TailCallMode tail_call_mode); |
| 618 const Operator* CallFunction( | 617 const Operator* CallFunction( |
| 619 size_t arity, float frequency = 0.0f, | 618 size_t arity, float frequency = 0.0f, |
| 620 VectorSlotPair const& feedback = VectorSlotPair(), | 619 VectorSlotPair const& feedback = VectorSlotPair(), |
| 621 ConvertReceiverMode convert_mode = ConvertReceiverMode::kAny, | 620 ConvertReceiverMode convert_mode = ConvertReceiverMode::kAny, |
| 622 TailCallMode tail_call_mode = TailCallMode::kDisallow); | 621 TailCallMode tail_call_mode = TailCallMode::kDisallow); |
| 623 const Operator* CallFunctionWithSpread(uint32_t arity); | 622 const Operator* CallFunctionWithSpread(uint32_t arity); |
| 624 const Operator* CallRuntime(Runtime::FunctionId id); | 623 const Operator* CallRuntime(Runtime::FunctionId id); |
| 625 const Operator* CallRuntime(Runtime::FunctionId id, size_t arity); | 624 const Operator* CallRuntime(Runtime::FunctionId id, size_t arity); |
| 626 const Operator* CallRuntime(const Runtime::Function* function, size_t arity); | 625 const Operator* CallRuntime(const Runtime::Function* function, size_t arity); |
| 627 const Operator* CallConstruct(uint32_t arity, float frequency, | 626 const Operator* Construct(uint32_t arity, float frequency, |
| 628 VectorSlotPair const& feedback); | 627 VectorSlotPair const& feedback); |
| 629 const Operator* CallConstructWithSpread(uint32_t arity); | 628 const Operator* ConstructWithSpread(uint32_t arity); |
| 630 | 629 |
| 631 const Operator* ConvertReceiver(ConvertReceiverMode convert_mode); | 630 const Operator* ConvertReceiver(ConvertReceiverMode convert_mode); |
| 632 | 631 |
| 633 const Operator* LoadProperty(VectorSlotPair const& feedback); | 632 const Operator* LoadProperty(VectorSlotPair const& feedback); |
| 634 const Operator* LoadNamed(Handle<Name> name, VectorSlotPair const& feedback); | 633 const Operator* LoadNamed(Handle<Name> name, VectorSlotPair const& feedback); |
| 635 | 634 |
| 636 const Operator* StoreProperty(LanguageMode language_mode, | 635 const Operator* StoreProperty(LanguageMode language_mode, |
| 637 VectorSlotPair const& feedback); | 636 VectorSlotPair const& feedback); |
| 638 const Operator* StoreNamed(LanguageMode language_mode, Handle<Name> name, | 637 const Operator* StoreNamed(LanguageMode language_mode, Handle<Name> name, |
| 639 VectorSlotPair const& feedback); | 638 VectorSlotPair const& feedback); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 Zone* const zone_; | 694 Zone* const zone_; |
| 696 | 695 |
| 697 DISALLOW_COPY_AND_ASSIGN(JSOperatorBuilder); | 696 DISALLOW_COPY_AND_ASSIGN(JSOperatorBuilder); |
| 698 }; | 697 }; |
| 699 | 698 |
| 700 } // namespace compiler | 699 } // namespace compiler |
| 701 } // namespace internal | 700 } // namespace internal |
| 702 } // namespace v8 | 701 } // namespace v8 |
| 703 | 702 |
| 704 #endif // V8_COMPILER_JS_OPERATOR_H_ | 703 #endif // V8_COMPILER_JS_OPERATOR_H_ |
| OLD | NEW |