OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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, HValue* typecheck = NULL) | 1924 HCheckMap(HValue* value, Handle<Map> map, |
1925 : map_(map) { | 1925 HValue* typecheck = NULL, |
| 1926 CompareMapMode mode = REQUIRE_EXACT_MAP) |
| 1927 : map_(map), |
| 1928 mode_(mode) { |
1926 SetOperandAt(0, value); | 1929 SetOperandAt(0, value); |
1927 // If callers don't depend on a typecheck, they can pass in NULL. In that | 1930 // If callers don't depend on a typecheck, they can pass in NULL. In that |
1928 // case we use a copy of the |value| argument as a dummy value. | 1931 // case we use a copy of the |value| argument as a dummy value. |
1929 SetOperandAt(1, typecheck != NULL ? typecheck : value); | 1932 SetOperandAt(1, typecheck != NULL ? typecheck : value); |
1930 set_representation(Representation::Tagged()); | 1933 set_representation(Representation::Tagged()); |
1931 SetFlag(kUseGVN); | 1934 SetFlag(kUseGVN); |
1932 SetFlag(kDependsOnMaps); | 1935 SetFlag(kDependsOnMaps); |
| 1936 has_element_transitions_ = |
| 1937 map->LookupElementsTransitionMap(FAST_DOUBLE_ELEMENTS, NULL) != NULL || |
| 1938 map->LookupElementsTransitionMap(FAST_ELEMENTS, NULL) != NULL; |
1933 } | 1939 } |
1934 | 1940 |
1935 virtual Representation RequiredInputRepresentation(int index) { | 1941 virtual Representation RequiredInputRepresentation(int index) { |
1936 return Representation::Tagged(); | 1942 return Representation::Tagged(); |
1937 } | 1943 } |
1938 virtual void PrintDataTo(StringStream* stream); | 1944 virtual void PrintDataTo(StringStream* stream); |
1939 virtual HType CalculateInferredType(); | 1945 virtual HType CalculateInferredType(); |
1940 | 1946 |
1941 HValue* value() { return OperandAt(0); } | 1947 HValue* value() { return OperandAt(0); } |
1942 Handle<Map> map() const { return map_; } | 1948 Handle<Map> map() const { return map_; } |
| 1949 CompareMapMode mode() const { return mode_; } |
1943 | 1950 |
1944 DECLARE_CONCRETE_INSTRUCTION(CheckMap) | 1951 DECLARE_CONCRETE_INSTRUCTION(CheckMap) |
1945 | 1952 |
1946 protected: | 1953 protected: |
1947 virtual bool DataEquals(HValue* other) { | 1954 virtual bool DataEquals(HValue* other) { |
1948 HCheckMap* b = HCheckMap::cast(other); | 1955 HCheckMap* b = HCheckMap::cast(other); |
1949 return map_.is_identical_to(b->map()); | 1956 // Two CheckMaps instructions are DataEqual if their maps are identical and |
| 1957 // they have the same mode. The mode comparison can be ignored if the map |
| 1958 // has no elements transitions. |
| 1959 return map_.is_identical_to(b->map()) && |
| 1960 (b->mode() == mode() || !has_element_transitions_); |
1950 } | 1961 } |
1951 | 1962 |
1952 private: | 1963 private: |
| 1964 bool has_element_transitions_; |
1953 Handle<Map> map_; | 1965 Handle<Map> map_; |
| 1966 CompareMapMode mode_; |
1954 }; | 1967 }; |
1955 | 1968 |
1956 | 1969 |
1957 class HCheckFunction: public HUnaryOperation { | 1970 class HCheckFunction: public HUnaryOperation { |
1958 public: | 1971 public: |
1959 HCheckFunction(HValue* value, Handle<JSFunction> function) | 1972 HCheckFunction(HValue* value, Handle<JSFunction> function) |
1960 : HUnaryOperation(value), target_(function) { | 1973 : HUnaryOperation(value), target_(function) { |
1961 set_representation(Representation::Tagged()); | 1974 set_representation(Representation::Tagged()); |
1962 SetFlag(kUseGVN); | 1975 SetFlag(kUseGVN); |
1963 } | 1976 } |
(...skipping 2522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4486 | 4499 |
4487 DECLARE_CONCRETE_INSTRUCTION(In) | 4500 DECLARE_CONCRETE_INSTRUCTION(In) |
4488 }; | 4501 }; |
4489 | 4502 |
4490 #undef DECLARE_INSTRUCTION | 4503 #undef DECLARE_INSTRUCTION |
4491 #undef DECLARE_CONCRETE_INSTRUCTION | 4504 #undef DECLARE_CONCRETE_INSTRUCTION |
4492 | 4505 |
4493 } } // namespace v8::internal | 4506 } } // namespace v8::internal |
4494 | 4507 |
4495 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 4508 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |