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 2183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2194 virtual bool DataEquals(HValue* other) { return true; } | 2194 virtual bool DataEquals(HValue* other) { return true; } |
2195 | 2195 |
2196 private: | 2196 private: |
2197 virtual bool IsDeletable() const { return true; } | 2197 virtual bool IsDeletable() const { return true; } |
2198 }; | 2198 }; |
2199 | 2199 |
2200 | 2200 |
2201 class HCheckMaps: public HTemplateInstruction<2> { | 2201 class HCheckMaps: public HTemplateInstruction<2> { |
2202 public: | 2202 public: |
2203 HCheckMaps(HValue* value, Handle<Map> map, Zone* zone, | 2203 HCheckMaps(HValue* value, Handle<Map> map, Zone* zone, |
2204 HValue* typecheck = NULL, | 2204 HValue* typecheck = NULL) { |
2205 CompareMapMode mode = REQUIRE_EXACT_MAP) : mode_(mode) { | |
2206 SetOperandAt(0, value); | 2205 SetOperandAt(0, value); |
2207 // If callers don't depend on a typecheck, they can pass in NULL. In that | 2206 // If callers don't depend on a typecheck, they can pass in NULL. In that |
2208 // case we use a copy of the |value| argument as a dummy value. | 2207 // case we use a copy of the |value| argument as a dummy value. |
2209 SetOperandAt(1, typecheck != NULL ? typecheck : value); | 2208 SetOperandAt(1, typecheck != NULL ? typecheck : value); |
2210 set_representation(Representation::Tagged()); | 2209 set_representation(Representation::Tagged()); |
2211 SetFlag(kUseGVN); | 2210 SetFlag(kUseGVN); |
2212 SetGVNFlag(kDependsOnMaps); | 2211 SetGVNFlag(kDependsOnMaps); |
2213 SetGVNFlag(kDependsOnElementsKind); | 2212 SetGVNFlag(kDependsOnElementsKind); |
2214 map_set()->Add(map, zone); | 2213 map_set()->Add(map, zone); |
2215 } | 2214 } |
2216 HCheckMaps(HValue* value, SmallMapList* maps, Zone* zone, | 2215 HCheckMaps(HValue* value, SmallMapList* maps, Zone* zone) { |
2217 CompareMapMode mode = REQUIRE_EXACT_MAP) : mode_(mode) { | |
2218 SetOperandAt(0, value); | 2216 SetOperandAt(0, value); |
2219 SetOperandAt(1, value); | 2217 SetOperandAt(1, value); |
2220 set_representation(Representation::Tagged()); | 2218 set_representation(Representation::Tagged()); |
2221 SetFlag(kUseGVN); | 2219 SetFlag(kUseGVN); |
2222 SetGVNFlag(kDependsOnMaps); | 2220 SetGVNFlag(kDependsOnMaps); |
2223 SetGVNFlag(kDependsOnElementsKind); | 2221 SetGVNFlag(kDependsOnElementsKind); |
2224 for (int i = 0; i < maps->length(); i++) { | 2222 for (int i = 0; i < maps->length(); i++) { |
2225 map_set()->Add(maps->at(i), zone); | 2223 map_set()->Add(maps->at(i), zone); |
2226 } | 2224 } |
2227 map_set()->Sort(); | 2225 map_set()->Sort(); |
(...skipping 24 matching lines...) Expand all Loading... |
2252 | 2250 |
2253 virtual Representation RequiredInputRepresentation(int index) { | 2251 virtual Representation RequiredInputRepresentation(int index) { |
2254 return Representation::Tagged(); | 2252 return Representation::Tagged(); |
2255 } | 2253 } |
2256 | 2254 |
2257 virtual void PrintDataTo(StringStream* stream); | 2255 virtual void PrintDataTo(StringStream* stream); |
2258 virtual HType CalculateInferredType(); | 2256 virtual HType CalculateInferredType(); |
2259 | 2257 |
2260 HValue* value() { return OperandAt(0); } | 2258 HValue* value() { return OperandAt(0); } |
2261 SmallMapList* map_set() { return &map_set_; } | 2259 SmallMapList* map_set() { return &map_set_; } |
2262 CompareMapMode mode() { return mode_; } | |
2263 | 2260 |
2264 DECLARE_CONCRETE_INSTRUCTION(CheckMaps) | 2261 DECLARE_CONCRETE_INSTRUCTION(CheckMaps) |
2265 | 2262 |
2266 protected: | 2263 protected: |
2267 virtual bool DataEquals(HValue* other) { | 2264 virtual bool DataEquals(HValue* other) { |
2268 HCheckMaps* b = HCheckMaps::cast(other); | 2265 HCheckMaps* b = HCheckMaps::cast(other); |
2269 // Relies on the fact that map_set has been sorted before. | 2266 // Relies on the fact that map_set has been sorted before. |
2270 if (map_set()->length() != b->map_set()->length()) return false; | 2267 if (map_set()->length() != b->map_set()->length()) return false; |
2271 for (int i = 0; i < map_set()->length(); i++) { | 2268 for (int i = 0; i < map_set()->length(); i++) { |
2272 if (!map_set()->at(i).is_identical_to(b->map_set()->at(i))) return false; | 2269 if (!map_set()->at(i).is_identical_to(b->map_set()->at(i))) return false; |
2273 } | 2270 } |
2274 return true; | 2271 return true; |
2275 } | 2272 } |
2276 | 2273 |
2277 private: | 2274 private: |
2278 SmallMapList map_set_; | 2275 SmallMapList map_set_; |
2279 CompareMapMode mode_; | |
2280 }; | 2276 }; |
2281 | 2277 |
2282 | 2278 |
2283 class HCheckFunction: public HUnaryOperation { | 2279 class HCheckFunction: public HUnaryOperation { |
2284 public: | 2280 public: |
2285 HCheckFunction(HValue* value, Handle<JSFunction> function) | 2281 HCheckFunction(HValue* value, Handle<JSFunction> function) |
2286 : HUnaryOperation(value), target_(function) { | 2282 : HUnaryOperation(value), target_(function) { |
2287 set_representation(Representation::Tagged()); | 2283 set_representation(Representation::Tagged()); |
2288 SetFlag(kUseGVN); | 2284 SetFlag(kUseGVN); |
2289 } | 2285 } |
(...skipping 3100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5390 virtual bool IsDeletable() const { return true; } | 5386 virtual bool IsDeletable() const { return true; } |
5391 }; | 5387 }; |
5392 | 5388 |
5393 | 5389 |
5394 #undef DECLARE_INSTRUCTION | 5390 #undef DECLARE_INSTRUCTION |
5395 #undef DECLARE_CONCRETE_INSTRUCTION | 5391 #undef DECLARE_CONCRETE_INSTRUCTION |
5396 | 5392 |
5397 } } // namespace v8::internal | 5393 } } // namespace v8::internal |
5398 | 5394 |
5399 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 5395 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |