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/utils.h

Issue 6708025: ARM: Add optimization for constant RHS in DoMulI (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 9 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
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 // Returns true iff x is a power of 2 (or zero). Cannot be used with the 46 // Returns true iff x is a power of 2 (or zero). Cannot be used with the
47 // maximally negative value of the type T (the -1 overflows). 47 // maximally negative value of the type T (the -1 overflows).
48 template <typename T> 48 template <typename T>
49 static inline bool IsPowerOf2(T x) { 49 static inline bool IsPowerOf2(T x) {
50 return IS_POWER_OF_TWO(x); 50 return IS_POWER_OF_TWO(x);
51 } 51 }
52 52
53 53
54 // X must be a power of 2. Returns the number of trailing zeros. 54 // X must be a power of 2. Returns the number of trailing zeros.
55 template <typename T> 55 static inline int WhichPowerOf2(uint32_t x) {
56 static inline int WhichPowerOf2(T x) {
57 ASSERT(IsPowerOf2(x)); 56 ASSERT(IsPowerOf2(x));
58 ASSERT(x != 0); 57 ASSERT(x != 0);
59 if (x < 0) return 31;
60 int bits = 0; 58 int bits = 0;
61 #ifdef DEBUG 59 #ifdef DEBUG
62 int original_x = x; 60 int original_x = x;
63 #endif 61 #endif
64 if (x >= 0x10000) { 62 if (x >= 0x10000) {
65 bits += 16; 63 bits += 16;
66 x >>= 16; 64 x >>= 16;
67 } 65 }
68 if (x >= 0x100) { 66 if (x >= 0x100) {
69 bits += 8; 67 bits += 8;
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 }; 782 };
785 783
786 template <class Dest, class Source> 784 template <class Dest, class Source>
787 inline Dest BitCast(const Source& source) { 785 inline Dest BitCast(const Source& source) {
788 return BitCastHelper<Dest, Source>::cast(source); 786 return BitCastHelper<Dest, Source>::cast(source);
789 } 787 }
790 788
791 } } // namespace v8::internal 789 } } // namespace v8::internal
792 790
793 #endif // V8_UTILS_H_ 791 #endif // V8_UTILS_H_
OLDNEW
« src/arm/lithium-codegen-arm.cc ('K') | « src/arm/macro-assembler-arm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698