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 MapCheckMode 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); |
1933 } | 1936 } |
1934 | 1937 |
1935 virtual Representation RequiredInputRepresentation(int index) { | 1938 virtual Representation RequiredInputRepresentation(int index) { |
1936 return Representation::Tagged(); | 1939 return Representation::Tagged(); |
1937 } | 1940 } |
1938 virtual void PrintDataTo(StringStream* stream); | 1941 virtual void PrintDataTo(StringStream* stream); |
1939 virtual HType CalculateInferredType(); | 1942 virtual HType CalculateInferredType(); |
1940 | 1943 |
1941 HValue* value() { return OperandAt(0); } | 1944 HValue* value() { return OperandAt(0); } |
1942 Handle<Map> map() const { return map_; } | 1945 Handle<Map> map() const { return map_; } |
| 1946 MapCheckMode mode() const { return mode_; } |
1943 | 1947 |
1944 DECLARE_CONCRETE_INSTRUCTION(CheckMap) | 1948 DECLARE_CONCRETE_INSTRUCTION(CheckMap) |
1945 | 1949 |
1946 protected: | 1950 protected: |
1947 virtual bool DataEquals(HValue* other) { | 1951 virtual bool DataEquals(HValue* other) { |
1948 HCheckMap* b = HCheckMap::cast(other); | 1952 HCheckMap* b = HCheckMap::cast(other); |
1949 return map_.is_identical_to(b->map()); | 1953 // CheckMaps are equal if their map is identical and they have the same |
| 1954 // mode. If the map has FAST_ELEMENTS, then the mode doesn't have to match, |
| 1955 // since there are no transitioned maps to compare, so the generated code |
| 1956 // will be equivalent regardless of mode. |
| 1957 return map_.is_identical_to(b->map()) && |
| 1958 (b->mode() == mode() || map_->elements_kind() == FAST_ELEMENTS); |
1950 } | 1959 } |
1951 | 1960 |
1952 private: | 1961 private: |
1953 Handle<Map> map_; | 1962 Handle<Map> map_; |
| 1963 MapCheckMode mode_; |
1954 }; | 1964 }; |
1955 | 1965 |
1956 | 1966 |
1957 class HCheckFunction: public HUnaryOperation { | 1967 class HCheckFunction: public HUnaryOperation { |
1958 public: | 1968 public: |
1959 HCheckFunction(HValue* value, Handle<JSFunction> function) | 1969 HCheckFunction(HValue* value, Handle<JSFunction> function) |
1960 : HUnaryOperation(value), target_(function) { | 1970 : HUnaryOperation(value), target_(function) { |
1961 set_representation(Representation::Tagged()); | 1971 set_representation(Representation::Tagged()); |
1962 SetFlag(kUseGVN); | 1972 SetFlag(kUseGVN); |
1963 } | 1973 } |
(...skipping 2522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4486 | 4496 |
4487 DECLARE_CONCRETE_INSTRUCTION(In) | 4497 DECLARE_CONCRETE_INSTRUCTION(In) |
4488 }; | 4498 }; |
4489 | 4499 |
4490 #undef DECLARE_INSTRUCTION | 4500 #undef DECLARE_INSTRUCTION |
4491 #undef DECLARE_CONCRETE_INSTRUCTION | 4501 #undef DECLARE_CONCRETE_INSTRUCTION |
4492 | 4502 |
4493 } } // namespace v8::internal | 4503 } } // namespace v8::internal |
4494 | 4504 |
4495 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 4505 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |