| 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 V(LoadNamedGeneric) \ | 139 V(LoadNamedGeneric) \ |
| 140 V(Mod) \ | 140 V(Mod) \ |
| 141 V(Mul) \ | 141 V(Mul) \ |
| 142 V(ObjectLiteralFast) \ | 142 V(ObjectLiteralFast) \ |
| 143 V(ObjectLiteralGeneric) \ | 143 V(ObjectLiteralGeneric) \ |
| 144 V(OsrEntry) \ | 144 V(OsrEntry) \ |
| 145 V(OuterContext) \ | 145 V(OuterContext) \ |
| 146 V(Parameter) \ | 146 V(Parameter) \ |
| 147 V(Power) \ | 147 V(Power) \ |
| 148 V(PushArgument) \ | 148 V(PushArgument) \ |
| 149 V(Random) \ |
| 149 V(RegExpLiteral) \ | 150 V(RegExpLiteral) \ |
| 150 V(Return) \ | 151 V(Return) \ |
| 151 V(Sar) \ | 152 V(Sar) \ |
| 152 V(Shl) \ | 153 V(Shl) \ |
| 153 V(Shr) \ | 154 V(Shr) \ |
| 154 V(Simulate) \ | 155 V(Simulate) \ |
| 155 V(SoftDeoptimize) \ | 156 V(SoftDeoptimize) \ |
| 156 V(StackCheck) \ | 157 V(StackCheck) \ |
| 157 V(StoreContextSlot) \ | 158 V(StoreContextSlot) \ |
| 158 V(StoreGlobalCell) \ | 159 V(StoreGlobalCell) \ |
| (...skipping 964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1123 ASSERT(!value->representation().Equals(to)); | 1124 ASSERT(!value->representation().Equals(to)); |
| 1124 set_representation(to); | 1125 set_representation(to); |
| 1125 set_type(HType::TaggedNumber()); | 1126 set_type(HType::TaggedNumber()); |
| 1126 SetFlag(kUseGVN); | 1127 SetFlag(kUseGVN); |
| 1127 if (deoptimize_on_undefined) SetFlag(kDeoptimizeOnUndefined); | 1128 if (deoptimize_on_undefined) SetFlag(kDeoptimizeOnUndefined); |
| 1128 if (is_truncating) SetFlag(kTruncatingToInt32); | 1129 if (is_truncating) SetFlag(kTruncatingToInt32); |
| 1129 } | 1130 } |
| 1130 | 1131 |
| 1131 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); | 1132 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
| 1132 virtual HType CalculateInferredType(); | 1133 virtual HType CalculateInferredType(); |
| 1134 virtual HValue* Canonicalize(); |
| 1133 | 1135 |
| 1134 Representation from() { return value()->representation(); } | 1136 Representation from() { return value()->representation(); } |
| 1135 Representation to() { return representation(); } | 1137 Representation to() { return representation(); } |
| 1136 bool deoptimize_on_undefined() const { | 1138 bool deoptimize_on_undefined() const { |
| 1137 return CheckFlag(kDeoptimizeOnUndefined); | 1139 return CheckFlag(kDeoptimizeOnUndefined); |
| 1138 } | 1140 } |
| 1141 bool deoptimize_on_minus_zero() const { |
| 1142 return CheckFlag(kBailoutOnMinusZero); |
| 1143 } |
| 1139 virtual Representation RequiredInputRepresentation(int index) { | 1144 virtual Representation RequiredInputRepresentation(int index) { |
| 1140 return from(); | 1145 return from(); |
| 1141 } | 1146 } |
| 1142 | 1147 |
| 1143 virtual Range* InferRange(); | 1148 virtual Range* InferRange(); |
| 1144 | 1149 |
| 1145 virtual void PrintDataTo(StringStream* stream); | 1150 virtual void PrintDataTo(StringStream* stream); |
| 1146 | 1151 |
| 1147 DECLARE_CONCRETE_INSTRUCTION(Change) | 1152 DECLARE_CONCRETE_INSTRUCTION(Change) |
| 1148 | 1153 |
| (...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1914 | 1919 |
| 1915 DECLARE_CONCRETE_INSTRUCTION(LoadExternalArrayPointer) | 1920 DECLARE_CONCRETE_INSTRUCTION(LoadExternalArrayPointer) |
| 1916 | 1921 |
| 1917 protected: | 1922 protected: |
| 1918 virtual bool DataEquals(HValue* other) { return true; } | 1923 virtual bool DataEquals(HValue* other) { return true; } |
| 1919 }; | 1924 }; |
| 1920 | 1925 |
| 1921 | 1926 |
| 1922 class HCheckMap: public HTemplateInstruction<2> { | 1927 class HCheckMap: public HTemplateInstruction<2> { |
| 1923 public: | 1928 public: |
| 1924 HCheckMap(HValue* value, Handle<Map> map, HValue* typecheck = NULL) | 1929 HCheckMap(HValue* value, Handle<Map> map, |
| 1925 : map_(map) { | 1930 HValue* typecheck = NULL, |
| 1931 CompareMapMode mode = REQUIRE_EXACT_MAP) |
| 1932 : map_(map), |
| 1933 mode_(mode) { |
| 1926 SetOperandAt(0, value); | 1934 SetOperandAt(0, value); |
| 1927 // If callers don't depend on a typecheck, they can pass in NULL. In that | 1935 // 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. | 1936 // case we use a copy of the |value| argument as a dummy value. |
| 1929 SetOperandAt(1, typecheck != NULL ? typecheck : value); | 1937 SetOperandAt(1, typecheck != NULL ? typecheck : value); |
| 1930 set_representation(Representation::Tagged()); | 1938 set_representation(Representation::Tagged()); |
| 1931 SetFlag(kUseGVN); | 1939 SetFlag(kUseGVN); |
| 1932 SetFlag(kDependsOnMaps); | 1940 SetFlag(kDependsOnMaps); |
| 1941 has_element_transitions_ = |
| 1942 map->LookupElementsTransitionMap(FAST_DOUBLE_ELEMENTS, NULL) != NULL || |
| 1943 map->LookupElementsTransitionMap(FAST_ELEMENTS, NULL) != NULL; |
| 1933 } | 1944 } |
| 1934 | 1945 |
| 1935 virtual Representation RequiredInputRepresentation(int index) { | 1946 virtual Representation RequiredInputRepresentation(int index) { |
| 1936 return Representation::Tagged(); | 1947 return Representation::Tagged(); |
| 1937 } | 1948 } |
| 1938 virtual void PrintDataTo(StringStream* stream); | 1949 virtual void PrintDataTo(StringStream* stream); |
| 1939 virtual HType CalculateInferredType(); | 1950 virtual HType CalculateInferredType(); |
| 1940 | 1951 |
| 1941 HValue* value() { return OperandAt(0); } | 1952 HValue* value() { return OperandAt(0); } |
| 1942 Handle<Map> map() const { return map_; } | 1953 Handle<Map> map() const { return map_; } |
| 1954 CompareMapMode mode() const { return mode_; } |
| 1943 | 1955 |
| 1944 DECLARE_CONCRETE_INSTRUCTION(CheckMap) | 1956 DECLARE_CONCRETE_INSTRUCTION(CheckMap) |
| 1945 | 1957 |
| 1946 protected: | 1958 protected: |
| 1947 virtual bool DataEquals(HValue* other) { | 1959 virtual bool DataEquals(HValue* other) { |
| 1948 HCheckMap* b = HCheckMap::cast(other); | 1960 HCheckMap* b = HCheckMap::cast(other); |
| 1949 return map_.is_identical_to(b->map()); | 1961 // Two CheckMaps instructions are DataEqual if their maps are identical and |
| 1962 // they have the same mode. The mode comparison can be ignored if the map |
| 1963 // has no elements transitions. |
| 1964 return map_.is_identical_to(b->map()) && |
| 1965 (b->mode() == mode() || !has_element_transitions_); |
| 1950 } | 1966 } |
| 1951 | 1967 |
| 1952 private: | 1968 private: |
| 1969 bool has_element_transitions_; |
| 1953 Handle<Map> map_; | 1970 Handle<Map> map_; |
| 1971 CompareMapMode mode_; |
| 1954 }; | 1972 }; |
| 1955 | 1973 |
| 1956 | 1974 |
| 1957 class HCheckFunction: public HUnaryOperation { | 1975 class HCheckFunction: public HUnaryOperation { |
| 1958 public: | 1976 public: |
| 1959 HCheckFunction(HValue* value, Handle<JSFunction> function) | 1977 HCheckFunction(HValue* value, Handle<JSFunction> function) |
| 1960 : HUnaryOperation(value), target_(function) { | 1978 : HUnaryOperation(value), target_(function) { |
| 1961 set_representation(Representation::Tagged()); | 1979 set_representation(Representation::Tagged()); |
| 1962 SetFlag(kUseGVN); | 1980 SetFlag(kUseGVN); |
| 1963 } | 1981 } |
| (...skipping 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2978 : Representation::None(); | 2996 : Representation::None(); |
| 2979 } | 2997 } |
| 2980 | 2998 |
| 2981 DECLARE_CONCRETE_INSTRUCTION(Power) | 2999 DECLARE_CONCRETE_INSTRUCTION(Power) |
| 2982 | 3000 |
| 2983 protected: | 3001 protected: |
| 2984 virtual bool DataEquals(HValue* other) { return true; } | 3002 virtual bool DataEquals(HValue* other) { return true; } |
| 2985 }; | 3003 }; |
| 2986 | 3004 |
| 2987 | 3005 |
| 3006 class HRandom: public HTemplateInstruction<1> { |
| 3007 public: |
| 3008 explicit HRandom(HValue* global_object) { |
| 3009 SetOperandAt(0, global_object); |
| 3010 set_representation(Representation::Double()); |
| 3011 } |
| 3012 |
| 3013 HValue* global_object() { return OperandAt(0); } |
| 3014 |
| 3015 virtual Representation RequiredInputRepresentation(int index) { |
| 3016 return Representation::Tagged(); |
| 3017 } |
| 3018 |
| 3019 DECLARE_CONCRETE_INSTRUCTION(Random) |
| 3020 }; |
| 3021 |
| 3022 |
| 2988 class HAdd: public HArithmeticBinaryOperation { | 3023 class HAdd: public HArithmeticBinaryOperation { |
| 2989 public: | 3024 public: |
| 2990 HAdd(HValue* context, HValue* left, HValue* right) | 3025 HAdd(HValue* context, HValue* left, HValue* right) |
| 2991 : HArithmeticBinaryOperation(context, left, right) { | 3026 : HArithmeticBinaryOperation(context, left, right) { |
| 2992 SetFlag(kCanOverflow); | 3027 SetFlag(kCanOverflow); |
| 2993 } | 3028 } |
| 2994 | 3029 |
| 2995 // Add is only commutative if two integer values are added and not if two | 3030 // Add is only commutative if two integer values are added and not if two |
| 2996 // tagged values are added (because it might be a String concatenation). | 3031 // tagged values are added (because it might be a String concatenation). |
| 2997 virtual bool IsCommutative() const { | 3032 virtual bool IsCommutative() const { |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3131 : HBitwiseBinaryOperation(context, left, right), op_(op) { | 3166 : HBitwiseBinaryOperation(context, left, right), op_(op) { |
| 3132 ASSERT(op == Token::BIT_AND || | 3167 ASSERT(op == Token::BIT_AND || |
| 3133 op == Token::BIT_OR || | 3168 op == Token::BIT_OR || |
| 3134 op == Token::BIT_XOR); | 3169 op == Token::BIT_XOR); |
| 3135 } | 3170 } |
| 3136 | 3171 |
| 3137 Token::Value op() const { return op_; } | 3172 Token::Value op() const { return op_; } |
| 3138 | 3173 |
| 3139 virtual bool IsCommutative() const { return true; } | 3174 virtual bool IsCommutative() const { return true; } |
| 3140 | 3175 |
| 3176 virtual HValue* Canonicalize(); |
| 3177 |
| 3141 static HInstruction* NewHBitwise(Zone* zone, | 3178 static HInstruction* NewHBitwise(Zone* zone, |
| 3142 Token::Value op, | 3179 Token::Value op, |
| 3143 HValue* context, | 3180 HValue* context, |
| 3144 HValue* left, | 3181 HValue* left, |
| 3145 HValue* right); | 3182 HValue* right); |
| 3146 | 3183 |
| 3147 DECLARE_CONCRETE_INSTRUCTION(Bitwise) | 3184 DECLARE_CONCRETE_INSTRUCTION(Bitwise) |
| 3148 | 3185 |
| 3149 protected: | 3186 protected: |
| 3150 virtual bool DataEquals(HValue* other) { | 3187 virtual bool DataEquals(HValue* other) { |
| (...skipping 1335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4486 | 4523 |
| 4487 DECLARE_CONCRETE_INSTRUCTION(In) | 4524 DECLARE_CONCRETE_INSTRUCTION(In) |
| 4488 }; | 4525 }; |
| 4489 | 4526 |
| 4490 #undef DECLARE_INSTRUCTION | 4527 #undef DECLARE_INSTRUCTION |
| 4491 #undef DECLARE_CONCRETE_INSTRUCTION | 4528 #undef DECLARE_CONCRETE_INSTRUCTION |
| 4492 | 4529 |
| 4493 } } // namespace v8::internal | 4530 } } // namespace v8::internal |
| 4494 | 4531 |
| 4495 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 4532 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |