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/compiler/type-hints.h" | 8 #include "src/compiler/type-hints.h" |
9 #include "src/runtime/runtime.h" | 9 #include "src/runtime/runtime.h" |
10 | 10 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 | 73 |
74 std::ostream& operator<<(std::ostream&, CallConstructParameters const&); | 74 std::ostream& operator<<(std::ostream&, CallConstructParameters const&); |
75 | 75 |
76 CallConstructParameters const& CallConstructParametersOf(Operator const*); | 76 CallConstructParameters const& CallConstructParametersOf(Operator const*); |
77 | 77 |
78 | 78 |
79 // Defines the arity and the call flags for a JavaScript function call. This is | 79 // Defines the arity and the call flags for a JavaScript function call. This is |
80 // used as a parameter by JSCallFunction operators. | 80 // used as a parameter by JSCallFunction operators. |
81 class CallFunctionParameters final { | 81 class CallFunctionParameters final { |
82 public: | 82 public: |
83 CallFunctionParameters(size_t arity, LanguageMode language_mode, | 83 CallFunctionParameters(size_t arity, VectorSlotPair const& feedback, |
84 VectorSlotPair const& feedback, | |
85 TailCallMode tail_call_mode, | 84 TailCallMode tail_call_mode, |
86 ConvertReceiverMode convert_mode) | 85 ConvertReceiverMode convert_mode) |
87 : bit_field_(ArityField::encode(arity) | | 86 : bit_field_(ArityField::encode(arity) | |
88 ConvertReceiverModeField::encode(convert_mode) | | 87 ConvertReceiverModeField::encode(convert_mode) | |
89 LanguageModeField::encode(language_mode) | | |
90 TailCallModeField::encode(tail_call_mode)), | 88 TailCallModeField::encode(tail_call_mode)), |
91 feedback_(feedback) {} | 89 feedback_(feedback) {} |
92 | 90 |
93 size_t arity() const { return ArityField::decode(bit_field_); } | 91 size_t arity() const { return ArityField::decode(bit_field_); } |
94 LanguageMode language_mode() const { | |
95 return LanguageModeField::decode(bit_field_); | |
96 } | |
97 ConvertReceiverMode convert_mode() const { | 92 ConvertReceiverMode convert_mode() const { |
98 return ConvertReceiverModeField::decode(bit_field_); | 93 return ConvertReceiverModeField::decode(bit_field_); |
99 } | 94 } |
100 TailCallMode tail_call_mode() const { | 95 TailCallMode tail_call_mode() const { |
101 return TailCallModeField::decode(bit_field_); | 96 return TailCallModeField::decode(bit_field_); |
102 } | 97 } |
103 VectorSlotPair const& feedback() const { return feedback_; } | 98 VectorSlotPair const& feedback() const { return feedback_; } |
104 | 99 |
105 bool operator==(CallFunctionParameters const& that) const { | 100 bool operator==(CallFunctionParameters const& that) const { |
106 return this->bit_field_ == that.bit_field_ && | 101 return this->bit_field_ == that.bit_field_ && |
107 this->feedback_ == that.feedback_; | 102 this->feedback_ == that.feedback_; |
108 } | 103 } |
109 bool operator!=(CallFunctionParameters const& that) const { | 104 bool operator!=(CallFunctionParameters const& that) const { |
110 return !(*this == that); | 105 return !(*this == that); |
111 } | 106 } |
112 | 107 |
113 private: | 108 private: |
114 friend size_t hash_value(CallFunctionParameters const& p) { | 109 friend size_t hash_value(CallFunctionParameters const& p) { |
115 return base::hash_combine(p.bit_field_, p.feedback_); | 110 return base::hash_combine(p.bit_field_, p.feedback_); |
116 } | 111 } |
117 | 112 |
118 typedef BitField<size_t, 0, 27> ArityField; | 113 typedef BitField<size_t, 0, 29> ArityField; |
119 typedef BitField<ConvertReceiverMode, 27, 2> ConvertReceiverModeField; | 114 typedef BitField<ConvertReceiverMode, 29, 2> ConvertReceiverModeField; |
120 typedef BitField<LanguageMode, 29, 2> LanguageModeField; | |
121 typedef BitField<TailCallMode, 31, 1> TailCallModeField; | 115 typedef BitField<TailCallMode, 31, 1> TailCallModeField; |
122 | 116 |
123 const uint32_t bit_field_; | 117 const uint32_t bit_field_; |
124 const VectorSlotPair feedback_; | 118 const VectorSlotPair feedback_; |
125 }; | 119 }; |
126 | 120 |
127 size_t hash_value(CallFunctionParameters const&); | 121 size_t hash_value(CallFunctionParameters const&); |
128 | 122 |
129 std::ostream& operator<<(std::ostream&, CallFunctionParameters const&); | 123 std::ostream& operator<<(std::ostream&, CallFunctionParameters const&); |
130 | 124 |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 PretenureFlag pretenure); | 414 PretenureFlag pretenure); |
421 const Operator* CreateIterResultObject(); | 415 const Operator* CreateIterResultObject(); |
422 const Operator* CreateLiteralArray(Handle<FixedArray> constant_elements, | 416 const Operator* CreateLiteralArray(Handle<FixedArray> constant_elements, |
423 int literal_flags, int literal_index); | 417 int literal_flags, int literal_index); |
424 const Operator* CreateLiteralObject(Handle<FixedArray> constant_properties, | 418 const Operator* CreateLiteralObject(Handle<FixedArray> constant_properties, |
425 int literal_flags, int literal_index); | 419 int literal_flags, int literal_index); |
426 const Operator* CreateLiteralRegExp(Handle<String> constant_pattern, | 420 const Operator* CreateLiteralRegExp(Handle<String> constant_pattern, |
427 int literal_flags, int literal_index); | 421 int literal_flags, int literal_index); |
428 | 422 |
429 const Operator* CallFunction( | 423 const Operator* CallFunction( |
430 size_t arity, LanguageMode language_mode, | 424 size_t arity, VectorSlotPair const& feedback = VectorSlotPair(), |
431 VectorSlotPair const& feedback = VectorSlotPair(), | |
432 ConvertReceiverMode convert_mode = ConvertReceiverMode::kAny, | 425 ConvertReceiverMode convert_mode = ConvertReceiverMode::kAny, |
433 TailCallMode tail_call_mode = TailCallMode::kDisallow); | 426 TailCallMode tail_call_mode = TailCallMode::kDisallow); |
434 const Operator* CallRuntime(Runtime::FunctionId id); | 427 const Operator* CallRuntime(Runtime::FunctionId id); |
435 const Operator* CallRuntime(Runtime::FunctionId id, size_t arity); | 428 const Operator* CallRuntime(Runtime::FunctionId id, size_t arity); |
436 const Operator* CallRuntime(const Runtime::Function* function, size_t arity); | 429 const Operator* CallRuntime(const Runtime::Function* function, size_t arity); |
437 const Operator* CallConstruct(size_t arity, VectorSlotPair const& feedback); | 430 const Operator* CallConstruct(size_t arity, VectorSlotPair const& feedback); |
438 | 431 |
439 const Operator* ConvertReceiver(ConvertReceiverMode convert_mode); | 432 const Operator* ConvertReceiver(ConvertReceiverMode convert_mode); |
440 | 433 |
441 const Operator* LoadProperty(VectorSlotPair const& feedback); | 434 const Operator* LoadProperty(VectorSlotPair const& feedback); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 Zone* const zone_; | 480 Zone* const zone_; |
488 | 481 |
489 DISALLOW_COPY_AND_ASSIGN(JSOperatorBuilder); | 482 DISALLOW_COPY_AND_ASSIGN(JSOperatorBuilder); |
490 }; | 483 }; |
491 | 484 |
492 } // namespace compiler | 485 } // namespace compiler |
493 } // namespace internal | 486 } // namespace internal |
494 } // namespace v8 | 487 } // namespace v8 |
495 | 488 |
496 #endif // V8_COMPILER_JS_OPERATOR_H_ | 489 #endif // V8_COMPILER_JS_OPERATOR_H_ |
OLD | NEW |