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 1643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1654 } | 1654 } |
1655 | 1655 |
1656 DECLARE_CONCRETE_INSTRUCTION(CallRuntime) | 1656 DECLARE_CONCRETE_INSTRUCTION(CallRuntime) |
1657 | 1657 |
1658 private: | 1658 private: |
1659 const Runtime::Function* c_function_; | 1659 const Runtime::Function* c_function_; |
1660 Handle<String> name_; | 1660 Handle<String> name_; |
1661 }; | 1661 }; |
1662 | 1662 |
1663 | 1663 |
1664 class HJSArrayLength: public HUnaryOperation { | 1664 class HJSArrayLength: public HTemplateInstruction<2> { |
1665 public: | 1665 public: |
1666 explicit HJSArrayLength(HValue* value) : HUnaryOperation(value) { | 1666 HJSArrayLength(HValue* value, HValue* typecheck) { |
1667 // The length of an array is stored as a tagged value in the array | 1667 // The length of an array is stored as a tagged value in the array |
1668 // object. It is guaranteed to be 32 bit integer, but it can be | 1668 // object. It is guaranteed to be 32 bit integer, but it can be |
1669 // represented as either a smi or heap number. | 1669 // represented as either a smi or heap number. |
| 1670 SetOperandAt(0, value); |
| 1671 SetOperandAt(1, typecheck); |
1670 set_representation(Representation::Tagged()); | 1672 set_representation(Representation::Tagged()); |
1671 SetFlag(kUseGVN); | 1673 SetFlag(kUseGVN); |
1672 SetFlag(kDependsOnArrayLengths); | 1674 SetFlag(kDependsOnArrayLengths); |
1673 SetFlag(kDependsOnMaps); | 1675 SetFlag(kDependsOnMaps); |
1674 } | 1676 } |
1675 | 1677 |
1676 virtual Representation RequiredInputRepresentation(int index) const { | 1678 virtual Representation RequiredInputRepresentation(int index) const { |
1677 return Representation::Tagged(); | 1679 return Representation::Tagged(); |
1678 } | 1680 } |
1679 | 1681 |
| 1682 HValue* value() { return OperandAt(0); } |
| 1683 |
1680 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength) | 1684 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength) |
1681 | 1685 |
1682 protected: | 1686 protected: |
1683 virtual bool DataEquals(HValue* other) { return true; } | 1687 virtual bool DataEquals(HValue* other) { return true; } |
1684 }; | 1688 }; |
1685 | 1689 |
1686 | 1690 |
1687 class HFixedArrayLength: public HUnaryOperation { | 1691 class HFixedArrayLength: public HUnaryOperation { |
1688 public: | 1692 public: |
1689 explicit HFixedArrayLength(HValue* value) : HUnaryOperation(value) { | 1693 explicit HFixedArrayLength(HValue* value) : HUnaryOperation(value) { |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1900 SetFlag(kUseGVN); | 1904 SetFlag(kUseGVN); |
1901 SetFlag(kDependsOnMaps); | 1905 SetFlag(kDependsOnMaps); |
1902 } | 1906 } |
1903 | 1907 |
1904 virtual Representation RequiredInputRepresentation(int index) const { | 1908 virtual Representation RequiredInputRepresentation(int index) const { |
1905 return Representation::Tagged(); | 1909 return Representation::Tagged(); |
1906 } | 1910 } |
1907 virtual void PrintDataTo(StringStream* stream); | 1911 virtual void PrintDataTo(StringStream* stream); |
1908 virtual HType CalculateInferredType(); | 1912 virtual HType CalculateInferredType(); |
1909 | 1913 |
1910 #ifdef DEBUG | |
1911 virtual void Verify(); | |
1912 #endif | |
1913 | |
1914 Handle<Map> map() const { return map_; } | 1914 Handle<Map> map() const { return map_; } |
1915 | 1915 |
1916 DECLARE_CONCRETE_INSTRUCTION(CheckMap) | 1916 DECLARE_CONCRETE_INSTRUCTION(CheckMap) |
1917 | 1917 |
1918 protected: | 1918 protected: |
1919 virtual bool DataEquals(HValue* other) { | 1919 virtual bool DataEquals(HValue* other) { |
1920 HCheckMap* b = HCheckMap::cast(other); | 1920 HCheckMap* b = HCheckMap::cast(other); |
1921 return map_.is_identical_to(b->map()); | 1921 return map_.is_identical_to(b->map()); |
1922 } | 1922 } |
1923 | 1923 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1971 return new HCheckInstanceType(value, IS_STRING); | 1971 return new HCheckInstanceType(value, IS_STRING); |
1972 } | 1972 } |
1973 static HCheckInstanceType* NewIsSymbol(HValue* value) { | 1973 static HCheckInstanceType* NewIsSymbol(HValue* value) { |
1974 return new HCheckInstanceType(value, IS_SYMBOL); | 1974 return new HCheckInstanceType(value, IS_SYMBOL); |
1975 } | 1975 } |
1976 | 1976 |
1977 virtual Representation RequiredInputRepresentation(int index) const { | 1977 virtual Representation RequiredInputRepresentation(int index) const { |
1978 return Representation::Tagged(); | 1978 return Representation::Tagged(); |
1979 } | 1979 } |
1980 | 1980 |
1981 #ifdef DEBUG | |
1982 virtual void Verify(); | |
1983 #endif | |
1984 | |
1985 virtual HValue* Canonicalize(); | 1981 virtual HValue* Canonicalize(); |
1986 | 1982 |
1987 bool is_interval_check() const { return check_ <= LAST_INTERVAL_CHECK; } | 1983 bool is_interval_check() const { return check_ <= LAST_INTERVAL_CHECK; } |
1988 void GetCheckInterval(InstanceType* first, InstanceType* last); | 1984 void GetCheckInterval(InstanceType* first, InstanceType* last); |
1989 void GetCheckMaskAndTag(uint8_t* mask, uint8_t* tag); | 1985 void GetCheckMaskAndTag(uint8_t* mask, uint8_t* tag); |
1990 | 1986 |
1991 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType) | 1987 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType) |
1992 | 1988 |
1993 protected: | 1989 protected: |
1994 // TODO(ager): It could be nice to allow the ommision of instance | 1990 // TODO(ager): It could be nice to allow the ommision of instance |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2449 SetOperandAt(0, index); | 2445 SetOperandAt(0, index); |
2450 SetOperandAt(1, length); | 2446 SetOperandAt(1, length); |
2451 set_representation(Representation::Integer32()); | 2447 set_representation(Representation::Integer32()); |
2452 SetFlag(kUseGVN); | 2448 SetFlag(kUseGVN); |
2453 } | 2449 } |
2454 | 2450 |
2455 virtual Representation RequiredInputRepresentation(int index) const { | 2451 virtual Representation RequiredInputRepresentation(int index) const { |
2456 return Representation::Integer32(); | 2452 return Representation::Integer32(); |
2457 } | 2453 } |
2458 | 2454 |
2459 #ifdef DEBUG | |
2460 virtual void Verify(); | |
2461 #endif | |
2462 | |
2463 HValue* index() { return OperandAt(0); } | 2455 HValue* index() { return OperandAt(0); } |
2464 HValue* length() { return OperandAt(1); } | 2456 HValue* length() { return OperandAt(1); } |
2465 | 2457 |
2466 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck) | 2458 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck) |
2467 | 2459 |
2468 protected: | 2460 protected: |
2469 virtual bool DataEquals(HValue* other) { return true; } | 2461 virtual bool DataEquals(HValue* other) { return true; } |
2470 }; | 2462 }; |
2471 | 2463 |
2472 | 2464 |
(...skipping 1652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4125 | 4117 |
4126 DECLARE_CONCRETE_INSTRUCTION(In) | 4118 DECLARE_CONCRETE_INSTRUCTION(In) |
4127 }; | 4119 }; |
4128 | 4120 |
4129 #undef DECLARE_INSTRUCTION | 4121 #undef DECLARE_INSTRUCTION |
4130 #undef DECLARE_CONCRETE_INSTRUCTION | 4122 #undef DECLARE_CONCRETE_INSTRUCTION |
4131 | 4123 |
4132 } } // namespace v8::internal | 4124 } } // namespace v8::internal |
4133 | 4125 |
4134 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 4126 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |