OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 2190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2201 class HCompare: public HBinaryOperation { | 2201 class HCompare: public HBinaryOperation { |
2202 public: | 2202 public: |
2203 HCompare(HValue* left, HValue* right, Token::Value token) | 2203 HCompare(HValue* left, HValue* right, Token::Value token) |
2204 : HBinaryOperation(left, right), token_(token) { | 2204 : HBinaryOperation(left, right), token_(token) { |
2205 ASSERT(Token::IsCompareOp(token)); | 2205 ASSERT(Token::IsCompareOp(token)); |
2206 set_representation(Representation::Tagged()); | 2206 set_representation(Representation::Tagged()); |
2207 SetAllSideEffects(); | 2207 SetAllSideEffects(); |
2208 } | 2208 } |
2209 | 2209 |
2210 void SetInputRepresentation(Representation r); | 2210 void SetInputRepresentation(Representation r); |
2211 virtual bool EmitAtUses() const { return uses()->length() <= 1; } | 2211 |
| 2212 virtual bool EmitAtUses() const { |
| 2213 return !HasSideEffects() && (uses()->length() <= 1); |
| 2214 } |
| 2215 |
2212 virtual Representation RequiredInputRepresentation(int index) const { | 2216 virtual Representation RequiredInputRepresentation(int index) const { |
2213 return input_representation_; | 2217 return input_representation_; |
2214 } | 2218 } |
2215 Representation GetInputRepresentation() const { | 2219 Representation GetInputRepresentation() const { |
2216 return input_representation_; | 2220 return input_representation_; |
2217 } | 2221 } |
2218 Token::Value token() const { return token_; } | 2222 Token::Value token() const { return token_; } |
2219 virtual void PrintDataTo(StringStream* stream) const; | 2223 virtual void PrintDataTo(StringStream* stream) const; |
2220 | 2224 |
2221 virtual HType CalculateInferredType() const; | 2225 virtual HType CalculateInferredType() const; |
(...skipping 17 matching lines...) Expand all Loading... |
2239 | 2243 |
2240 | 2244 |
2241 class HCompareJSObjectEq: public HBinaryOperation { | 2245 class HCompareJSObjectEq: public HBinaryOperation { |
2242 public: | 2246 public: |
2243 HCompareJSObjectEq(HValue* left, HValue* right) | 2247 HCompareJSObjectEq(HValue* left, HValue* right) |
2244 : HBinaryOperation(left, right) { | 2248 : HBinaryOperation(left, right) { |
2245 set_representation(Representation::Tagged()); | 2249 set_representation(Representation::Tagged()); |
2246 SetFlag(kUseGVN); | 2250 SetFlag(kUseGVN); |
2247 } | 2251 } |
2248 | 2252 |
2249 virtual bool EmitAtUses() const { return uses()->length() <= 1; } | 2253 virtual bool EmitAtUses() const { |
| 2254 return !HasSideEffects() && (uses()->length() <= 1); |
| 2255 } |
| 2256 |
2250 virtual Representation RequiredInputRepresentation(int index) const { | 2257 virtual Representation RequiredInputRepresentation(int index) const { |
2251 return Representation::Tagged(); | 2258 return Representation::Tagged(); |
2252 } | 2259 } |
2253 virtual HType CalculateInferredType() const; | 2260 virtual HType CalculateInferredType() const; |
2254 | 2261 |
2255 DECLARE_CONCRETE_INSTRUCTION(CompareJSObjectEq, "compare-js-object-eq") | 2262 DECLARE_CONCRETE_INSTRUCTION(CompareJSObjectEq, "compare-js-object-eq") |
2256 | 2263 |
2257 protected: | 2264 protected: |
2258 virtual bool DataEquals(HValue* other) const { return true; } | 2265 virtual bool DataEquals(HValue* other) const { return true; } |
2259 }; | 2266 }; |
2260 | 2267 |
2261 | 2268 |
2262 class HUnaryPredicate: public HUnaryOperation { | 2269 class HUnaryPredicate: public HUnaryOperation { |
2263 public: | 2270 public: |
2264 explicit HUnaryPredicate(HValue* value) : HUnaryOperation(value) { | 2271 explicit HUnaryPredicate(HValue* value) : HUnaryOperation(value) { |
2265 set_representation(Representation::Tagged()); | 2272 set_representation(Representation::Tagged()); |
2266 SetFlag(kUseGVN); | 2273 SetFlag(kUseGVN); |
2267 } | 2274 } |
2268 virtual bool EmitAtUses() const { return uses()->length() <= 1; } | 2275 |
| 2276 virtual bool EmitAtUses() const { |
| 2277 return !HasSideEffects() && (uses()->length() <= 1); |
| 2278 } |
| 2279 |
2269 virtual Representation RequiredInputRepresentation(int index) const { | 2280 virtual Representation RequiredInputRepresentation(int index) const { |
2270 return Representation::Tagged(); | 2281 return Representation::Tagged(); |
2271 } | 2282 } |
2272 virtual HType CalculateInferredType() const; | 2283 virtual HType CalculateInferredType() const; |
2273 }; | 2284 }; |
2274 | 2285 |
2275 | 2286 |
2276 class HIsNull: public HUnaryPredicate { | 2287 class HIsNull: public HUnaryPredicate { |
2277 public: | 2288 public: |
2278 HIsNull(HValue* value, bool is_strict) | 2289 HIsNull(HValue* value, bool is_strict) |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2315 }; | 2326 }; |
2316 | 2327 |
2317 | 2328 |
2318 class HIsConstructCall: public HInstruction { | 2329 class HIsConstructCall: public HInstruction { |
2319 public: | 2330 public: |
2320 HIsConstructCall() { | 2331 HIsConstructCall() { |
2321 set_representation(Representation::Tagged()); | 2332 set_representation(Representation::Tagged()); |
2322 SetFlag(kUseGVN); | 2333 SetFlag(kUseGVN); |
2323 } | 2334 } |
2324 | 2335 |
2325 virtual bool EmitAtUses() const { return uses()->length() <= 1; } | 2336 virtual bool EmitAtUses() const { |
| 2337 return !HasSideEffects() && (uses()->length() <= 1); |
| 2338 } |
2326 | 2339 |
2327 DECLARE_CONCRETE_INSTRUCTION(IsConstructCall, "is_construct_call") | 2340 DECLARE_CONCRETE_INSTRUCTION(IsConstructCall, "is_construct_call") |
2328 | 2341 |
2329 protected: | 2342 protected: |
2330 virtual bool DataEquals(HValue* other) const { return true; } | 2343 virtual bool DataEquals(HValue* other) const { return true; } |
2331 }; | 2344 }; |
2332 | 2345 |
2333 | 2346 |
2334 class HHasInstanceType: public HUnaryPredicate { | 2347 class HHasInstanceType: public HUnaryPredicate { |
2335 public: | 2348 public: |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2420 SetOperandAt(1, left); | 2433 SetOperandAt(1, left); |
2421 SetOperandAt(2, right); | 2434 SetOperandAt(2, right); |
2422 set_representation(Representation::Tagged()); | 2435 set_representation(Representation::Tagged()); |
2423 SetAllSideEffects(); | 2436 SetAllSideEffects(); |
2424 } | 2437 } |
2425 | 2438 |
2426 HValue* context() const { return operands_[0]; } | 2439 HValue* context() const { return operands_[0]; } |
2427 HValue* left() const { return operands_[1]; } | 2440 HValue* left() const { return operands_[1]; } |
2428 HValue* right() const { return operands_[2]; } | 2441 HValue* right() const { return operands_[2]; } |
2429 | 2442 |
2430 virtual bool EmitAtUses() const { return uses()->length() <= 1; } | 2443 virtual bool EmitAtUses() const { |
| 2444 return !HasSideEffects() && (uses()->length() <= 1); |
| 2445 } |
2431 | 2446 |
2432 virtual Representation RequiredInputRepresentation(int index) const { | 2447 virtual Representation RequiredInputRepresentation(int index) const { |
2433 return Representation::Tagged(); | 2448 return Representation::Tagged(); |
2434 } | 2449 } |
2435 | 2450 |
2436 virtual void PrintDataTo(StringStream* stream) const; | 2451 virtual void PrintDataTo(StringStream* stream) const; |
2437 | 2452 |
2438 virtual int OperandCount() const { return 3; } | 2453 virtual int OperandCount() const { return 3; } |
2439 virtual HValue* OperandAt(int index) const { return operands_[index]; } | 2454 virtual HValue* OperandAt(int index) const { return operands_[index]; } |
2440 | 2455 |
(...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3454 HValue* object() const { return left(); } | 3469 HValue* object() const { return left(); } |
3455 HValue* key() const { return right(); } | 3470 HValue* key() const { return right(); } |
3456 }; | 3471 }; |
3457 | 3472 |
3458 #undef DECLARE_INSTRUCTION | 3473 #undef DECLARE_INSTRUCTION |
3459 #undef DECLARE_CONCRETE_INSTRUCTION | 3474 #undef DECLARE_CONCRETE_INSTRUCTION |
3460 | 3475 |
3461 } } // namespace v8::internal | 3476 } } // namespace v8::internal |
3462 | 3477 |
3463 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 3478 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |