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

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

Issue 5860009: Fix bugs in the range analysis for integers.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: cleanup Created 10 years 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 | « src/hydrogen.cc ('k') | 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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 int old_upper = upper_; 327 int old_upper = upper_;
328 lower_ = lower_ << bits; 328 lower_ = lower_ << bits;
329 upper_ = upper_ << bits; 329 upper_ = upper_ << bits;
330 if (old_lower != lower_ >> bits || old_upper != upper_ >> bits) { 330 if (old_lower != lower_ >> bits || old_upper != upper_ >> bits) {
331 upper_ = kMaxInt; 331 upper_ = kMaxInt;
332 lower_ = kMinInt; 332 lower_ = kMinInt;
333 } 333 }
334 set_can_be_minus_zero(false); 334 set_can_be_minus_zero(false);
335 } 335 }
336 336
337 void AddConstant(int32_t value);
Vyacheslav Egorov (Chromium) 2010/12/16 17:48:10 Comment what this function does to this Range.
338
337 void StackUpon(Range* other) { 339 void StackUpon(Range* other) {
338 Intersect(other); 340 Intersect(other);
339 next_ = other; 341 next_ = other;
340 } 342 }
341 343
342 void Intersect(Range* other) { 344 void Intersect(Range* other) {
343 upper_ = Min(upper_, other->upper_); 345 upper_ = Min(upper_, other->upper_);
344 lower_ = Max(lower_, other->lower_); 346 lower_ = Max(lower_, other->lower_);
345 bool b = CanBeMinusZero() && other->CanBeMinusZero(); 347 bool b = CanBeMinusZero() && other->CanBeMinusZero();
346 set_can_be_minus_zero(b); 348 set_can_be_minus_zero(b);
347 } 349 }
348 350
349 void Union(Range* other) { 351 void Union(Range* other) {
350 upper_ = Max(upper_, other->upper_); 352 upper_ = Max(upper_, other->upper_);
351 lower_ = Min(lower_, other->lower_); 353 lower_ = Min(lower_, other->lower_);
352 bool b = CanBeMinusZero() || other->CanBeMinusZero(); 354 bool b = CanBeMinusZero() || other->CanBeMinusZero();
353 set_can_be_minus_zero(b); 355 set_can_be_minus_zero(b);
354 } 356 }
355 357
356 void Add(int32_t value); 358 // Compute a new result range and return true, if the operation
359 // can overflow.
357 bool AddAndCheckOverflow(Range* other); 360 bool AddAndCheckOverflow(Range* other);
358 bool SubAndCheckOverflow(Range* other); 361 bool SubAndCheckOverflow(Range* other);
359 bool MulAndCheckOverflow(Range* other); 362 bool MulAndCheckOverflow(Range* other);
360 363
361 private: 364 private:
362 int32_t lower_; 365 int32_t lower_;
363 int32_t upper_; 366 int32_t upper_;
364 Range* next_; 367 Range* next_;
365 bool can_be_minus_zero_; 368 bool can_be_minus_zero_;
366 }; 369 };
(...skipping 2543 matching lines...) Expand 10 before | Expand all | Expand 10 after
2910 HValue* object() const { return left(); } 2913 HValue* object() const { return left(); }
2911 HValue* key() const { return right(); } 2914 HValue* key() const { return right(); }
2912 }; 2915 };
2913 2916
2914 #undef DECLARE_INSTRUCTION 2917 #undef DECLARE_INSTRUCTION
2915 #undef DECLARE_CONCRETE_INSTRUCTION 2918 #undef DECLARE_CONCRETE_INSTRUCTION
2916 2919
2917 } } // namespace v8::internal 2920 } } // namespace v8::internal
2918 2921
2919 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 2922 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698