OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
87 V(CheckMap) \ | 87 V(CheckMap) \ |
88 V(CheckNonSmi) \ | 88 V(CheckNonSmi) \ |
89 V(CheckPrototypeMaps) \ | 89 V(CheckPrototypeMaps) \ |
90 V(CheckSmi) \ | 90 V(CheckSmi) \ |
91 V(ClampToUint8) \ | 91 V(ClampToUint8) \ |
92 V(ClassOfTest) \ | 92 V(ClassOfTest) \ |
93 V(Compare) \ | 93 V(Compare) \ |
94 V(CompareJSObjectEq) \ | 94 V(CompareJSObjectEq) \ |
95 V(CompareMap) \ | 95 V(CompareMap) \ |
96 V(CompareSymbolEq) \ | 96 V(CompareSymbolEq) \ |
97 V(CompareWithConstant) \ | |
97 V(Constant) \ | 98 V(Constant) \ |
98 V(Context) \ | 99 V(Context) \ |
99 V(DeleteProperty) \ | 100 V(DeleteProperty) \ |
100 V(Deoptimize) \ | 101 V(Deoptimize) \ |
101 V(Div) \ | 102 V(Div) \ |
103 V(ElementsKind) \ | |
102 V(EnterInlined) \ | 104 V(EnterInlined) \ |
103 V(ExternalArrayLength) \ | 105 V(ExternalArrayLength) \ |
104 V(FixedArrayLength) \ | 106 V(FixedArrayLength) \ |
105 V(ForceRepresentation) \ | 107 V(ForceRepresentation) \ |
106 V(FunctionLiteral) \ | 108 V(FunctionLiteral) \ |
107 V(GetCachedArrayIndex) \ | 109 V(GetCachedArrayIndex) \ |
108 V(GlobalObject) \ | 110 V(GlobalObject) \ |
109 V(GlobalReceiver) \ | 111 V(GlobalReceiver) \ |
110 V(Goto) \ | 112 V(Goto) \ |
111 V(HasCachedArrayIndex) \ | 113 V(HasCachedArrayIndex) \ |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
395 enum Type { | 397 enum Type { |
396 kTagged = 0x1, // 0000 0000 0000 0001 | 398 kTagged = 0x1, // 0000 0000 0000 0001 |
397 kTaggedPrimitive = 0x5, // 0000 0000 0000 0101 | 399 kTaggedPrimitive = 0x5, // 0000 0000 0000 0101 |
398 kTaggedNumber = 0xd, // 0000 0000 0000 1101 | 400 kTaggedNumber = 0xd, // 0000 0000 0000 1101 |
399 kSmi = 0x1d, // 0000 0000 0001 1101 | 401 kSmi = 0x1d, // 0000 0000 0001 1101 |
400 kHeapNumber = 0x2d, // 0000 0000 0010 1101 | 402 kHeapNumber = 0x2d, // 0000 0000 0010 1101 |
401 kString = 0x45, // 0000 0000 0100 0101 | 403 kString = 0x45, // 0000 0000 0100 0101 |
402 kBoolean = 0x85, // 0000 0000 1000 0101 | 404 kBoolean = 0x85, // 0000 0000 1000 0101 |
403 kNonPrimitive = 0x101, // 0000 0001 0000 0001 | 405 kNonPrimitive = 0x101, // 0000 0001 0000 0001 |
404 kJSObject = 0x301, // 0000 0011 0000 0001 | 406 kJSObject = 0x301, // 0000 0011 0000 0001 |
405 kJSArray = 0x701, // 0000 0111 1000 0001 | 407 kJSArray = 0x701, // 0000 0111 0000 0001 |
fschneider
2011/06/15 12:11:46
Accidental edit?
Jakob Kummerow
2011/06/15 12:28:58
Nope. In a drive-by fashion, I noticed that commen
| |
406 kUninitialized = 0x1fff // 0001 1111 1111 1111 | 408 kUninitialized = 0x1fff // 0001 1111 1111 1111 |
407 }; | 409 }; |
408 | 410 |
409 // Make sure type fits in int16. | 411 // Make sure type fits in int16. |
410 STATIC_ASSERT(kUninitialized < (1 << (2 * kBitsPerByte))); | 412 STATIC_ASSERT(kUninitialized < (1 << (2 * kBitsPerByte))); |
411 | 413 |
412 explicit HType(Type t) : type_(t) { } | 414 explicit HType(Type t) : type_(t) { } |
413 | 415 |
414 int16_t type_; | 416 int16_t type_; |
415 }; | 417 }; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
477 | 479 |
478 // There must be one corresponding kDepends flag for every kChanges flag and | 480 // There must be one corresponding kDepends flag for every kChanges flag and |
479 // the order of the kChanges flags must be exactly the same as of the kDepends | 481 // the order of the kChanges flags must be exactly the same as of the kDepends |
480 // flags. | 482 // flags. |
481 enum Flag { | 483 enum Flag { |
482 // Declare global value numbering flags. | 484 // Declare global value numbering flags. |
483 #define DECLARE_DO(type) kChanges##type, kDependsOn##type, | 485 #define DECLARE_DO(type) kChanges##type, kDependsOn##type, |
484 GVN_FLAG_LIST(DECLARE_DO) | 486 GVN_FLAG_LIST(DECLARE_DO) |
485 #undef DECLARE_DO | 487 #undef DECLARE_DO |
486 kFlexibleRepresentation, | 488 kFlexibleRepresentation, |
487 kUseGVN, | 489 kUseGVN, // Participate in Global Value Numbering, i.e. elimination of |
fschneider
2011/06/15 12:11:46
I'd insert the comment in a separate line before k
Jakob Kummerow
2011/06/15 12:28:58
Done.
| |
490 // unnecessary recomputations. If an instruction sets this flag, it must | |
491 // implement DataEquals(), which will be used to determine if other | |
492 // occurrences of the instruction are indeed the same. | |
488 kCanOverflow, | 493 kCanOverflow, |
489 kBailoutOnMinusZero, | 494 kBailoutOnMinusZero, |
490 kCanBeDivByZero, | 495 kCanBeDivByZero, |
491 kDeoptimizeOnUndefined, | 496 kDeoptimizeOnUndefined, |
492 kIsArguments, | 497 kIsArguments, |
493 kTruncatingToInt32, | 498 kTruncatingToInt32, |
494 kLastFlag = kTruncatingToInt32 | 499 kLastFlag = kTruncatingToInt32 |
495 }; | 500 }; |
496 | 501 |
497 STATIC_ASSERT(kLastFlag < kBitsPerInt); | 502 STATIC_ASSERT(kLastFlag < kBitsPerInt); |
(...skipping 1202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1700 return Representation::Tagged(); | 1705 return Representation::Tagged(); |
1701 } | 1706 } |
1702 | 1707 |
1703 DECLARE_CONCRETE_INSTRUCTION(ExternalArrayLength) | 1708 DECLARE_CONCRETE_INSTRUCTION(ExternalArrayLength) |
1704 | 1709 |
1705 protected: | 1710 protected: |
1706 virtual bool DataEquals(HValue* other) { return true; } | 1711 virtual bool DataEquals(HValue* other) { return true; } |
1707 }; | 1712 }; |
1708 | 1713 |
1709 | 1714 |
1715 class HElementsKind: public HUnaryOperation { | |
1716 public: | |
1717 explicit HElementsKind(HValue* value) : HUnaryOperation(value) { | |
1718 set_representation(Representation::Integer32()); | |
1719 SetFlag(kUseGVN); | |
1720 SetFlag(kDependsOnMaps); | |
1721 } | |
1722 | |
1723 virtual Representation RequiredInputRepresentation(int index) const { | |
1724 return Representation::Tagged(); | |
1725 } | |
1726 | |
1727 DECLARE_CONCRETE_INSTRUCTION(ElementsKind) | |
1728 | |
1729 protected: | |
1730 virtual bool DataEquals(HValue* other) { return true; } | |
1731 }; | |
1732 | |
1733 | |
1710 class HBitNot: public HUnaryOperation { | 1734 class HBitNot: public HUnaryOperation { |
1711 public: | 1735 public: |
1712 explicit HBitNot(HValue* value) : HUnaryOperation(value) { | 1736 explicit HBitNot(HValue* value) : HUnaryOperation(value) { |
1713 set_representation(Representation::Integer32()); | 1737 set_representation(Representation::Integer32()); |
1714 SetFlag(kUseGVN); | 1738 SetFlag(kUseGVN); |
1715 SetFlag(kTruncatingToInt32); | 1739 SetFlag(kTruncatingToInt32); |
1716 } | 1740 } |
1717 | 1741 |
1718 virtual Representation RequiredInputRepresentation(int index) const { | 1742 virtual Representation RequiredInputRepresentation(int index) const { |
1719 return Representation::Integer32(); | 1743 return Representation::Integer32(); |
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2582 protected: | 2606 protected: |
2583 virtual bool DataEquals(HValue* other) { | 2607 virtual bool DataEquals(HValue* other) { |
2584 return op_ == HCompareSymbolEq::cast(other)->op_; | 2608 return op_ == HCompareSymbolEq::cast(other)->op_; |
2585 } | 2609 } |
2586 | 2610 |
2587 private: | 2611 private: |
2588 const Token::Value op_; | 2612 const Token::Value op_; |
2589 }; | 2613 }; |
2590 | 2614 |
2591 | 2615 |
2616 class HCompareWithConstant: public HUnaryOperation { | |
2617 public: | |
2618 HCompareWithConstant(HValue* left, int right, Token::Value op) | |
2619 : HUnaryOperation(left), op_(op), right_(right) { | |
2620 ASSERT(op == Token::EQ || op == Token::EQ_STRICT); | |
2621 set_representation(Representation::Tagged()); | |
2622 SetFlag(kUseGVN); | |
2623 } | |
2624 | |
2625 Token::Value op() const { return op_; } | |
2626 int right() const { return right_; } | |
2627 | |
2628 virtual bool EmitAtUses() { | |
2629 return !HasSideEffects() && !HasMultipleUses(); | |
2630 } | |
2631 | |
2632 virtual Representation RequiredInputRepresentation(int index) const { | |
2633 return Representation::Integer32(); | |
2634 } | |
2635 | |
2636 virtual HType CalculateInferredType() { return HType::Boolean(); } | |
2637 | |
2638 DECLARE_CONCRETE_INSTRUCTION(CompareWithConstant); | |
2639 | |
2640 protected: | |
2641 virtual bool DataEquals(HValue* other) { | |
2642 HCompareWithConstant* other_instr = HCompareWithConstant::cast(other); | |
2643 return (op_ == other_instr->op_ && | |
2644 right_ == other_instr->right_); | |
2645 } | |
2646 | |
2647 private: | |
2648 const Token::Value op_; | |
2649 const int right_; | |
2650 }; | |
2651 | |
2652 | |
2592 class HUnaryPredicate: public HUnaryOperation { | 2653 class HUnaryPredicate: public HUnaryOperation { |
2593 public: | 2654 public: |
2594 explicit HUnaryPredicate(HValue* value) : HUnaryOperation(value) { | 2655 explicit HUnaryPredicate(HValue* value) : HUnaryOperation(value) { |
2595 set_representation(Representation::Tagged()); | 2656 set_representation(Representation::Tagged()); |
2596 SetFlag(kUseGVN); | 2657 SetFlag(kUseGVN); |
2597 } | 2658 } |
2598 | 2659 |
2599 virtual bool EmitAtUses() { | 2660 virtual bool EmitAtUses() { |
2600 return !HasSideEffects() && !HasMultipleUses(); | 2661 return !HasSideEffects() && !HasMultipleUses(); |
2601 } | 2662 } |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2687 HHasInstanceType(HValue* value, InstanceType type) | 2748 HHasInstanceType(HValue* value, InstanceType type) |
2688 : HUnaryPredicate(value), from_(type), to_(type) { } | 2749 : HUnaryPredicate(value), from_(type), to_(type) { } |
2689 HHasInstanceType(HValue* value, InstanceType from, InstanceType to) | 2750 HHasInstanceType(HValue* value, InstanceType from, InstanceType to) |
2690 : HUnaryPredicate(value), from_(from), to_(to) { | 2751 : HUnaryPredicate(value), from_(from), to_(to) { |
2691 ASSERT(to == LAST_TYPE); // Others not implemented yet in backend. | 2752 ASSERT(to == LAST_TYPE); // Others not implemented yet in backend. |
2692 } | 2753 } |
2693 | 2754 |
2694 InstanceType from() { return from_; } | 2755 InstanceType from() { return from_; } |
2695 InstanceType to() { return to_; } | 2756 InstanceType to() { return to_; } |
2696 | 2757 |
2758 virtual bool EmitAtUses() { | |
2759 return !HasSideEffects() && !HasMultipleUses(); | |
2760 } | |
2761 | |
2697 virtual void PrintDataTo(StringStream* stream); | 2762 virtual void PrintDataTo(StringStream* stream); |
2698 | 2763 |
2699 DECLARE_CONCRETE_INSTRUCTION(HasInstanceType) | 2764 DECLARE_CONCRETE_INSTRUCTION(HasInstanceType) |
2700 | 2765 |
2701 protected: | 2766 protected: |
2702 virtual bool DataEquals(HValue* other) { | 2767 virtual bool DataEquals(HValue* other) { |
2703 HHasInstanceType* b = HHasInstanceType::cast(other); | 2768 HHasInstanceType* b = HHasInstanceType::cast(other); |
2704 return (from_ == b->from()) && (to_ == b->to()); | 2769 return (from_ == b->from()) && (to_ == b->to()); |
2705 } | 2770 } |
2706 | 2771 |
(...skipping 1329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4036 | 4101 |
4037 DECLARE_CONCRETE_INSTRUCTION(In) | 4102 DECLARE_CONCRETE_INSTRUCTION(In) |
4038 }; | 4103 }; |
4039 | 4104 |
4040 #undef DECLARE_INSTRUCTION | 4105 #undef DECLARE_INSTRUCTION |
4041 #undef DECLARE_CONCRETE_INSTRUCTION | 4106 #undef DECLARE_CONCRETE_INSTRUCTION |
4042 | 4107 |
4043 } } // namespace v8::internal | 4108 } } // namespace v8::internal |
4044 | 4109 |
4045 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 4110 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |