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

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

Issue 15994015: Replace log2 with MostSignificantBit (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/utils.h » ('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 2310 matching lines...) Expand 10 before | Expand all | Expand 10 after
2321 int64_t left_upper = left()->range()->upper(); 2321 int64_t left_upper = left()->range()->upper();
2322 int64_t left_lower = left()->range()->lower(); 2322 int64_t left_lower = left()->range()->lower();
2323 int64_t right_upper = right()->range()->upper(); 2323 int64_t right_upper = right()->range()->upper();
2324 int64_t right_lower = right()->range()->lower(); 2324 int64_t right_lower = right()->range()->lower();
2325 2325
2326 if (left_upper < 0) left_upper = ~left_upper; 2326 if (left_upper < 0) left_upper = ~left_upper;
2327 if (left_lower < 0) left_lower = ~left_lower; 2327 if (left_lower < 0) left_lower = ~left_lower;
2328 if (right_upper < 0) right_upper = ~right_upper; 2328 if (right_upper < 0) right_upper = ~right_upper;
2329 if (right_lower < 0) right_lower = ~right_lower; 2329 if (right_lower < 0) right_lower = ~right_lower;
2330 2330
2331 // Find the highest used bit. 2331 int high = MostSignificantBit(
2332 int high = static_cast<int>(log2(left_upper)); 2332 left_upper | left_lower | right_upper | right_lower);
2333 high = Max(high, static_cast<int>(log2(left_lower)));
2334 high = Max(high, static_cast<int>(log2(right_upper)));
2335 high = Max(high, static_cast<int>(log2(right_lower)));
2336 2333
2337 int64_t limit = 1; 2334 int64_t limit = 1;
2338 limit <<= high + 1; 2335 limit <<= high;
2339 int32_t min = (left()->range()->CanBeNegative() || 2336 int32_t min = (left()->range()->CanBeNegative() ||
2340 right()->range()->CanBeNegative()) 2337 right()->range()->CanBeNegative())
2341 ? static_cast<int32_t>(-limit) : 0; 2338 ? static_cast<int32_t>(-limit) : 0;
2342 return new(zone) Range(min, static_cast<int32_t>(limit - 1)); 2339 return new(zone) Range(min, static_cast<int32_t>(limit - 1));
2343 } 2340 }
2344 return HValue::InferRange(zone); 2341 return HValue::InferRange(zone);
2345 } 2342 }
2346 const int32_t kDefaultMask = static_cast<int32_t>(0xffffffff); 2343 const int32_t kDefaultMask = static_cast<int32_t>(0xffffffff);
2347 int32_t left_mask = (left()->range() != NULL) 2344 int32_t left_mask = (left()->range() != NULL)
2348 ? left()->range()->Mask() 2345 ? left()->range()->Mask()
(...skipping 1443 matching lines...) Expand 10 before | Expand all | Expand 10 after
3792 case kBackingStore: 3789 case kBackingStore:
3793 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); 3790 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString());
3794 stream->Add("[backing-store]"); 3791 stream->Add("[backing-store]");
3795 break; 3792 break;
3796 } 3793 }
3797 3794
3798 stream->Add("@%d", offset()); 3795 stream->Add("@%d", offset());
3799 } 3796 }
3800 3797
3801 } } // namespace v8::internal 3798 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698