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

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: 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') | src/hydrogen-instructions.cc » ('J')
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 TruncateToSmi() {
Sven Panne 2013/06/07 06:40:54 I think that "ClampToSmi" is a better name. "Clamp
275 lower_ = Max(lower_, Smi::kMinValue);
276 upper_ = Min(upper_, Smi::kMaxValue);
277 }
278 void TruncateToInt32() {
Jakob Kummerow 2013/06/07 08:21:05 Considering that lower_ and upper_ are int32_t, th
279 lower_ = Max(lower_, kMinInt);
280 upper_ = Min(upper_, kMaxInt);
281 }
274 void KeepOrder(); 282 void KeepOrder();
275 #ifdef DEBUG 283 #ifdef DEBUG
276 void Verify() const; 284 void Verify() const;
277 #endif 285 #endif
278 286
279 void StackUpon(Range* other) { 287 void StackUpon(Range* other) {
280 Intersect(other); 288 Intersect(other);
281 next_ = other; 289 next_ = other;
282 } 290 }
283 291
(...skipping 2353 matching lines...) Expand 10 before | Expand all | Expand 10 after
2637 return Representation::Double(); 2645 return Representation::Double();
2638 case kMathAbs: 2646 case kMathAbs:
2639 return representation(); 2647 return representation();
2640 default: 2648 default:
2641 UNREACHABLE(); 2649 UNREACHABLE();
2642 return Representation::None(); 2650 return Representation::None();
2643 } 2651 }
2644 } 2652 }
2645 } 2653 }
2646 2654
2655 virtual Range* InferRange(Zone* zone);
2656
2647 virtual HValue* Canonicalize(); 2657 virtual HValue* Canonicalize();
2648 2658
2649 BuiltinFunctionId op() const { return op_; } 2659 BuiltinFunctionId op() const { return op_; }
2650 const char* OpName() const; 2660 const char* OpName() const;
2651 2661
2652 DECLARE_CONCRETE_INSTRUCTION(UnaryMathOperation) 2662 DECLARE_CONCRETE_INSTRUCTION(UnaryMathOperation)
2653 2663
2654 protected: 2664 protected:
2655 virtual bool DataEquals(HValue* other) { 2665 virtual bool DataEquals(HValue* other) {
2656 HUnaryMathOperation* b = HUnaryMathOperation::cast(other); 2666 HUnaryMathOperation* b = HUnaryMathOperation::cast(other);
(...skipping 3901 matching lines...) Expand 10 before | Expand all | Expand 10 after
6558 virtual bool IsDeletable() const { return true; } 6568 virtual bool IsDeletable() const { return true; }
6559 }; 6569 };
6560 6570
6561 6571
6562 #undef DECLARE_INSTRUCTION 6572 #undef DECLARE_INSTRUCTION
6563 #undef DECLARE_CONCRETE_INSTRUCTION 6573 #undef DECLARE_CONCRETE_INSTRUCTION
6564 6574
6565 } } // namespace v8::internal 6575 } } // namespace v8::internal
6566 6576
6567 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 6577 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « no previous file | src/hydrogen-instructions.cc » ('j') | src/hydrogen-instructions.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698