Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(345)

Side by Side Diff: src/hydrogen-instructions.h

Issue 16268009: Infer the range of Math.abs (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix that bug Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/hydrogen-instructions.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 bool CanBeZero() const { return upper_ >= 0 && lower_ <= 0; } 264 bool CanBeZero() const { return upper_ >= 0 && lower_ <= 0; }
265 bool CanBeNegative() const { return lower_ < 0; } 265 bool CanBeNegative() const { return lower_ < 0; }
266 bool CanBePositive() const { return upper_ > 0; } 266 bool CanBePositive() const { return upper_ > 0; }
267 bool Includes(int value) const { return lower_ <= value && upper_ >= value; } 267 bool Includes(int value) const { return lower_ <= value && upper_ >= value; }
268 bool IsMostGeneric() const { 268 bool IsMostGeneric() const {
269 return lower_ == kMinInt && upper_ == kMaxInt && CanBeMinusZero(); 269 return lower_ == kMinInt && upper_ == kMaxInt && CanBeMinusZero();
270 } 270 }
271 bool IsInSmiRange() const { 271 bool IsInSmiRange() const {
272 return lower_ >= Smi::kMinValue && upper_ <= Smi::kMaxValue; 272 return lower_ >= Smi::kMinValue && upper_ <= Smi::kMaxValue;
273 } 273 }
274 void ClampToSmi() {
275 lower_ = Max(lower_, Smi::kMinValue);
276 upper_ = Min(upper_, Smi::kMaxValue);
277 }
274 void KeepOrder(); 278 void KeepOrder();
275 #ifdef DEBUG 279 #ifdef DEBUG
276 void Verify() const; 280 void Verify() const;
277 #endif 281 #endif
278 282
279 void StackUpon(Range* other) { 283 void StackUpon(Range* other) {
280 Intersect(other); 284 Intersect(other);
281 next_ = other; 285 next_ = other;
282 } 286 }
283 287
(...skipping 2353 matching lines...) Expand 10 before | Expand all | Expand 10 after
2637 return Representation::Double(); 2641 return Representation::Double();
2638 case kMathAbs: 2642 case kMathAbs:
2639 return representation(); 2643 return representation();
2640 default: 2644 default:
2641 UNREACHABLE(); 2645 UNREACHABLE();
2642 return Representation::None(); 2646 return Representation::None();
2643 } 2647 }
2644 } 2648 }
2645 } 2649 }
2646 2650
2651 virtual Range* InferRange(Zone* zone);
2652
2647 virtual HValue* Canonicalize(); 2653 virtual HValue* Canonicalize();
2648 2654
2649 BuiltinFunctionId op() const { return op_; } 2655 BuiltinFunctionId op() const { return op_; }
2650 const char* OpName() const; 2656 const char* OpName() const;
2651 2657
2652 DECLARE_CONCRETE_INSTRUCTION(UnaryMathOperation) 2658 DECLARE_CONCRETE_INSTRUCTION(UnaryMathOperation)
2653 2659
2654 protected: 2660 protected:
2655 virtual bool DataEquals(HValue* other) { 2661 virtual bool DataEquals(HValue* other) {
2656 HUnaryMathOperation* b = HUnaryMathOperation::cast(other); 2662 HUnaryMathOperation* b = HUnaryMathOperation::cast(other);
(...skipping 3901 matching lines...) Expand 10 before | Expand all | Expand 10 after
6558 virtual bool IsDeletable() const { return true; } 6564 virtual bool IsDeletable() const { return true; }
6559 }; 6565 };
6560 6566
6561 6567
6562 #undef DECLARE_INSTRUCTION 6568 #undef DECLARE_INSTRUCTION
6563 #undef DECLARE_CONCRETE_INSTRUCTION 6569 #undef DECLARE_CONCRETE_INSTRUCTION
6564 6570
6565 } } // namespace v8::internal 6571 } } // namespace v8::internal
6566 6572
6567 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 6573 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « no previous file | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698