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