| 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_HYDROGEN_INSTRUCTIONS_H_ | 5 #ifndef V8_HYDROGEN_INSTRUCTIONS_H_ |
| 6 #define V8_HYDROGEN_INSTRUCTIONS_H_ | 6 #define V8_HYDROGEN_INSTRUCTIONS_H_ |
| 7 | 7 |
| 8 #include "src/v8.h" | 8 #include "src/v8.h" |
| 9 | 9 |
| 10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
| (...skipping 2302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2313 | 2313 |
| 2314 bool pass_argument_count_; | 2314 bool pass_argument_count_; |
| 2315 bool has_stack_check_; | 2315 bool has_stack_check_; |
| 2316 }; | 2316 }; |
| 2317 | 2317 |
| 2318 | 2318 |
| 2319 class HCallWithDescriptor FINAL : public HInstruction { | 2319 class HCallWithDescriptor FINAL : public HInstruction { |
| 2320 public: | 2320 public: |
| 2321 static HCallWithDescriptor* New(Zone* zone, HValue* context, HValue* target, | 2321 static HCallWithDescriptor* New(Zone* zone, HValue* context, HValue* target, |
| 2322 int argument_count, | 2322 int argument_count, |
| 2323 const CallInterfaceDescriptor* descriptor, | 2323 CallInterfaceDescriptor descriptor, |
| 2324 const Vector<HValue*>& operands) { | 2324 const Vector<HValue*>& operands) { |
| 2325 DCHECK(operands.length() == descriptor->GetEnvironmentLength()); | 2325 DCHECK(operands.length() == descriptor.GetEnvironmentLength()); |
| 2326 HCallWithDescriptor* res = | 2326 HCallWithDescriptor* res = |
| 2327 new(zone) HCallWithDescriptor(target, argument_count, | 2327 new(zone) HCallWithDescriptor(target, argument_count, |
| 2328 descriptor, operands, zone); | 2328 descriptor, operands, zone); |
| 2329 return res; | 2329 return res; |
| 2330 } | 2330 } |
| 2331 | 2331 |
| 2332 virtual int OperandCount() const FINAL OVERRIDE { | 2332 virtual int OperandCount() const FINAL OVERRIDE { |
| 2333 return values_.length(); | 2333 return values_.length(); |
| 2334 } | 2334 } |
| 2335 virtual HValue* OperandAt(int index) const FINAL OVERRIDE { | 2335 virtual HValue* OperandAt(int index) const FINAL OVERRIDE { |
| 2336 return values_[index]; | 2336 return values_[index]; |
| 2337 } | 2337 } |
| 2338 | 2338 |
| 2339 virtual Representation RequiredInputRepresentation( | 2339 virtual Representation RequiredInputRepresentation( |
| 2340 int index) FINAL OVERRIDE { | 2340 int index) FINAL OVERRIDE { |
| 2341 if (index == 0) { | 2341 if (index == 0) { |
| 2342 return Representation::Tagged(); | 2342 return Representation::Tagged(); |
| 2343 } else { | 2343 } else { |
| 2344 int par_index = index - 1; | 2344 int par_index = index - 1; |
| 2345 DCHECK(par_index < descriptor_->GetEnvironmentLength()); | 2345 DCHECK(par_index < descriptor_.GetEnvironmentLength()); |
| 2346 return descriptor_->GetParameterRepresentation(par_index); | 2346 return descriptor_.GetParameterRepresentation(par_index); |
| 2347 } | 2347 } |
| 2348 } | 2348 } |
| 2349 | 2349 |
| 2350 DECLARE_CONCRETE_INSTRUCTION(CallWithDescriptor) | 2350 DECLARE_CONCRETE_INSTRUCTION(CallWithDescriptor) |
| 2351 | 2351 |
| 2352 virtual HType CalculateInferredType() FINAL OVERRIDE { | 2352 virtual HType CalculateInferredType() FINAL OVERRIDE { |
| 2353 return HType::Tagged(); | 2353 return HType::Tagged(); |
| 2354 } | 2354 } |
| 2355 | 2355 |
| 2356 virtual int argument_count() const { | 2356 virtual int argument_count() const { |
| 2357 return argument_count_; | 2357 return argument_count_; |
| 2358 } | 2358 } |
| 2359 | 2359 |
| 2360 virtual int argument_delta() const OVERRIDE { | 2360 virtual int argument_delta() const OVERRIDE { |
| 2361 return -argument_count_; | 2361 return -argument_count_; |
| 2362 } | 2362 } |
| 2363 | 2363 |
| 2364 const CallInterfaceDescriptor* descriptor() const { return descriptor_; } | 2364 CallInterfaceDescriptor descriptor() const { return descriptor_; } |
| 2365 | 2365 |
| 2366 HValue* target() { | 2366 HValue* target() { |
| 2367 return OperandAt(0); | 2367 return OperandAt(0); |
| 2368 } | 2368 } |
| 2369 | 2369 |
| 2370 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT | 2370 virtual OStream& PrintDataTo(OStream& os) const OVERRIDE; // NOLINT |
| 2371 | 2371 |
| 2372 private: | 2372 private: |
| 2373 // The argument count includes the receiver. | 2373 // The argument count includes the receiver. |
| 2374 HCallWithDescriptor(HValue* target, int argument_count, | 2374 HCallWithDescriptor(HValue* target, int argument_count, |
| 2375 const CallInterfaceDescriptor* descriptor, | 2375 CallInterfaceDescriptor descriptor, |
| 2376 const Vector<HValue*>& operands, Zone* zone) | 2376 const Vector<HValue*>& operands, Zone* zone) |
| 2377 : descriptor_(descriptor), | 2377 : descriptor_(descriptor), |
| 2378 values_(descriptor->GetEnvironmentLength() + 1, zone) { | 2378 values_(descriptor.GetEnvironmentLength() + 1, zone) { |
| 2379 argument_count_ = argument_count; | 2379 argument_count_ = argument_count; |
| 2380 AddOperand(target, zone); | 2380 AddOperand(target, zone); |
| 2381 for (int i = 0; i < operands.length(); i++) { | 2381 for (int i = 0; i < operands.length(); i++) { |
| 2382 AddOperand(operands[i], zone); | 2382 AddOperand(operands[i], zone); |
| 2383 } | 2383 } |
| 2384 this->set_representation(Representation::Tagged()); | 2384 this->set_representation(Representation::Tagged()); |
| 2385 this->SetAllSideEffects(); | 2385 this->SetAllSideEffects(); |
| 2386 } | 2386 } |
| 2387 | 2387 |
| 2388 void AddOperand(HValue* v, Zone* zone) { | 2388 void AddOperand(HValue* v, Zone* zone) { |
| 2389 values_.Add(NULL, zone); | 2389 values_.Add(NULL, zone); |
| 2390 SetOperandAt(values_.length() - 1, v); | 2390 SetOperandAt(values_.length() - 1, v); |
| 2391 } | 2391 } |
| 2392 | 2392 |
| 2393 void InternalSetOperandAt(int index, | 2393 void InternalSetOperandAt(int index, |
| 2394 HValue* value) FINAL OVERRIDE { | 2394 HValue* value) FINAL OVERRIDE { |
| 2395 values_[index] = value; | 2395 values_[index] = value; |
| 2396 } | 2396 } |
| 2397 | 2397 |
| 2398 const CallInterfaceDescriptor* descriptor_; | 2398 CallInterfaceDescriptor descriptor_; |
| 2399 ZoneList<HValue*> values_; | 2399 ZoneList<HValue*> values_; |
| 2400 int argument_count_; | 2400 int argument_count_; |
| 2401 }; | 2401 }; |
| 2402 | 2402 |
| 2403 | 2403 |
| 2404 class HInvokeFunction FINAL : public HBinaryCall { | 2404 class HInvokeFunction FINAL : public HBinaryCall { |
| 2405 public: | 2405 public: |
| 2406 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInvokeFunction, HValue*, int); | 2406 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInvokeFunction, HValue*, int); |
| 2407 | 2407 |
| 2408 HInvokeFunction(HValue* context, | 2408 HInvokeFunction(HValue* context, |
| (...skipping 5440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7849 }; | 7849 }; |
| 7850 | 7850 |
| 7851 | 7851 |
| 7852 | 7852 |
| 7853 #undef DECLARE_INSTRUCTION | 7853 #undef DECLARE_INSTRUCTION |
| 7854 #undef DECLARE_CONCRETE_INSTRUCTION | 7854 #undef DECLARE_CONCRETE_INSTRUCTION |
| 7855 | 7855 |
| 7856 } } // namespace v8::internal | 7856 } } // namespace v8::internal |
| 7857 | 7857 |
| 7858 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7858 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |