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 2303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2314 SetOperandAt(0, function); | 2314 SetOperandAt(0, function); |
2315 } | 2315 } |
2316 | 2316 |
2317 bool pass_argument_count_; | 2317 bool pass_argument_count_; |
2318 bool has_stack_check_; | 2318 bool has_stack_check_; |
2319 }; | 2319 }; |
2320 | 2320 |
2321 | 2321 |
2322 class HCallWithDescriptor V8_FINAL : public HInstruction { | 2322 class HCallWithDescriptor V8_FINAL : public HInstruction { |
2323 public: | 2323 public: |
2324 static HCallWithDescriptor* New(Zone* zone, HValue* context, | 2324 static HCallWithDescriptor* New(Zone* zone, HValue* context, HValue* target, |
2325 HValue* target, | 2325 int argument_count, |
2326 int argument_count, | 2326 const CallInterfaceDescriptor* descriptor, |
2327 const InterfaceDescriptor* descriptor, | 2327 const Vector<HValue*>& operands) { |
2328 const Vector<HValue*>& operands) { | |
2329 DCHECK(operands.length() == descriptor->GetEnvironmentLength()); | 2328 DCHECK(operands.length() == descriptor->GetEnvironmentLength()); |
2330 HCallWithDescriptor* res = | 2329 HCallWithDescriptor* res = |
2331 new(zone) HCallWithDescriptor(target, argument_count, | 2330 new(zone) HCallWithDescriptor(target, argument_count, |
2332 descriptor, operands, zone); | 2331 descriptor, operands, zone); |
2333 return res; | 2332 return res; |
2334 } | 2333 } |
2335 | 2334 |
2336 virtual int OperandCount() const V8_FINAL V8_OVERRIDE { | 2335 virtual int OperandCount() const V8_FINAL V8_OVERRIDE { |
2337 return values_.length(); | 2336 return values_.length(); |
2338 } | 2337 } |
(...skipping 19 matching lines...) Expand all Loading... |
2358 } | 2357 } |
2359 | 2358 |
2360 virtual int argument_count() const { | 2359 virtual int argument_count() const { |
2361 return argument_count_; | 2360 return argument_count_; |
2362 } | 2361 } |
2363 | 2362 |
2364 virtual int argument_delta() const V8_OVERRIDE { | 2363 virtual int argument_delta() const V8_OVERRIDE { |
2365 return -argument_count_; | 2364 return -argument_count_; |
2366 } | 2365 } |
2367 | 2366 |
2368 const InterfaceDescriptor* descriptor() const { | 2367 const CallInterfaceDescriptor* descriptor() const { return descriptor_; } |
2369 return descriptor_; | |
2370 } | |
2371 | 2368 |
2372 HValue* target() { | 2369 HValue* target() { |
2373 return OperandAt(0); | 2370 return OperandAt(0); |
2374 } | 2371 } |
2375 | 2372 |
2376 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT | 2373 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT |
2377 | 2374 |
2378 private: | 2375 private: |
2379 // The argument count includes the receiver. | 2376 // The argument count includes the receiver. |
2380 HCallWithDescriptor(HValue* target, | 2377 HCallWithDescriptor(HValue* target, int argument_count, |
2381 int argument_count, | 2378 const CallInterfaceDescriptor* descriptor, |
2382 const InterfaceDescriptor* descriptor, | 2379 const Vector<HValue*>& operands, Zone* zone) |
2383 const Vector<HValue*>& operands, | 2380 : descriptor_(descriptor), |
2384 Zone* zone) | 2381 values_(descriptor->GetEnvironmentLength() + 1, zone) { |
2385 : descriptor_(descriptor), | |
2386 values_(descriptor->GetEnvironmentLength() + 1, zone) { | |
2387 argument_count_ = argument_count; | 2382 argument_count_ = argument_count; |
2388 AddOperand(target, zone); | 2383 AddOperand(target, zone); |
2389 for (int i = 0; i < operands.length(); i++) { | 2384 for (int i = 0; i < operands.length(); i++) { |
2390 AddOperand(operands[i], zone); | 2385 AddOperand(operands[i], zone); |
2391 } | 2386 } |
2392 this->set_representation(Representation::Tagged()); | 2387 this->set_representation(Representation::Tagged()); |
2393 this->SetAllSideEffects(); | 2388 this->SetAllSideEffects(); |
2394 } | 2389 } |
2395 | 2390 |
2396 void AddOperand(HValue* v, Zone* zone) { | 2391 void AddOperand(HValue* v, Zone* zone) { |
2397 values_.Add(NULL, zone); | 2392 values_.Add(NULL, zone); |
2398 SetOperandAt(values_.length() - 1, v); | 2393 SetOperandAt(values_.length() - 1, v); |
2399 } | 2394 } |
2400 | 2395 |
2401 void InternalSetOperandAt(int index, | 2396 void InternalSetOperandAt(int index, |
2402 HValue* value) V8_FINAL V8_OVERRIDE { | 2397 HValue* value) V8_FINAL V8_OVERRIDE { |
2403 values_[index] = value; | 2398 values_[index] = value; |
2404 } | 2399 } |
2405 | 2400 |
2406 const InterfaceDescriptor* descriptor_; | 2401 const CallInterfaceDescriptor* descriptor_; |
2407 ZoneList<HValue*> values_; | 2402 ZoneList<HValue*> values_; |
2408 int argument_count_; | 2403 int argument_count_; |
2409 }; | 2404 }; |
2410 | 2405 |
2411 | 2406 |
2412 class HInvokeFunction V8_FINAL : public HBinaryCall { | 2407 class HInvokeFunction V8_FINAL : public HBinaryCall { |
2413 public: | 2408 public: |
2414 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInvokeFunction, HValue*, int); | 2409 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInvokeFunction, HValue*, int); |
2415 | 2410 |
2416 HInvokeFunction(HValue* context, | 2411 HInvokeFunction(HValue* context, |
(...skipping 5441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7858 }; | 7853 }; |
7859 | 7854 |
7860 | 7855 |
7861 | 7856 |
7862 #undef DECLARE_INSTRUCTION | 7857 #undef DECLARE_INSTRUCTION |
7863 #undef DECLARE_CONCRETE_INSTRUCTION | 7858 #undef DECLARE_CONCRETE_INSTRUCTION |
7864 | 7859 |
7865 } } // namespace v8::internal | 7860 } } // namespace v8::internal |
7866 | 7861 |
7867 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7862 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |