OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_CRANKSHAFT_HYDROGEN_INSTRUCTIONS_H_ | 5 #ifndef V8_CRANKSHAFT_HYDROGEN_INSTRUCTIONS_H_ |
6 #define V8_CRANKSHAFT_HYDROGEN_INSTRUCTIONS_H_ | 6 #define V8_CRANKSHAFT_HYDROGEN_INSTRUCTIONS_H_ |
7 | 7 |
8 #include <cstring> | 8 #include <cstring> |
9 #include <iosfwd> | 9 #include <iosfwd> |
10 | 10 |
(...skipping 2197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2208 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT | 2208 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
2209 | 2209 |
2210 private: | 2210 private: |
2211 // The argument count includes the receiver. | 2211 // The argument count includes the receiver. |
2212 HCallWithDescriptor(HValue* target, int argument_count, | 2212 HCallWithDescriptor(HValue* target, int argument_count, |
2213 CallInterfaceDescriptor descriptor, | 2213 CallInterfaceDescriptor descriptor, |
2214 const Vector<HValue*>& operands, | 2214 const Vector<HValue*>& operands, |
2215 TailCallMode syntactic_tail_call_mode, | 2215 TailCallMode syntactic_tail_call_mode, |
2216 TailCallMode tail_call_mode, Zone* zone) | 2216 TailCallMode tail_call_mode, Zone* zone) |
2217 : descriptor_(descriptor), | 2217 : descriptor_(descriptor), |
2218 values_(GetParameterCount() + 1, zone), | 2218 values_(GetParameterCount() + 1, zone), // +1 here is for target. |
2219 argument_count_(argument_count), | 2219 argument_count_(argument_count), |
2220 bit_field_( | 2220 bit_field_( |
2221 TailCallModeField::encode(tail_call_mode) | | 2221 TailCallModeField::encode(tail_call_mode) | |
2222 SyntacticTailCallModeField::encode(syntactic_tail_call_mode)) { | 2222 SyntacticTailCallModeField::encode(syntactic_tail_call_mode)) { |
2223 DCHECK_EQ(operands.length(), GetParameterCount()); | 2223 DCHECK_EQ(operands.length(), GetParameterCount()); |
2224 // We can only tail call without any stack arguments. | 2224 // We can only tail call without any stack arguments. |
2225 DCHECK(tail_call_mode != TailCallMode::kAllow || argument_count == 0); | 2225 DCHECK(tail_call_mode != TailCallMode::kAllow || argument_count == 0); |
2226 AddOperand(target, zone); | 2226 AddOperand(target, zone); |
2227 for (int i = 0; i < operands.length(); i++) { | 2227 for (int i = 0; i < operands.length(); i++) { |
2228 AddOperand(operands[i], zone); | 2228 AddOperand(operands[i], zone); |
2229 } | 2229 } |
2230 this->set_representation(Representation::Tagged()); | 2230 this->set_representation(Representation::Tagged()); |
2231 this->SetAllSideEffects(); | 2231 this->SetAllSideEffects(); |
2232 } | 2232 } |
2233 | 2233 |
2234 void AddOperand(HValue* v, Zone* zone) { | 2234 void AddOperand(HValue* v, Zone* zone) { |
2235 values_.Add(NULL, zone); | 2235 values_.Add(NULL, zone); |
2236 SetOperandAt(values_.length() - 1, v); | 2236 SetOperandAt(values_.length() - 1, v); |
2237 } | 2237 } |
2238 | 2238 |
2239 int GetParameterCount() const { | 2239 int GetParameterCount() const { |
2240 return descriptor_.GetRegisterParameterCount() + 1; | 2240 return descriptor_.GetParameterCount() + 1; // +1 here is for context. |
2241 } | 2241 } |
2242 | 2242 |
2243 void InternalSetOperandAt(int index, HValue* value) final { | 2243 void InternalSetOperandAt(int index, HValue* value) final { |
2244 values_[index] = value; | 2244 values_[index] = value; |
2245 } | 2245 } |
2246 | 2246 |
2247 CallInterfaceDescriptor descriptor_; | 2247 CallInterfaceDescriptor descriptor_; |
2248 ZoneList<HValue*> values_; | 2248 ZoneList<HValue*> values_; |
2249 int argument_count_; | 2249 int argument_count_; |
2250 class TailCallModeField : public BitField<TailCallMode, 0, 1> {}; | 2250 class TailCallModeField : public BitField<TailCallMode, 0, 1> {}; |
(...skipping 4786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7037 bool IsDeletable() const override { return true; } | 7037 bool IsDeletable() const override { return true; } |
7038 }; | 7038 }; |
7039 | 7039 |
7040 #undef DECLARE_INSTRUCTION | 7040 #undef DECLARE_INSTRUCTION |
7041 #undef DECLARE_CONCRETE_INSTRUCTION | 7041 #undef DECLARE_CONCRETE_INSTRUCTION |
7042 | 7042 |
7043 } // namespace internal | 7043 } // namespace internal |
7044 } // namespace v8 | 7044 } // namespace v8 |
7045 | 7045 |
7046 #endif // V8_CRANKSHAFT_HYDROGEN_INSTRUCTIONS_H_ | 7046 #endif // V8_CRANKSHAFT_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |