OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 V(Allocate) \ | 70 V(Allocate) \ |
71 V(ApplyArguments) \ | 71 V(ApplyArguments) \ |
72 V(ArgumentsElements) \ | 72 V(ArgumentsElements) \ |
73 V(ArgumentsLength) \ | 73 V(ArgumentsLength) \ |
74 V(ArgumentsObject) \ | 74 V(ArgumentsObject) \ |
75 V(Bitwise) \ | 75 V(Bitwise) \ |
76 V(BlockEntry) \ | 76 V(BlockEntry) \ |
77 V(BoundsCheck) \ | 77 V(BoundsCheck) \ |
78 V(BoundsCheckBaseIndexInformation) \ | 78 V(BoundsCheckBaseIndexInformation) \ |
79 V(Branch) \ | 79 V(Branch) \ |
80 V(CallConstantFunction) \ | 80 V(CallWithDescriptor) \ |
| 81 V(CallJSFunction) \ |
81 V(CallFunction) \ | 82 V(CallFunction) \ |
82 V(CallGlobal) \ | 83 V(CallGlobal) \ |
83 V(CallKeyed) \ | |
84 V(CallKnownGlobal) \ | |
85 V(CallNamed) \ | |
86 V(CallNew) \ | 84 V(CallNew) \ |
87 V(CallNewArray) \ | 85 V(CallNewArray) \ |
88 V(CallRuntime) \ | 86 V(CallRuntime) \ |
89 V(CallStub) \ | 87 V(CallStub) \ |
90 V(CapturedObject) \ | 88 V(CapturedObject) \ |
91 V(Change) \ | 89 V(Change) \ |
92 V(CheckHeapObject) \ | 90 V(CheckHeapObject) \ |
93 V(CheckInstanceType) \ | 91 V(CheckInstanceType) \ |
94 V(CheckMaps) \ | 92 V(CheckMaps) \ |
95 V(CheckMapValue) \ | 93 V(CheckMapValue) \ |
(...skipping 2183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2279 virtual Representation RequiredInputRepresentation( | 2277 virtual Representation RequiredInputRepresentation( |
2280 int index) V8_FINAL V8_OVERRIDE { | 2278 int index) V8_FINAL V8_OVERRIDE { |
2281 return Representation::Tagged(); | 2279 return Representation::Tagged(); |
2282 } | 2280 } |
2283 | 2281 |
2284 HValue* first() { return OperandAt(0); } | 2282 HValue* first() { return OperandAt(0); } |
2285 HValue* second() { return OperandAt(1); } | 2283 HValue* second() { return OperandAt(1); } |
2286 }; | 2284 }; |
2287 | 2285 |
2288 | 2286 |
| 2287 class HCallJSFunction V8_FINAL : public HCall<2> { |
| 2288 public: |
| 2289 static HCallJSFunction* New(Zone* zone, |
| 2290 HValue* context, |
| 2291 HValue* function, |
| 2292 HValue* call_kind_value, |
| 2293 int argument_count, |
| 2294 bool pass_argument_count); |
| 2295 |
| 2296 HValue* function() { return OperandAt(0); } |
| 2297 HValue* call_kind() { return OperandAt(1); } |
| 2298 |
| 2299 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
| 2300 |
| 2301 virtual Representation RequiredInputRepresentation( |
| 2302 int index) V8_FINAL V8_OVERRIDE { |
| 2303 if (index == 0) { |
| 2304 return Representation::Tagged(); |
| 2305 } else if (index == 1) { |
| 2306 return Representation::Smi(); |
| 2307 } |
| 2308 UNREACHABLE(); |
| 2309 return Representation::None(); |
| 2310 } |
| 2311 |
| 2312 bool pass_argument_count() const { return pass_argument_count_; } |
| 2313 |
| 2314 virtual bool HasStackCheck() V8_FINAL V8_OVERRIDE { |
| 2315 return has_stack_check_; |
| 2316 } |
| 2317 |
| 2318 DECLARE_CONCRETE_INSTRUCTION(CallJSFunction) |
| 2319 |
| 2320 private: |
| 2321 // The argument count includes the receiver. |
| 2322 HCallJSFunction(HValue* function, |
| 2323 HValue* call_kind, |
| 2324 int argument_count, |
| 2325 bool pass_argument_count, |
| 2326 bool has_stack_check) |
| 2327 : HCall<2>(argument_count), |
| 2328 pass_argument_count_(pass_argument_count), |
| 2329 has_stack_check_(has_stack_check) { |
| 2330 SetOperandAt(0, function); |
| 2331 SetOperandAt(1, call_kind); |
| 2332 } |
| 2333 |
| 2334 bool pass_argument_count_; |
| 2335 bool has_stack_check_; |
| 2336 }; |
| 2337 |
| 2338 |
| 2339 class HCallWithDescriptor V8_FINAL : public HInstruction { |
| 2340 public: |
| 2341 static HCallWithDescriptor* New(Zone* zone, HValue* context, |
| 2342 HValue* target, |
| 2343 int argument_count, |
| 2344 const CallInterfaceDescriptor* descriptor, |
| 2345 Vector<HValue*>& operands) { |
| 2346 ASSERT(operands.length() == descriptor->environment_length()); |
| 2347 HCallWithDescriptor* res = |
| 2348 new(zone) HCallWithDescriptor(target, argument_count, |
| 2349 descriptor, operands, zone); |
| 2350 return res; |
| 2351 } |
| 2352 |
| 2353 virtual int OperandCount() V8_FINAL V8_OVERRIDE { return values_.length(); } |
| 2354 virtual HValue* OperandAt(int index) const V8_FINAL V8_OVERRIDE { |
| 2355 return values_[index]; |
| 2356 } |
| 2357 |
| 2358 virtual Representation RequiredInputRepresentation( |
| 2359 int index) V8_FINAL V8_OVERRIDE { |
| 2360 if (index == 0) { |
| 2361 return Representation::Tagged(); |
| 2362 } else { |
| 2363 int par_index = index - 1; |
| 2364 ASSERT(par_index < descriptor_->environment_length()); |
| 2365 return descriptor_->GetParameterRepresentation(par_index); |
| 2366 } |
| 2367 } |
| 2368 |
| 2369 DECLARE_CONCRETE_INSTRUCTION(CallWithDescriptor) |
| 2370 |
| 2371 virtual HType CalculateInferredType() V8_FINAL V8_OVERRIDE { |
| 2372 return HType::Tagged(); |
| 2373 } |
| 2374 |
| 2375 virtual int argument_count() const { |
| 2376 return argument_count_; |
| 2377 } |
| 2378 |
| 2379 virtual int argument_delta() const V8_OVERRIDE { |
| 2380 return -argument_count_; |
| 2381 } |
| 2382 |
| 2383 const CallInterfaceDescriptor* descriptor() const { |
| 2384 return descriptor_; |
| 2385 } |
| 2386 |
| 2387 HValue* target() { |
| 2388 return OperandAt(0); |
| 2389 } |
| 2390 |
| 2391 virtual bool IsCall() V8_FINAL V8_OVERRIDE { return true; } |
| 2392 |
| 2393 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
| 2394 |
| 2395 private: |
| 2396 // The argument count includes the receiver. |
| 2397 HCallWithDescriptor(HValue* target, |
| 2398 int argument_count, |
| 2399 const CallInterfaceDescriptor* descriptor, |
| 2400 Vector<HValue*>& operands, |
| 2401 Zone* zone) |
| 2402 : descriptor_(descriptor), |
| 2403 values_(descriptor->environment_length() + 1, zone) { |
| 2404 argument_count_ = argument_count; |
| 2405 AddOperand(target, zone); |
| 2406 for (int i = 0; i < operands.length(); i++) { |
| 2407 AddOperand(operands[i], zone); |
| 2408 } |
| 2409 this->set_representation(Representation::Tagged()); |
| 2410 this->SetAllSideEffects(); |
| 2411 } |
| 2412 |
| 2413 void AddOperand(HValue* v, Zone* zone) { |
| 2414 values_.Add(NULL, zone); |
| 2415 SetOperandAt(values_.length() - 1, v); |
| 2416 } |
| 2417 |
| 2418 void InternalSetOperandAt(int index, |
| 2419 HValue* value) V8_FINAL V8_OVERRIDE { |
| 2420 values_[index] = value; |
| 2421 } |
| 2422 |
| 2423 const CallInterfaceDescriptor* descriptor_; |
| 2424 ZoneList<HValue*> values_; |
| 2425 int argument_count_; |
| 2426 }; |
| 2427 |
| 2428 |
2289 class HInvokeFunction V8_FINAL : public HBinaryCall { | 2429 class HInvokeFunction V8_FINAL : public HBinaryCall { |
2290 public: | 2430 public: |
2291 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInvokeFunction, HValue*, int); | 2431 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInvokeFunction, HValue*, int); |
2292 | 2432 |
2293 HInvokeFunction(HValue* context, | 2433 HInvokeFunction(HValue* context, |
2294 HValue* function, | 2434 HValue* function, |
2295 Handle<JSFunction> known_function, | 2435 Handle<JSFunction> known_function, |
2296 int argument_count) | 2436 int argument_count) |
2297 : HBinaryCall(context, function, argument_count), | 2437 : HBinaryCall(context, function, argument_count), |
2298 known_function_(known_function) { | 2438 known_function_(known_function) { |
(...skipping 29 matching lines...) Expand all Loading... |
2328 : HBinaryCall(context, function, argument_count), | 2468 : HBinaryCall(context, function, argument_count), |
2329 has_stack_check_(false) { | 2469 has_stack_check_(false) { |
2330 } | 2470 } |
2331 | 2471 |
2332 Handle<JSFunction> known_function_; | 2472 Handle<JSFunction> known_function_; |
2333 int formal_parameter_count_; | 2473 int formal_parameter_count_; |
2334 bool has_stack_check_; | 2474 bool has_stack_check_; |
2335 }; | 2475 }; |
2336 | 2476 |
2337 | 2477 |
2338 class HCallConstantFunction V8_FINAL : public HCall<0> { | |
2339 public: | |
2340 DECLARE_INSTRUCTION_FACTORY_P2(HCallConstantFunction, | |
2341 Handle<JSFunction>, | |
2342 int); | |
2343 | |
2344 Handle<JSFunction> function() const { return function_; } | |
2345 int formal_parameter_count() const { return formal_parameter_count_; } | |
2346 | |
2347 bool IsApplyFunction() const { | |
2348 return function_->code() == | |
2349 function_->GetIsolate()->builtins()->builtin(Builtins::kFunctionApply); | |
2350 } | |
2351 | |
2352 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | |
2353 | |
2354 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | |
2355 return Representation::None(); | |
2356 } | |
2357 | |
2358 virtual bool HasStackCheck() V8_FINAL V8_OVERRIDE { | |
2359 return has_stack_check_; | |
2360 } | |
2361 | |
2362 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction) | |
2363 | |
2364 private: | |
2365 HCallConstantFunction(Handle<JSFunction> function, int argument_count) | |
2366 : HCall<0>(argument_count), | |
2367 function_(function), | |
2368 formal_parameter_count_(function->shared()->formal_parameter_count()), | |
2369 has_stack_check_( | |
2370 function->code()->kind() == Code::FUNCTION || | |
2371 function->code()->kind() == Code::OPTIMIZED_FUNCTION) {} | |
2372 | |
2373 Handle<JSFunction> function_; | |
2374 int formal_parameter_count_; | |
2375 bool has_stack_check_; | |
2376 }; | |
2377 | |
2378 | |
2379 class HCallKeyed V8_FINAL : public HBinaryCall { | |
2380 public: | |
2381 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallKeyed, HValue*, int); | |
2382 | |
2383 HValue* context() { return first(); } | |
2384 HValue* key() { return second(); } | |
2385 | |
2386 DECLARE_CONCRETE_INSTRUCTION(CallKeyed) | |
2387 | |
2388 private: | |
2389 HCallKeyed(HValue* context, HValue* key, int argument_count) | |
2390 : HBinaryCall(context, key, argument_count) { | |
2391 } | |
2392 }; | |
2393 | |
2394 | |
2395 class HCallNamed V8_FINAL : public HUnaryCall { | |
2396 public: | |
2397 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallNamed, Handle<String>, int); | |
2398 | |
2399 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | |
2400 | |
2401 HValue* context() { return value(); } | |
2402 Handle<String> name() const { return name_; } | |
2403 | |
2404 DECLARE_CONCRETE_INSTRUCTION(CallNamed) | |
2405 | |
2406 private: | |
2407 HCallNamed(HValue* context, Handle<String> name, int argument_count) | |
2408 : HUnaryCall(context, argument_count), name_(name) { | |
2409 } | |
2410 | |
2411 Handle<String> name_; | |
2412 }; | |
2413 | |
2414 | |
2415 enum CallMode { | 2478 enum CallMode { |
2416 NORMAL_CALL, | 2479 NORMAL_CALL, |
2417 TAIL_CALL | 2480 TAIL_CALL |
2418 }; | 2481 }; |
2419 | 2482 |
2420 | 2483 |
2421 class HCallFunction V8_FINAL : public HBinaryCall { | 2484 class HCallFunction V8_FINAL : public HBinaryCall { |
2422 public: | 2485 public: |
2423 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallFunction, HValue*, int); | 2486 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallFunction, HValue*, int); |
2424 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3( | 2487 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3( |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2460 | 2523 |
2461 private: | 2524 private: |
2462 HCallGlobal(HValue* context, Handle<String> name, int argument_count) | 2525 HCallGlobal(HValue* context, Handle<String> name, int argument_count) |
2463 : HUnaryCall(context, argument_count), name_(name) { | 2526 : HUnaryCall(context, argument_count), name_(name) { |
2464 } | 2527 } |
2465 | 2528 |
2466 Handle<String> name_; | 2529 Handle<String> name_; |
2467 }; | 2530 }; |
2468 | 2531 |
2469 | 2532 |
2470 class HCallKnownGlobal V8_FINAL : public HCall<0> { | |
2471 public: | |
2472 DECLARE_INSTRUCTION_FACTORY_P2(HCallKnownGlobal, Handle<JSFunction>, int); | |
2473 | |
2474 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | |
2475 | |
2476 Handle<JSFunction> target() const { return target_; } | |
2477 int formal_parameter_count() const { return formal_parameter_count_; } | |
2478 | |
2479 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | |
2480 return Representation::None(); | |
2481 } | |
2482 | |
2483 virtual bool HasStackCheck() V8_FINAL V8_OVERRIDE { | |
2484 return has_stack_check_; | |
2485 } | |
2486 | |
2487 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal) | |
2488 | |
2489 private: | |
2490 HCallKnownGlobal(Handle<JSFunction> target, int argument_count) | |
2491 : HCall<0>(argument_count), | |
2492 target_(target), | |
2493 formal_parameter_count_(target->shared()->formal_parameter_count()), | |
2494 has_stack_check_( | |
2495 target->code()->kind() == Code::FUNCTION || | |
2496 target->code()->kind() == Code::OPTIMIZED_FUNCTION) {} | |
2497 | |
2498 Handle<JSFunction> target_; | |
2499 int formal_parameter_count_; | |
2500 bool has_stack_check_; | |
2501 }; | |
2502 | |
2503 | |
2504 class HCallNew V8_FINAL : public HBinaryCall { | 2533 class HCallNew V8_FINAL : public HBinaryCall { |
2505 public: | 2534 public: |
2506 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallNew, HValue*, int); | 2535 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallNew, HValue*, int); |
2507 | 2536 |
2508 HValue* context() { return first(); } | 2537 HValue* context() { return first(); } |
2509 HValue* constructor() { return second(); } | 2538 HValue* constructor() { return second(); } |
2510 | 2539 |
2511 DECLARE_CONCRETE_INSTRUCTION(CallNew) | 2540 DECLARE_CONCRETE_INSTRUCTION(CallNew) |
2512 | 2541 |
2513 private: | 2542 private: |
(...skipping 5029 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7543 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 7572 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
7544 }; | 7573 }; |
7545 | 7574 |
7546 | 7575 |
7547 #undef DECLARE_INSTRUCTION | 7576 #undef DECLARE_INSTRUCTION |
7548 #undef DECLARE_CONCRETE_INSTRUCTION | 7577 #undef DECLARE_CONCRETE_INSTRUCTION |
7549 | 7578 |
7550 } } // namespace v8::internal | 7579 } } // namespace v8::internal |
7551 | 7580 |
7552 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7581 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |