OLD | NEW |
1 // Copyright 2012 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 |
(...skipping 2149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2160 virtual bool DataEquals(HValue* other) { return true; } | 2160 virtual bool DataEquals(HValue* other) { return true; } |
2161 | 2161 |
2162 private: | 2162 private: |
2163 virtual bool IsDeletable() const { return true; } | 2163 virtual bool IsDeletable() const { return true; } |
2164 }; | 2164 }; |
2165 | 2165 |
2166 | 2166 |
2167 class HCheckMaps: public HTemplateInstruction<2> { | 2167 class HCheckMaps: public HTemplateInstruction<2> { |
2168 public: | 2168 public: |
2169 HCheckMaps(HValue* value, Handle<Map> map, Zone* zone, | 2169 HCheckMaps(HValue* value, Handle<Map> map, Zone* zone, |
2170 HValue* typecheck = NULL) { | 2170 HValue* typecheck = NULL, |
| 2171 CompareMapMode mode = REQUIRE_EXACT_MAP) : mode_(mode) { |
2171 SetOperandAt(0, value); | 2172 SetOperandAt(0, value); |
2172 // If callers don't depend on a typecheck, they can pass in NULL. In that | 2173 // If callers don't depend on a typecheck, they can pass in NULL. In that |
2173 // case we use a copy of the |value| argument as a dummy value. | 2174 // case we use a copy of the |value| argument as a dummy value. |
2174 SetOperandAt(1, typecheck != NULL ? typecheck : value); | 2175 SetOperandAt(1, typecheck != NULL ? typecheck : value); |
2175 set_representation(Representation::Tagged()); | 2176 set_representation(Representation::Tagged()); |
2176 SetFlag(kUseGVN); | 2177 SetFlag(kUseGVN); |
2177 SetGVNFlag(kDependsOnMaps); | 2178 SetGVNFlag(kDependsOnMaps); |
2178 SetGVNFlag(kDependsOnElementsKind); | 2179 SetGVNFlag(kDependsOnElementsKind); |
2179 map_set()->Add(map, zone); | 2180 map_set()->Add(map, zone); |
2180 } | 2181 } |
2181 HCheckMaps(HValue* value, SmallMapList* maps, Zone* zone) { | 2182 HCheckMaps(HValue* value, SmallMapList* maps, Zone* zone, |
| 2183 CompareMapMode mode = REQUIRE_EXACT_MAP) : mode_(mode) { |
2182 SetOperandAt(0, value); | 2184 SetOperandAt(0, value); |
2183 SetOperandAt(1, value); | 2185 SetOperandAt(1, value); |
2184 set_representation(Representation::Tagged()); | 2186 set_representation(Representation::Tagged()); |
2185 SetFlag(kUseGVN); | 2187 SetFlag(kUseGVN); |
2186 SetGVNFlag(kDependsOnMaps); | 2188 SetGVNFlag(kDependsOnMaps); |
2187 SetGVNFlag(kDependsOnElementsKind); | 2189 SetGVNFlag(kDependsOnElementsKind); |
2188 for (int i = 0; i < maps->length(); i++) { | 2190 for (int i = 0; i < maps->length(); i++) { |
2189 map_set()->Add(maps->at(i), zone); | 2191 map_set()->Add(maps->at(i), zone); |
2190 } | 2192 } |
2191 map_set()->Sort(); | 2193 map_set()->Sort(); |
(...skipping 23 matching lines...) Expand all Loading... |
2215 } | 2217 } |
2216 | 2218 |
2217 virtual Representation RequiredInputRepresentation(int index) { | 2219 virtual Representation RequiredInputRepresentation(int index) { |
2218 return Representation::Tagged(); | 2220 return Representation::Tagged(); |
2219 } | 2221 } |
2220 virtual void PrintDataTo(StringStream* stream); | 2222 virtual void PrintDataTo(StringStream* stream); |
2221 virtual HType CalculateInferredType(); | 2223 virtual HType CalculateInferredType(); |
2222 | 2224 |
2223 HValue* value() { return OperandAt(0); } | 2225 HValue* value() { return OperandAt(0); } |
2224 SmallMapList* map_set() { return &map_set_; } | 2226 SmallMapList* map_set() { return &map_set_; } |
| 2227 CompareMapMode mode() { return mode_; } |
2225 | 2228 |
2226 DECLARE_CONCRETE_INSTRUCTION(CheckMaps) | 2229 DECLARE_CONCRETE_INSTRUCTION(CheckMaps) |
2227 | 2230 |
2228 protected: | 2231 protected: |
2229 virtual bool DataEquals(HValue* other) { | 2232 virtual bool DataEquals(HValue* other) { |
2230 HCheckMaps* b = HCheckMaps::cast(other); | 2233 HCheckMaps* b = HCheckMaps::cast(other); |
2231 // Relies on the fact that map_set has been sorted before. | 2234 // Relies on the fact that map_set has been sorted before. |
2232 if (map_set()->length() != b->map_set()->length()) return false; | 2235 if (map_set()->length() != b->map_set()->length()) return false; |
2233 for (int i = 0; i < map_set()->length(); i++) { | 2236 for (int i = 0; i < map_set()->length(); i++) { |
2234 if (!map_set()->at(i).is_identical_to(b->map_set()->at(i))) return false; | 2237 if (!map_set()->at(i).is_identical_to(b->map_set()->at(i))) return false; |
2235 } | 2238 } |
2236 return true; | 2239 return true; |
2237 } | 2240 } |
2238 | 2241 |
2239 private: | 2242 private: |
2240 SmallMapList map_set_; | 2243 SmallMapList map_set_; |
| 2244 CompareMapMode mode_; |
2241 }; | 2245 }; |
2242 | 2246 |
2243 | 2247 |
2244 class HCheckFunction: public HUnaryOperation { | 2248 class HCheckFunction: public HUnaryOperation { |
2245 public: | 2249 public: |
2246 HCheckFunction(HValue* value, Handle<JSFunction> function) | 2250 HCheckFunction(HValue* value, Handle<JSFunction> function) |
2247 : HUnaryOperation(value), target_(function) { | 2251 : HUnaryOperation(value), target_(function) { |
2248 set_representation(Representation::Tagged()); | 2252 set_representation(Representation::Tagged()); |
2249 SetFlag(kUseGVN); | 2253 SetFlag(kUseGVN); |
2250 } | 2254 } |
(...skipping 3031 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5282 virtual bool IsDeletable() const { return true; } | 5286 virtual bool IsDeletable() const { return true; } |
5283 }; | 5287 }; |
5284 | 5288 |
5285 | 5289 |
5286 #undef DECLARE_INSTRUCTION | 5290 #undef DECLARE_INSTRUCTION |
5287 #undef DECLARE_CONCRETE_INSTRUCTION | 5291 #undef DECLARE_CONCRETE_INSTRUCTION |
5288 | 5292 |
5289 } } // namespace v8::internal | 5293 } } // namespace v8::internal |
5290 | 5294 |
5291 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 5295 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |