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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 V(Simulate) \ | 148 V(Simulate) \ |
149 V(StackCheck) \ | 149 V(StackCheck) \ |
150 V(StoreContextSlot) \ | 150 V(StoreContextSlot) \ |
151 V(StoreGlobalCell) \ | 151 V(StoreGlobalCell) \ |
152 V(StoreGlobalGeneric) \ | 152 V(StoreGlobalGeneric) \ |
153 V(StoreKeyedFastElement) \ | 153 V(StoreKeyedFastElement) \ |
154 V(StoreKeyedSpecializedArrayElement) \ | 154 V(StoreKeyedSpecializedArrayElement) \ |
155 V(StoreKeyedGeneric) \ | 155 V(StoreKeyedGeneric) \ |
156 V(StoreNamedField) \ | 156 V(StoreNamedField) \ |
157 V(StoreNamedGeneric) \ | 157 V(StoreNamedGeneric) \ |
| 158 V(StringAdd) \ |
158 V(StringCharCodeAt) \ | 159 V(StringCharCodeAt) \ |
159 V(StringCharFromCode) \ | 160 V(StringCharFromCode) \ |
160 V(StringLength) \ | 161 V(StringLength) \ |
161 V(Sub) \ | 162 V(Sub) \ |
162 V(Test) \ | 163 V(Test) \ |
163 V(Throw) \ | 164 V(Throw) \ |
164 V(ToFastProperties) \ | 165 V(ToFastProperties) \ |
165 V(Typeof) \ | 166 V(Typeof) \ |
166 V(TypeofIs) \ | 167 V(TypeofIs) \ |
167 V(UnaryMathOperation) \ | 168 V(UnaryMathOperation) \ |
(...skipping 1532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1700 virtual bool IsCheckInstruction() const { return true; } | 1701 virtual bool IsCheckInstruction() const { return true; } |
1701 | 1702 |
1702 virtual Representation RequiredInputRepresentation(int index) const { | 1703 virtual Representation RequiredInputRepresentation(int index) const { |
1703 return Representation::Tagged(); | 1704 return Representation::Tagged(); |
1704 } | 1705 } |
1705 | 1706 |
1706 #ifdef DEBUG | 1707 #ifdef DEBUG |
1707 virtual void Verify(); | 1708 virtual void Verify(); |
1708 #endif | 1709 #endif |
1709 | 1710 |
| 1711 virtual HValue* Canonicalize() { |
| 1712 if (!value()->type().IsUninitialized() && |
| 1713 value()->type().IsString() && |
| 1714 first() == FIRST_STRING_TYPE && |
| 1715 last() == LAST_STRING_TYPE) { |
| 1716 return NULL; |
| 1717 } |
| 1718 return this; |
| 1719 } |
| 1720 |
1710 static HCheckInstanceType* NewIsJSObjectOrJSFunction(HValue* value); | 1721 static HCheckInstanceType* NewIsJSObjectOrJSFunction(HValue* value); |
1711 | 1722 |
1712 InstanceType first() const { return first_; } | 1723 InstanceType first() const { return first_; } |
1713 InstanceType last() const { return last_; } | 1724 InstanceType last() const { return last_; } |
1714 | 1725 |
1715 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType, "check_instance_type") | 1726 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType, "check_instance_type") |
1716 | 1727 |
1717 protected: | 1728 protected: |
1718 // TODO(ager): It could be nice to allow the ommision of instance | 1729 // TODO(ager): It could be nice to allow the ommision of instance |
1719 // type checks if we have already performed an instance type check | 1730 // type checks if we have already performed an instance type check |
(...skipping 21 matching lines...) Expand all Loading... |
1741 virtual Representation RequiredInputRepresentation(int index) const { | 1752 virtual Representation RequiredInputRepresentation(int index) const { |
1742 return Representation::Tagged(); | 1753 return Representation::Tagged(); |
1743 } | 1754 } |
1744 | 1755 |
1745 virtual HType CalculateInferredType(); | 1756 virtual HType CalculateInferredType(); |
1746 | 1757 |
1747 #ifdef DEBUG | 1758 #ifdef DEBUG |
1748 virtual void Verify(); | 1759 virtual void Verify(); |
1749 #endif | 1760 #endif |
1750 | 1761 |
| 1762 virtual HValue* Canonicalize() { |
| 1763 HType value_type = value()->type(); |
| 1764 if (!value_type.IsUninitialized() && |
| 1765 (value_type.IsHeapNumber() || |
| 1766 value_type.IsString() || |
| 1767 value_type.IsBoolean() || |
| 1768 value_type.IsNonPrimitive())) { |
| 1769 return NULL; |
| 1770 } |
| 1771 return this; |
| 1772 } |
| 1773 |
1751 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check_non_smi") | 1774 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check_non_smi") |
1752 | 1775 |
1753 protected: | 1776 protected: |
1754 virtual bool DataEquals(HValue* other) { return true; } | 1777 virtual bool DataEquals(HValue* other) { return true; } |
1755 }; | 1778 }; |
1756 | 1779 |
1757 | 1780 |
1758 class HCheckPrototypeMaps: public HTemplateInstruction<0> { | 1781 class HCheckPrototypeMaps: public HTemplateInstruction<0> { |
1759 public: | 1782 public: |
1760 HCheckPrototypeMaps(Handle<JSObject> prototype, Handle<JSObject> holder) | 1783 HCheckPrototypeMaps(Handle<JSObject> prototype, Handle<JSObject> holder) |
(...skipping 1640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3401 | 3424 |
3402 virtual void PrintDataTo(StringStream* stream); | 3425 virtual void PrintDataTo(StringStream* stream); |
3403 | 3426 |
3404 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store_keyed_generic") | 3427 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store_keyed_generic") |
3405 | 3428 |
3406 private: | 3429 private: |
3407 bool strict_mode_; | 3430 bool strict_mode_; |
3408 }; | 3431 }; |
3409 | 3432 |
3410 | 3433 |
| 3434 class HStringAdd: public HBinaryOperation { |
| 3435 public: |
| 3436 HStringAdd(HValue* left, HValue* right) : HBinaryOperation(left, right) { |
| 3437 set_representation(Representation::Tagged()); |
| 3438 SetFlag(kUseGVN); |
| 3439 SetFlag(kDependsOnMaps); |
| 3440 } |
| 3441 |
| 3442 virtual Representation RequiredInputRepresentation(int index) const { |
| 3443 return Representation::Tagged(); |
| 3444 } |
| 3445 |
| 3446 virtual HType CalculateInferredType() { |
| 3447 return HType::String(); |
| 3448 } |
| 3449 |
| 3450 DECLARE_CONCRETE_INSTRUCTION(StringAdd, "string_add") |
| 3451 |
| 3452 protected: |
| 3453 virtual bool DataEquals(HValue* other) { return true; } |
| 3454 }; |
| 3455 |
| 3456 |
3411 class HStringCharCodeAt: public HBinaryOperation { | 3457 class HStringCharCodeAt: public HBinaryOperation { |
3412 public: | 3458 public: |
3413 HStringCharCodeAt(HValue* string, HValue* index) | 3459 HStringCharCodeAt(HValue* string, HValue* index) |
3414 : HBinaryOperation(string, index) { | 3460 : HBinaryOperation(string, index) { |
3415 set_representation(Representation::Integer32()); | 3461 set_representation(Representation::Integer32()); |
3416 SetFlag(kUseGVN); | 3462 SetFlag(kUseGVN); |
3417 SetFlag(kDependsOnMaps); | 3463 SetFlag(kDependsOnMaps); |
3418 } | 3464 } |
3419 | 3465 |
3420 virtual Representation RequiredInputRepresentation(int index) const { | 3466 virtual Representation RequiredInputRepresentation(int index) const { |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3670 HValue* object() { return left(); } | 3716 HValue* object() { return left(); } |
3671 HValue* key() { return right(); } | 3717 HValue* key() { return right(); } |
3672 }; | 3718 }; |
3673 | 3719 |
3674 #undef DECLARE_INSTRUCTION | 3720 #undef DECLARE_INSTRUCTION |
3675 #undef DECLARE_CONCRETE_INSTRUCTION | 3721 #undef DECLARE_CONCRETE_INSTRUCTION |
3676 | 3722 |
3677 } } // namespace v8::internal | 3723 } } // namespace v8::internal |
3678 | 3724 |
3679 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 3725 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |