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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 CallConstructWithSpreadParameters const&); | 99 CallConstructWithSpreadParameters const&); |
100 | 100 |
101 size_t hash_value(CallConstructWithSpreadParameters const&); | 101 size_t hash_value(CallConstructWithSpreadParameters const&); |
102 | 102 |
103 std::ostream& operator<<(std::ostream&, | 103 std::ostream& operator<<(std::ostream&, |
104 CallConstructWithSpreadParameters const&); | 104 CallConstructWithSpreadParameters const&); |
105 | 105 |
106 CallConstructWithSpreadParameters const& CallConstructWithSpreadParametersOf( | 106 CallConstructWithSpreadParameters const& CallConstructWithSpreadParametersOf( |
107 Operator const*); | 107 Operator const*); |
108 | 108 |
| 109 // Defines the flags for a JavaScript call forwarding parameters. This |
| 110 // is used as parameter by JSCallForwardVarargs operators. |
| 111 class CallForwardVarargsParameters final { |
| 112 public: |
| 113 CallForwardVarargsParameters(uint32_t start_index, |
| 114 TailCallMode tail_call_mode) |
| 115 : bit_field_(StartIndexField::encode(start_index) | |
| 116 TailCallModeField::encode(tail_call_mode)) {} |
| 117 |
| 118 uint32_t start_index() const { return StartIndexField::decode(bit_field_); } |
| 119 TailCallMode tail_call_mode() const { |
| 120 return TailCallModeField::decode(bit_field_); |
| 121 } |
| 122 |
| 123 bool operator==(CallForwardVarargsParameters const& that) const { |
| 124 return this->bit_field_ == that.bit_field_; |
| 125 } |
| 126 bool operator!=(CallForwardVarargsParameters const& that) const { |
| 127 return !(*this == that); |
| 128 } |
| 129 |
| 130 private: |
| 131 friend size_t hash_value(CallForwardVarargsParameters const& p) { |
| 132 return p.bit_field_; |
| 133 } |
| 134 |
| 135 typedef BitField<uint32_t, 0, 30> StartIndexField; |
| 136 typedef BitField<TailCallMode, 31, 1> TailCallModeField; |
| 137 |
| 138 uint32_t const bit_field_; |
| 139 }; |
| 140 |
| 141 std::ostream& operator<<(std::ostream&, CallForwardVarargsParameters const&); |
| 142 |
| 143 CallForwardVarargsParameters const& CallForwardVarargsParametersOf( |
| 144 Operator const*) WARN_UNUSED_RESULT; |
| 145 |
109 // Defines the arity and the call flags for a JavaScript function call. This is | 146 // Defines the arity and the call flags for a JavaScript function call. This is |
110 // used as a parameter by JSCallFunction operators. | 147 // used as a parameter by JSCallFunction operators. |
111 class CallFunctionParameters final { | 148 class CallFunctionParameters final { |
112 public: | 149 public: |
113 CallFunctionParameters(size_t arity, float frequency, | 150 CallFunctionParameters(size_t arity, float frequency, |
114 VectorSlotPair const& feedback, | 151 VectorSlotPair const& feedback, |
115 TailCallMode tail_call_mode, | 152 TailCallMode tail_call_mode, |
116 ConvertReceiverMode convert_mode) | 153 ConvertReceiverMode convert_mode) |
117 : bit_field_(ArityField::encode(arity) | | 154 : bit_field_(ArityField::encode(arity) | |
118 ConvertReceiverModeField::encode(convert_mode) | | 155 ConvertReceiverModeField::encode(convert_mode) | |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 const Operator* CreateKeyValueArray(); | 602 const Operator* CreateKeyValueArray(); |
566 const Operator* CreateLiteralArray(Handle<ConstantElementsPair> constant, | 603 const Operator* CreateLiteralArray(Handle<ConstantElementsPair> constant, |
567 int literal_flags, int literal_index, | 604 int literal_flags, int literal_index, |
568 int number_of_elements); | 605 int number_of_elements); |
569 const Operator* CreateLiteralObject(Handle<FixedArray> constant_properties, | 606 const Operator* CreateLiteralObject(Handle<FixedArray> constant_properties, |
570 int literal_flags, int literal_index, | 607 int literal_flags, int literal_index, |
571 int number_of_properties); | 608 int number_of_properties); |
572 const Operator* CreateLiteralRegExp(Handle<String> constant_pattern, | 609 const Operator* CreateLiteralRegExp(Handle<String> constant_pattern, |
573 int literal_flags, int literal_index); | 610 int literal_flags, int literal_index); |
574 | 611 |
| 612 const Operator* CallForwardVarargs(uint32_t start_index, |
| 613 TailCallMode tail_call_mode); |
575 const Operator* CallFunction( | 614 const Operator* CallFunction( |
576 size_t arity, float frequency = 0.0f, | 615 size_t arity, float frequency = 0.0f, |
577 VectorSlotPair const& feedback = VectorSlotPair(), | 616 VectorSlotPair const& feedback = VectorSlotPair(), |
578 ConvertReceiverMode convert_mode = ConvertReceiverMode::kAny, | 617 ConvertReceiverMode convert_mode = ConvertReceiverMode::kAny, |
579 TailCallMode tail_call_mode = TailCallMode::kDisallow); | 618 TailCallMode tail_call_mode = TailCallMode::kDisallow); |
580 const Operator* CallFunctionWithSpread(uint32_t arity); | 619 const Operator* CallFunctionWithSpread(uint32_t arity); |
581 const Operator* CallRuntime(Runtime::FunctionId id); | 620 const Operator* CallRuntime(Runtime::FunctionId id); |
582 const Operator* CallRuntime(Runtime::FunctionId id, size_t arity); | 621 const Operator* CallRuntime(Runtime::FunctionId id, size_t arity); |
583 const Operator* CallRuntime(const Runtime::Function* function, size_t arity); | 622 const Operator* CallRuntime(const Runtime::Function* function, size_t arity); |
584 const Operator* CallConstruct(uint32_t arity, float frequency, | 623 const Operator* CallConstruct(uint32_t arity, float frequency, |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 Zone* const zone_; | 690 Zone* const zone_; |
652 | 691 |
653 DISALLOW_COPY_AND_ASSIGN(JSOperatorBuilder); | 692 DISALLOW_COPY_AND_ASSIGN(JSOperatorBuilder); |
654 }; | 693 }; |
655 | 694 |
656 } // namespace compiler | 695 } // namespace compiler |
657 } // namespace internal | 696 } // namespace internal |
658 } // namespace v8 | 697 } // namespace v8 |
659 | 698 |
660 #endif // V8_COMPILER_JS_OPERATOR_H_ | 699 #endif // V8_COMPILER_JS_OPERATOR_H_ |
OLD | NEW |