| OLD | NEW |
| 1 // Copyright 2012 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 |
| 11 // with the distribution. | 11 // with the distribution. |
| (...skipping 1902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1914 | 1914 |
| 1915 DECLARE_CONCRETE_INSTRUCTION(LoadExternalArrayPointer) | 1915 DECLARE_CONCRETE_INSTRUCTION(LoadExternalArrayPointer) |
| 1916 | 1916 |
| 1917 protected: | 1917 protected: |
| 1918 virtual bool DataEquals(HValue* other) { return true; } | 1918 virtual bool DataEquals(HValue* other) { return true; } |
| 1919 }; | 1919 }; |
| 1920 | 1920 |
| 1921 | 1921 |
| 1922 class HCheckMap: public HTemplateInstruction<2> { | 1922 class HCheckMap: public HTemplateInstruction<2> { |
| 1923 public: | 1923 public: |
| 1924 HCheckMap(HValue* value, Handle<Map> map, | 1924 HCheckMap(HValue* value, Handle<Map> map, HValue* typecheck = NULL) |
| 1925 HValue* typecheck = NULL, | 1925 : map_(map) { |
| 1926 CompareMapMode mode = REQUIRE_EXACT_MAP) | |
| 1927 : map_(map), | |
| 1928 mode_(mode) { | |
| 1929 SetOperandAt(0, value); | 1926 SetOperandAt(0, value); |
| 1930 // If callers don't depend on a typecheck, they can pass in NULL. In that | 1927 // If callers don't depend on a typecheck, they can pass in NULL. In that |
| 1931 // case we use a copy of the |value| argument as a dummy value. | 1928 // case we use a copy of the |value| argument as a dummy value. |
| 1932 SetOperandAt(1, typecheck != NULL ? typecheck : value); | 1929 SetOperandAt(1, typecheck != NULL ? typecheck : value); |
| 1933 set_representation(Representation::Tagged()); | 1930 set_representation(Representation::Tagged()); |
| 1934 SetFlag(kUseGVN); | 1931 SetFlag(kUseGVN); |
| 1935 SetFlag(kDependsOnMaps); | 1932 SetFlag(kDependsOnMaps); |
| 1936 } | 1933 } |
| 1937 | 1934 |
| 1938 virtual Representation RequiredInputRepresentation(int index) { | 1935 virtual Representation RequiredInputRepresentation(int index) { |
| 1939 return Representation::Tagged(); | 1936 return Representation::Tagged(); |
| 1940 } | 1937 } |
| 1941 virtual void PrintDataTo(StringStream* stream); | 1938 virtual void PrintDataTo(StringStream* stream); |
| 1942 virtual HType CalculateInferredType(); | 1939 virtual HType CalculateInferredType(); |
| 1943 | 1940 |
| 1944 HValue* value() { return OperandAt(0); } | 1941 HValue* value() { return OperandAt(0); } |
| 1945 Handle<Map> map() const { return map_; } | 1942 Handle<Map> map() const { return map_; } |
| 1946 CompareMapMode mode() const { return mode_; } | |
| 1947 | 1943 |
| 1948 DECLARE_CONCRETE_INSTRUCTION(CheckMap) | 1944 DECLARE_CONCRETE_INSTRUCTION(CheckMap) |
| 1949 | 1945 |
| 1950 protected: | 1946 protected: |
| 1951 virtual bool DataEquals(HValue* other) { | 1947 virtual bool DataEquals(HValue* other) { |
| 1952 HCheckMap* b = HCheckMap::cast(other); | 1948 HCheckMap* b = HCheckMap::cast(other); |
| 1953 // Two CheckMaps instructions are DataEqual if their maps are identical and | 1949 return map_.is_identical_to(b->map()); |
| 1954 // they have the same mode. If the map to check has FAST_ELEMENTS, then the | |
| 1955 // mode doesn't have to match: since there are no transitioned maps to | |
| 1956 // compare the generated code will be equivalent regardless of mode. | |
| 1957 return map_.is_identical_to(b->map()) && | |
| 1958 (b->mode() == mode() || map_->elements_kind() == FAST_ELEMENTS); | |
| 1959 } | 1950 } |
| 1960 | 1951 |
| 1961 private: | 1952 private: |
| 1962 Handle<Map> map_; | 1953 Handle<Map> map_; |
| 1963 CompareMapMode mode_; | |
| 1964 }; | 1954 }; |
| 1965 | 1955 |
| 1966 | 1956 |
| 1967 class HCheckFunction: public HUnaryOperation { | 1957 class HCheckFunction: public HUnaryOperation { |
| 1968 public: | 1958 public: |
| 1969 HCheckFunction(HValue* value, Handle<JSFunction> function) | 1959 HCheckFunction(HValue* value, Handle<JSFunction> function) |
| 1970 : HUnaryOperation(value), target_(function) { | 1960 : HUnaryOperation(value), target_(function) { |
| 1971 set_representation(Representation::Tagged()); | 1961 set_representation(Representation::Tagged()); |
| 1972 SetFlag(kUseGVN); | 1962 SetFlag(kUseGVN); |
| 1973 } | 1963 } |
| (...skipping 2522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4496 | 4486 |
| 4497 DECLARE_CONCRETE_INSTRUCTION(In) | 4487 DECLARE_CONCRETE_INSTRUCTION(In) |
| 4498 }; | 4488 }; |
| 4499 | 4489 |
| 4500 #undef DECLARE_INSTRUCTION | 4490 #undef DECLARE_INSTRUCTION |
| 4501 #undef DECLARE_CONCRETE_INSTRUCTION | 4491 #undef DECLARE_CONCRETE_INSTRUCTION |
| 4502 | 4492 |
| 4503 } } // namespace v8::internal | 4493 } } // namespace v8::internal |
| 4504 | 4494 |
| 4505 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 4495 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |