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 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
720 int position() const { return position_; } | 720 int position() const { return position_; } |
721 bool has_position() const { return position_ != RelocInfo::kNoPosition; } | 721 bool has_position() const { return position_ != RelocInfo::kNoPosition; } |
722 void set_position(int position) { position_ = position; } | 722 void set_position(int position) { position_ = position; } |
723 | 723 |
724 virtual LInstruction* CompileToLithium(LChunkBuilder* builder) = 0; | 724 virtual LInstruction* CompileToLithium(LChunkBuilder* builder) = 0; |
725 | 725 |
726 #ifdef DEBUG | 726 #ifdef DEBUG |
727 virtual void Verify(); | 727 virtual void Verify(); |
728 #endif | 728 #endif |
729 | 729 |
730 // Returns whether this is some kind of deoptimizing check | |
731 // instruction. | |
732 virtual bool IsCheckInstruction() const { return false; } | |
733 | |
734 virtual bool IsCall() { return false; } | 730 virtual bool IsCall() { return false; } |
735 | 731 |
736 DECLARE_ABSTRACT_INSTRUCTION(Instruction) | 732 DECLARE_ABSTRACT_INSTRUCTION(Instruction) |
737 | 733 |
738 protected: | 734 protected: |
739 HInstruction() | 735 HInstruction() |
740 : next_(NULL), | 736 : next_(NULL), |
741 previous_(NULL), | 737 previous_(NULL), |
742 position_(RelocInfo::kNoPosition) { | 738 position_(RelocInfo::kNoPosition) { |
743 SetFlag(kDependsOnOsrEntries); | 739 SetFlag(kDependsOnOsrEntries); |
(...skipping 1105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1849 | 1845 |
1850 class HCheckMap: public HUnaryOperation { | 1846 class HCheckMap: public HUnaryOperation { |
1851 public: | 1847 public: |
1852 HCheckMap(HValue* value, Handle<Map> map) | 1848 HCheckMap(HValue* value, Handle<Map> map) |
1853 : HUnaryOperation(value), map_(map) { | 1849 : HUnaryOperation(value), map_(map) { |
1854 set_representation(Representation::Tagged()); | 1850 set_representation(Representation::Tagged()); |
1855 SetFlag(kUseGVN); | 1851 SetFlag(kUseGVN); |
1856 SetFlag(kDependsOnMaps); | 1852 SetFlag(kDependsOnMaps); |
1857 } | 1853 } |
1858 | 1854 |
1859 virtual bool IsCheckInstruction() const { return true; } | |
1860 | |
1861 virtual Representation RequiredInputRepresentation(int index) const { | 1855 virtual Representation RequiredInputRepresentation(int index) const { |
1862 return Representation::Tagged(); | 1856 return Representation::Tagged(); |
1863 } | 1857 } |
1864 virtual void PrintDataTo(StringStream* stream); | 1858 virtual void PrintDataTo(StringStream* stream); |
1865 virtual HType CalculateInferredType(); | 1859 virtual HType CalculateInferredType(); |
1866 | 1860 |
1867 #ifdef DEBUG | 1861 #ifdef DEBUG |
1868 virtual void Verify(); | 1862 virtual void Verify(); |
1869 #endif | 1863 #endif |
1870 | 1864 |
(...skipping 13 matching lines...) Expand all Loading... |
1884 | 1878 |
1885 | 1879 |
1886 class HCheckFunction: public HUnaryOperation { | 1880 class HCheckFunction: public HUnaryOperation { |
1887 public: | 1881 public: |
1888 HCheckFunction(HValue* value, Handle<JSFunction> function) | 1882 HCheckFunction(HValue* value, Handle<JSFunction> function) |
1889 : HUnaryOperation(value), target_(function) { | 1883 : HUnaryOperation(value), target_(function) { |
1890 set_representation(Representation::Tagged()); | 1884 set_representation(Representation::Tagged()); |
1891 SetFlag(kUseGVN); | 1885 SetFlag(kUseGVN); |
1892 } | 1886 } |
1893 | 1887 |
1894 virtual bool IsCheckInstruction() const { return true; } | |
1895 | |
1896 virtual Representation RequiredInputRepresentation(int index) const { | 1888 virtual Representation RequiredInputRepresentation(int index) const { |
1897 return Representation::Tagged(); | 1889 return Representation::Tagged(); |
1898 } | 1890 } |
1899 virtual void PrintDataTo(StringStream* stream); | 1891 virtual void PrintDataTo(StringStream* stream); |
1900 virtual HType CalculateInferredType(); | 1892 virtual HType CalculateInferredType(); |
1901 | 1893 |
1902 #ifdef DEBUG | 1894 #ifdef DEBUG |
1903 virtual void Verify(); | 1895 virtual void Verify(); |
1904 #endif | 1896 #endif |
1905 | 1897 |
(...skipping 20 matching lines...) Expand all Loading... |
1926 static HCheckInstanceType* NewIsJSArray(HValue* value) { | 1918 static HCheckInstanceType* NewIsJSArray(HValue* value) { |
1927 return new HCheckInstanceType(value, IS_JS_ARRAY); | 1919 return new HCheckInstanceType(value, IS_JS_ARRAY); |
1928 } | 1920 } |
1929 static HCheckInstanceType* NewIsString(HValue* value) { | 1921 static HCheckInstanceType* NewIsString(HValue* value) { |
1930 return new HCheckInstanceType(value, IS_STRING); | 1922 return new HCheckInstanceType(value, IS_STRING); |
1931 } | 1923 } |
1932 static HCheckInstanceType* NewIsSymbol(HValue* value) { | 1924 static HCheckInstanceType* NewIsSymbol(HValue* value) { |
1933 return new HCheckInstanceType(value, IS_SYMBOL); | 1925 return new HCheckInstanceType(value, IS_SYMBOL); |
1934 } | 1926 } |
1935 | 1927 |
1936 virtual bool IsCheckInstruction() const { return true; } | |
1937 | |
1938 virtual Representation RequiredInputRepresentation(int index) const { | 1928 virtual Representation RequiredInputRepresentation(int index) const { |
1939 return Representation::Tagged(); | 1929 return Representation::Tagged(); |
1940 } | 1930 } |
1941 | 1931 |
1942 #ifdef DEBUG | 1932 #ifdef DEBUG |
1943 virtual void Verify(); | 1933 virtual void Verify(); |
1944 #endif | 1934 #endif |
1945 | 1935 |
1946 virtual HValue* Canonicalize() { | 1936 virtual HValue* Canonicalize() { |
1947 if (!value()->type().IsUninitialized() && | 1937 if (!value()->type().IsUninitialized() && |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1986 }; | 1976 }; |
1987 | 1977 |
1988 | 1978 |
1989 class HCheckNonSmi: public HUnaryOperation { | 1979 class HCheckNonSmi: public HUnaryOperation { |
1990 public: | 1980 public: |
1991 explicit HCheckNonSmi(HValue* value) : HUnaryOperation(value) { | 1981 explicit HCheckNonSmi(HValue* value) : HUnaryOperation(value) { |
1992 set_representation(Representation::Tagged()); | 1982 set_representation(Representation::Tagged()); |
1993 SetFlag(kUseGVN); | 1983 SetFlag(kUseGVN); |
1994 } | 1984 } |
1995 | 1985 |
1996 virtual bool IsCheckInstruction() const { return true; } | |
1997 | |
1998 virtual Representation RequiredInputRepresentation(int index) const { | 1986 virtual Representation RequiredInputRepresentation(int index) const { |
1999 return Representation::Tagged(); | 1987 return Representation::Tagged(); |
2000 } | 1988 } |
2001 | 1989 |
2002 virtual HType CalculateInferredType(); | 1990 virtual HType CalculateInferredType(); |
2003 | 1991 |
2004 #ifdef DEBUG | 1992 #ifdef DEBUG |
2005 virtual void Verify(); | 1993 virtual void Verify(); |
2006 #endif | 1994 #endif |
2007 | 1995 |
(...skipping 17 matching lines...) Expand all Loading... |
2025 | 2013 |
2026 | 2014 |
2027 class HCheckPrototypeMaps: public HTemplateInstruction<0> { | 2015 class HCheckPrototypeMaps: public HTemplateInstruction<0> { |
2028 public: | 2016 public: |
2029 HCheckPrototypeMaps(Handle<JSObject> prototype, Handle<JSObject> holder) | 2017 HCheckPrototypeMaps(Handle<JSObject> prototype, Handle<JSObject> holder) |
2030 : prototype_(prototype), holder_(holder) { | 2018 : prototype_(prototype), holder_(holder) { |
2031 SetFlag(kUseGVN); | 2019 SetFlag(kUseGVN); |
2032 SetFlag(kDependsOnMaps); | 2020 SetFlag(kDependsOnMaps); |
2033 } | 2021 } |
2034 | 2022 |
2035 virtual bool IsCheckInstruction() const { return true; } | |
2036 | |
2037 #ifdef DEBUG | 2023 #ifdef DEBUG |
2038 virtual void Verify(); | 2024 virtual void Verify(); |
2039 #endif | 2025 #endif |
2040 | 2026 |
2041 Handle<JSObject> prototype() const { return prototype_; } | 2027 Handle<JSObject> prototype() const { return prototype_; } |
2042 Handle<JSObject> holder() const { return holder_; } | 2028 Handle<JSObject> holder() const { return holder_; } |
2043 | 2029 |
2044 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps) | 2030 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps) |
2045 | 2031 |
2046 virtual Representation RequiredInputRepresentation(int index) const { | 2032 virtual Representation RequiredInputRepresentation(int index) const { |
(...skipping 20 matching lines...) Expand all Loading... |
2067 }; | 2053 }; |
2068 | 2054 |
2069 | 2055 |
2070 class HCheckSmi: public HUnaryOperation { | 2056 class HCheckSmi: public HUnaryOperation { |
2071 public: | 2057 public: |
2072 explicit HCheckSmi(HValue* value) : HUnaryOperation(value) { | 2058 explicit HCheckSmi(HValue* value) : HUnaryOperation(value) { |
2073 set_representation(Representation::Tagged()); | 2059 set_representation(Representation::Tagged()); |
2074 SetFlag(kUseGVN); | 2060 SetFlag(kUseGVN); |
2075 } | 2061 } |
2076 | 2062 |
2077 virtual bool IsCheckInstruction() const { return true; } | |
2078 | |
2079 virtual Representation RequiredInputRepresentation(int index) const { | 2063 virtual Representation RequiredInputRepresentation(int index) const { |
2080 return Representation::Tagged(); | 2064 return Representation::Tagged(); |
2081 } | 2065 } |
2082 virtual HType CalculateInferredType(); | 2066 virtual HType CalculateInferredType(); |
2083 | 2067 |
2084 #ifdef DEBUG | 2068 #ifdef DEBUG |
2085 virtual void Verify(); | 2069 virtual void Verify(); |
2086 #endif | 2070 #endif |
2087 | 2071 |
2088 DECLARE_CONCRETE_INSTRUCTION(CheckSmi) | 2072 DECLARE_CONCRETE_INSTRUCTION(CheckSmi) |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2415 }; | 2399 }; |
2416 | 2400 |
2417 | 2401 |
2418 class HBoundsCheck: public HBinaryOperation { | 2402 class HBoundsCheck: public HBinaryOperation { |
2419 public: | 2403 public: |
2420 HBoundsCheck(HValue* index, HValue* length) | 2404 HBoundsCheck(HValue* index, HValue* length) |
2421 : HBinaryOperation(index, length) { | 2405 : HBinaryOperation(index, length) { |
2422 SetFlag(kUseGVN); | 2406 SetFlag(kUseGVN); |
2423 } | 2407 } |
2424 | 2408 |
2425 virtual bool IsCheckInstruction() const { return true; } | |
2426 | |
2427 virtual Representation RequiredInputRepresentation(int index) const { | 2409 virtual Representation RequiredInputRepresentation(int index) const { |
2428 return Representation::Integer32(); | 2410 return Representation::Integer32(); |
2429 } | 2411 } |
2430 | 2412 |
2431 #ifdef DEBUG | 2413 #ifdef DEBUG |
2432 virtual void Verify(); | 2414 virtual void Verify(); |
2433 #endif | 2415 #endif |
2434 | 2416 |
2435 HValue* index() { return left(); } | 2417 HValue* index() { return left(); } |
2436 HValue* length() { return right(); } | 2418 HValue* length() { return right(); } |
(...skipping 1610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4047 | 4029 |
4048 DECLARE_CONCRETE_INSTRUCTION(In) | 4030 DECLARE_CONCRETE_INSTRUCTION(In) |
4049 }; | 4031 }; |
4050 | 4032 |
4051 #undef DECLARE_INSTRUCTION | 4033 #undef DECLARE_INSTRUCTION |
4052 #undef DECLARE_CONCRETE_INSTRUCTION | 4034 #undef DECLARE_CONCRETE_INSTRUCTION |
4053 | 4035 |
4054 } } // namespace v8::internal | 4036 } } // namespace v8::internal |
4055 | 4037 |
4056 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 4038 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |