| 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(CallKeyed) \ | |
| 84 V(CallKnownGlobal) \ | |
| 85 V(CallNamed) \ | |
| 86 V(CallNew) \ | 83 V(CallNew) \ |
| 87 V(CallNewArray) \ | 84 V(CallNewArray) \ |
| 88 V(CallRuntime) \ | 85 V(CallRuntime) \ |
| 89 V(CallStub) \ | 86 V(CallStub) \ |
| 90 V(CapturedObject) \ | 87 V(CapturedObject) \ |
| 91 V(Change) \ | 88 V(Change) \ |
| 92 V(CheckHeapObject) \ | 89 V(CheckHeapObject) \ |
| 93 V(CheckInstanceType) \ | 90 V(CheckInstanceType) \ |
| 94 V(CheckMaps) \ | 91 V(CheckMaps) \ |
| 95 V(CheckMapValue) \ | 92 V(CheckMapValue) \ |
| (...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 use_list_(NULL), | 635 use_list_(NULL), |
| 639 range_(NULL), | 636 range_(NULL), |
| 640 flags_(0) {} | 637 flags_(0) {} |
| 641 virtual ~HValue() {} | 638 virtual ~HValue() {} |
| 642 | 639 |
| 643 virtual int position() const { return RelocInfo::kNoPosition; } | 640 virtual int position() const { return RelocInfo::kNoPosition; } |
| 644 virtual int operand_position(int index) const { return position(); } | 641 virtual int operand_position(int index) const { return position(); } |
| 645 | 642 |
| 646 HBasicBlock* block() const { return block_; } | 643 HBasicBlock* block() const { return block_; } |
| 647 void SetBlock(HBasicBlock* block); | 644 void SetBlock(HBasicBlock* block); |
| 648 int LoopWeight() const; | |
| 649 | 645 |
| 650 // Note: Never call this method for an unlinked value. | 646 // Note: Never call this method for an unlinked value. |
| 651 Isolate* isolate() const; | 647 Isolate* isolate() const; |
| 652 | 648 |
| 653 int id() const { return id_; } | 649 int id() const { return id_; } |
| 654 void set_id(int id) { id_ = id; } | 650 void set_id(int id) { id_ = id; } |
| 655 | 651 |
| 656 HUseIterator uses() const { return HUseIterator(use_list_); } | 652 HUseIterator uses() const { return HUseIterator(use_list_); } |
| 657 | 653 |
| 658 virtual bool EmitAtUses() { return false; } | 654 virtual bool EmitAtUses() { return false; } |
| (...skipping 1615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2274 virtual Representation RequiredInputRepresentation( | 2270 virtual Representation RequiredInputRepresentation( |
| 2275 int index) V8_FINAL V8_OVERRIDE { | 2271 int index) V8_FINAL V8_OVERRIDE { |
| 2276 return Representation::Tagged(); | 2272 return Representation::Tagged(); |
| 2277 } | 2273 } |
| 2278 | 2274 |
| 2279 HValue* first() { return OperandAt(0); } | 2275 HValue* first() { return OperandAt(0); } |
| 2280 HValue* second() { return OperandAt(1); } | 2276 HValue* second() { return OperandAt(1); } |
| 2281 }; | 2277 }; |
| 2282 | 2278 |
| 2283 | 2279 |
| 2280 class HCallJSFunction V8_FINAL : public HCall<1> { |
| 2281 public: |
| 2282 static HCallJSFunction* New(Zone* zone, |
| 2283 HValue* context, |
| 2284 HValue* function, |
| 2285 int argument_count, |
| 2286 bool pass_argument_count); |
| 2287 |
| 2288 HValue* function() { return OperandAt(0); } |
| 2289 |
| 2290 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
| 2291 |
| 2292 virtual Representation RequiredInputRepresentation( |
| 2293 int index) V8_FINAL V8_OVERRIDE { |
| 2294 ASSERT(index == 0); |
| 2295 return Representation::Tagged(); |
| 2296 } |
| 2297 |
| 2298 bool pass_argument_count() const { return pass_argument_count_; } |
| 2299 |
| 2300 virtual bool HasStackCheck() V8_FINAL V8_OVERRIDE { |
| 2301 return has_stack_check_; |
| 2302 } |
| 2303 |
| 2304 DECLARE_CONCRETE_INSTRUCTION(CallJSFunction) |
| 2305 |
| 2306 private: |
| 2307 // The argument count includes the receiver. |
| 2308 HCallJSFunction(HValue* function, |
| 2309 int argument_count, |
| 2310 bool pass_argument_count, |
| 2311 bool has_stack_check) |
| 2312 : HCall<1>(argument_count), |
| 2313 pass_argument_count_(pass_argument_count), |
| 2314 has_stack_check_(has_stack_check) { |
| 2315 SetOperandAt(0, function); |
| 2316 } |
| 2317 |
| 2318 bool pass_argument_count_; |
| 2319 bool has_stack_check_; |
| 2320 }; |
| 2321 |
| 2322 |
| 2323 class HCallWithDescriptor V8_FINAL : public HInstruction { |
| 2324 public: |
| 2325 static HCallWithDescriptor* New(Zone* zone, HValue* context, |
| 2326 HValue* target, |
| 2327 int argument_count, |
| 2328 const CallInterfaceDescriptor* descriptor, |
| 2329 Vector<HValue*>& operands) { |
| 2330 ASSERT(operands.length() == descriptor->environment_length()); |
| 2331 HCallWithDescriptor* res = |
| 2332 new(zone) HCallWithDescriptor(target, argument_count, |
| 2333 descriptor, operands, zone); |
| 2334 return res; |
| 2335 } |
| 2336 |
| 2337 virtual int OperandCount() V8_FINAL V8_OVERRIDE { return values_.length(); } |
| 2338 virtual HValue* OperandAt(int index) const V8_FINAL V8_OVERRIDE { |
| 2339 return values_[index]; |
| 2340 } |
| 2341 |
| 2342 virtual Representation RequiredInputRepresentation( |
| 2343 int index) V8_FINAL V8_OVERRIDE { |
| 2344 if (index == 0) { |
| 2345 return Representation::Tagged(); |
| 2346 } else { |
| 2347 int par_index = index - 1; |
| 2348 ASSERT(par_index < descriptor_->environment_length()); |
| 2349 return descriptor_->GetParameterRepresentation(par_index); |
| 2350 } |
| 2351 } |
| 2352 |
| 2353 DECLARE_CONCRETE_INSTRUCTION(CallWithDescriptor) |
| 2354 |
| 2355 virtual HType CalculateInferredType() V8_FINAL V8_OVERRIDE { |
| 2356 return HType::Tagged(); |
| 2357 } |
| 2358 |
| 2359 virtual int argument_count() const { |
| 2360 return argument_count_; |
| 2361 } |
| 2362 |
| 2363 virtual int argument_delta() const V8_OVERRIDE { |
| 2364 return -argument_count_; |
| 2365 } |
| 2366 |
| 2367 const CallInterfaceDescriptor* descriptor() const { |
| 2368 return descriptor_; |
| 2369 } |
| 2370 |
| 2371 HValue* target() { |
| 2372 return OperandAt(0); |
| 2373 } |
| 2374 |
| 2375 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
| 2376 |
| 2377 private: |
| 2378 // The argument count includes the receiver. |
| 2379 HCallWithDescriptor(HValue* target, |
| 2380 int argument_count, |
| 2381 const CallInterfaceDescriptor* descriptor, |
| 2382 Vector<HValue*>& operands, |
| 2383 Zone* zone) |
| 2384 : descriptor_(descriptor), |
| 2385 values_(descriptor->environment_length() + 1, zone) { |
| 2386 argument_count_ = argument_count; |
| 2387 AddOperand(target, zone); |
| 2388 for (int i = 0; i < operands.length(); i++) { |
| 2389 AddOperand(operands[i], zone); |
| 2390 } |
| 2391 this->set_representation(Representation::Tagged()); |
| 2392 this->SetAllSideEffects(); |
| 2393 } |
| 2394 |
| 2395 void AddOperand(HValue* v, Zone* zone) { |
| 2396 values_.Add(NULL, zone); |
| 2397 SetOperandAt(values_.length() - 1, v); |
| 2398 } |
| 2399 |
| 2400 void InternalSetOperandAt(int index, |
| 2401 HValue* value) V8_FINAL V8_OVERRIDE { |
| 2402 values_[index] = value; |
| 2403 } |
| 2404 |
| 2405 const CallInterfaceDescriptor* descriptor_; |
| 2406 ZoneList<HValue*> values_; |
| 2407 int argument_count_; |
| 2408 }; |
| 2409 |
| 2410 |
| 2284 class HInvokeFunction V8_FINAL : public HBinaryCall { | 2411 class HInvokeFunction V8_FINAL : public HBinaryCall { |
| 2285 public: | 2412 public: |
| 2286 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInvokeFunction, HValue*, int); | 2413 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInvokeFunction, HValue*, int); |
| 2287 | 2414 |
| 2288 HInvokeFunction(HValue* context, | 2415 HInvokeFunction(HValue* context, |
| 2289 HValue* function, | 2416 HValue* function, |
| 2290 Handle<JSFunction> known_function, | 2417 Handle<JSFunction> known_function, |
| 2291 int argument_count) | 2418 int argument_count) |
| 2292 : HBinaryCall(context, function, argument_count), | 2419 : HBinaryCall(context, function, argument_count), |
| 2293 known_function_(known_function) { | 2420 known_function_(known_function) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 2323 : HBinaryCall(context, function, argument_count), | 2450 : HBinaryCall(context, function, argument_count), |
| 2324 has_stack_check_(false) { | 2451 has_stack_check_(false) { |
| 2325 } | 2452 } |
| 2326 | 2453 |
| 2327 Handle<JSFunction> known_function_; | 2454 Handle<JSFunction> known_function_; |
| 2328 int formal_parameter_count_; | 2455 int formal_parameter_count_; |
| 2329 bool has_stack_check_; | 2456 bool has_stack_check_; |
| 2330 }; | 2457 }; |
| 2331 | 2458 |
| 2332 | 2459 |
| 2333 class HCallConstantFunction V8_FINAL : public HCall<0> { | |
| 2334 public: | |
| 2335 DECLARE_INSTRUCTION_FACTORY_P2(HCallConstantFunction, | |
| 2336 Handle<JSFunction>, | |
| 2337 int); | |
| 2338 | |
| 2339 Handle<JSFunction> function() const { return function_; } | |
| 2340 int formal_parameter_count() const { return formal_parameter_count_; } | |
| 2341 | |
| 2342 bool IsApplyFunction() const { | |
| 2343 return function_->code() == | |
| 2344 function_->GetIsolate()->builtins()->builtin(Builtins::kFunctionApply); | |
| 2345 } | |
| 2346 | |
| 2347 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | |
| 2348 | |
| 2349 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | |
| 2350 return Representation::None(); | |
| 2351 } | |
| 2352 | |
| 2353 virtual bool HasStackCheck() V8_FINAL V8_OVERRIDE { | |
| 2354 return has_stack_check_; | |
| 2355 } | |
| 2356 | |
| 2357 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction) | |
| 2358 | |
| 2359 private: | |
| 2360 HCallConstantFunction(Handle<JSFunction> function, int argument_count) | |
| 2361 : HCall<0>(argument_count), | |
| 2362 function_(function), | |
| 2363 formal_parameter_count_(function->shared()->formal_parameter_count()), | |
| 2364 has_stack_check_( | |
| 2365 function->code()->kind() == Code::FUNCTION || | |
| 2366 function->code()->kind() == Code::OPTIMIZED_FUNCTION) {} | |
| 2367 | |
| 2368 Handle<JSFunction> function_; | |
| 2369 int formal_parameter_count_; | |
| 2370 bool has_stack_check_; | |
| 2371 }; | |
| 2372 | |
| 2373 | |
| 2374 class HCallKeyed V8_FINAL : public HBinaryCall { | |
| 2375 public: | |
| 2376 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallKeyed, HValue*, int); | |
| 2377 | |
| 2378 HValue* context() { return first(); } | |
| 2379 HValue* key() { return second(); } | |
| 2380 | |
| 2381 DECLARE_CONCRETE_INSTRUCTION(CallKeyed) | |
| 2382 | |
| 2383 private: | |
| 2384 HCallKeyed(HValue* context, HValue* key, int argument_count) | |
| 2385 : HBinaryCall(context, key, argument_count) { | |
| 2386 } | |
| 2387 }; | |
| 2388 | |
| 2389 | |
| 2390 class HCallNamed V8_FINAL : public HUnaryCall { | |
| 2391 public: | |
| 2392 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallNamed, Handle<String>, int); | |
| 2393 | |
| 2394 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | |
| 2395 | |
| 2396 HValue* context() { return value(); } | |
| 2397 Handle<String> name() const { return name_; } | |
| 2398 | |
| 2399 DECLARE_CONCRETE_INSTRUCTION(CallNamed) | |
| 2400 | |
| 2401 private: | |
| 2402 HCallNamed(HValue* context, Handle<String> name, int argument_count) | |
| 2403 : HUnaryCall(context, argument_count), name_(name) { | |
| 2404 } | |
| 2405 | |
| 2406 Handle<String> name_; | |
| 2407 }; | |
| 2408 | |
| 2409 | |
| 2410 enum CallMode { | 2460 enum CallMode { |
| 2411 NORMAL_CALL, | 2461 NORMAL_CALL, |
| 2412 TAIL_CALL, | 2462 TAIL_CALL, |
| 2413 NORMAL_CONTEXTUAL_CALL | 2463 NORMAL_CONTEXTUAL_CALL |
| 2414 }; | 2464 }; |
| 2415 | 2465 |
| 2416 | 2466 |
| 2417 class HCallFunction V8_FINAL : public HBinaryCall { | 2467 class HCallFunction V8_FINAL : public HBinaryCall { |
| 2418 public: | 2468 public: |
| 2419 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallFunction, HValue*, int); | 2469 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallFunction, HValue*, int); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 2436 HCallFunction(HValue* context, | 2486 HCallFunction(HValue* context, |
| 2437 HValue* function, | 2487 HValue* function, |
| 2438 int argument_count, | 2488 int argument_count, |
| 2439 CallMode mode = NORMAL_CALL) | 2489 CallMode mode = NORMAL_CALL) |
| 2440 : HBinaryCall(context, function, argument_count), call_mode_(mode) { | 2490 : HBinaryCall(context, function, argument_count), call_mode_(mode) { |
| 2441 } | 2491 } |
| 2442 CallMode call_mode_; | 2492 CallMode call_mode_; |
| 2443 }; | 2493 }; |
| 2444 | 2494 |
| 2445 | 2495 |
| 2446 class HCallGlobal V8_FINAL : public HUnaryCall { | |
| 2447 public: | |
| 2448 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallGlobal, Handle<String>, int); | |
| 2449 | |
| 2450 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | |
| 2451 | |
| 2452 HValue* context() { return value(); } | |
| 2453 Handle<String> name() const { return name_; } | |
| 2454 | |
| 2455 DECLARE_CONCRETE_INSTRUCTION(CallGlobal) | |
| 2456 | |
| 2457 private: | |
| 2458 HCallGlobal(HValue* context, Handle<String> name, int argument_count) | |
| 2459 : HUnaryCall(context, argument_count), name_(name) { | |
| 2460 } | |
| 2461 | |
| 2462 Handle<String> name_; | |
| 2463 }; | |
| 2464 | |
| 2465 | |
| 2466 class HCallKnownGlobal V8_FINAL : public HCall<0> { | |
| 2467 public: | |
| 2468 DECLARE_INSTRUCTION_FACTORY_P2(HCallKnownGlobal, Handle<JSFunction>, int); | |
| 2469 | |
| 2470 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | |
| 2471 | |
| 2472 Handle<JSFunction> target() const { return target_; } | |
| 2473 int formal_parameter_count() const { return formal_parameter_count_; } | |
| 2474 | |
| 2475 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | |
| 2476 return Representation::None(); | |
| 2477 } | |
| 2478 | |
| 2479 virtual bool HasStackCheck() V8_FINAL V8_OVERRIDE { | |
| 2480 return has_stack_check_; | |
| 2481 } | |
| 2482 | |
| 2483 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal) | |
| 2484 | |
| 2485 private: | |
| 2486 HCallKnownGlobal(Handle<JSFunction> target, int argument_count) | |
| 2487 : HCall<0>(argument_count), | |
| 2488 target_(target), | |
| 2489 formal_parameter_count_(target->shared()->formal_parameter_count()), | |
| 2490 has_stack_check_( | |
| 2491 target->code()->kind() == Code::FUNCTION || | |
| 2492 target->code()->kind() == Code::OPTIMIZED_FUNCTION) {} | |
| 2493 | |
| 2494 Handle<JSFunction> target_; | |
| 2495 int formal_parameter_count_; | |
| 2496 bool has_stack_check_; | |
| 2497 }; | |
| 2498 | |
| 2499 | |
| 2500 class HCallNew V8_FINAL : public HBinaryCall { | 2496 class HCallNew V8_FINAL : public HBinaryCall { |
| 2501 public: | 2497 public: |
| 2502 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallNew, HValue*, int); | 2498 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallNew, HValue*, int); |
| 2503 | 2499 |
| 2504 HValue* context() { return first(); } | 2500 HValue* context() { return first(); } |
| 2505 HValue* constructor() { return second(); } | 2501 HValue* constructor() { return second(); } |
| 2506 | 2502 |
| 2507 DECLARE_CONCRETE_INSTRUCTION(CallNew) | 2503 DECLARE_CONCRETE_INSTRUCTION(CallNew) |
| 2508 | 2504 |
| 2509 private: | 2505 private: |
| (...skipping 5070 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7580 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 7576 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
| 7581 }; | 7577 }; |
| 7582 | 7578 |
| 7583 | 7579 |
| 7584 #undef DECLARE_INSTRUCTION | 7580 #undef DECLARE_INSTRUCTION |
| 7585 #undef DECLARE_CONCRETE_INSTRUCTION | 7581 #undef DECLARE_CONCRETE_INSTRUCTION |
| 7586 | 7582 |
| 7587 } } // namespace v8::internal | 7583 } } // namespace v8::internal |
| 7588 | 7584 |
| 7589 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7585 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |