Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. | 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. |
| 2 // All Rights Reserved. | 2 // All Rights Reserved. |
| 3 // | 3 // |
| 4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
| 5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
| 6 // met: | 6 // met: |
| 7 // | 7 // |
| 8 // - Redistributions of source code must retain the above copyright notice, | 8 // - Redistributions of source code must retain the above copyright notice, |
| 9 // this list of conditions and the following disclaimer. | 9 // this list of conditions and the following disclaimer. |
| 10 // | 10 // |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 37 #ifndef V8_X64_ASSEMBLER_X64_H_ | 37 #ifndef V8_X64_ASSEMBLER_X64_H_ |
| 38 #define V8_X64_ASSEMBLER_X64_H_ | 38 #define V8_X64_ASSEMBLER_X64_H_ |
| 39 | 39 |
| 40 namespace v8 { | 40 namespace v8 { |
| 41 namespace internal { | 41 namespace internal { |
| 42 | 42 |
| 43 // Utility functions | 43 // Utility functions |
| 44 | 44 |
| 45 // Test whether a 64-bit value is in a specific range. | 45 // Test whether a 64-bit value is in a specific range. |
| 46 static inline bool is_uint32(int64_t x) { | 46 static inline bool is_uint32(int64_t x) { |
| 47 const int64_t kUInt32Mask = V8_INT64_C(0xffffffff); | 47 static const int64_t kUInt32Mask = V8_INT64_C(0xffffffff); |
| 48 return x == (x & kUInt32Mask); | 48 return x == (x & kUInt32Mask); |
| 49 } | 49 } |
| 50 | 50 |
| 51 static inline bool is_int32(int64_t x) { | 51 static inline bool is_int32(int64_t x) { |
| 52 const int64_t kMinIntValue = V8_INT64_C(-0x80000000); | 52 static const int64_t kMinIntValue = V8_INT64_C(-0x80000000); |
| 53 return is_uint32(x - kMinIntValue); | 53 return is_uint32(x - kMinIntValue); |
| 54 } | 54 } |
| 55 | 55 |
| 56 static inline bool is_int32(uint64_t x) { | |
|
William Hesse
2009/08/03 09:03:28
I can forsee a bug happening because of this funct
Lasse Reichstein
2009/08/03 10:45:45
I'm not sure we shouldn't find a better way to bit
| |
| 57 static const uint64_t kMaxIntValue = V8_UINT64_C(0x80000000); | |
| 58 return x < kMaxIntValue; | |
| 59 } | |
| 60 | |
| 61 static inline bool is_uint32(uint64_t x) { | |
| 62 static const uint64_t kMaxUIntValue = V8_UINT64_C(0x100000000); | |
| 63 return x < kMaxUIntValue; | |
| 64 } | |
| 65 | |
| 56 // CPU Registers. | 66 // CPU Registers. |
| 57 // | 67 // |
| 58 // 1) We would prefer to use an enum, but enum values are assignment- | 68 // 1) We would prefer to use an enum, but enum values are assignment- |
| 59 // compatible with int, which has caused code-generation bugs. | 69 // compatible with int, which has caused code-generation bugs. |
| 60 // | 70 // |
| 61 // 2) We would prefer to use a class instead of a struct but we don't like | 71 // 2) We would prefer to use a class instead of a struct but we don't like |
| 62 // the register initialization to depend on the particular initialization | 72 // the register initialization to depend on the particular initialization |
| 63 // order (which appears to be different on OS X, Linux, and Windows for the | 73 // order (which appears to be different on OS X, Linux, and Windows for the |
| 64 // installed versions of C++ we tried). Using a struct permits C-style | 74 // installed versions of C++ we tried). Using a struct permits C-style |
| 65 // "initialization". Also, the Register objects cannot be const as this | 75 // "initialization". Also, the Register objects cannot be const as this |
| (...skipping 1150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1216 private: | 1226 private: |
| 1217 Assembler* assembler_; | 1227 Assembler* assembler_; |
| 1218 #ifdef DEBUG | 1228 #ifdef DEBUG |
| 1219 int space_before_; | 1229 int space_before_; |
| 1220 #endif | 1230 #endif |
| 1221 }; | 1231 }; |
| 1222 | 1232 |
| 1223 } } // namespace v8::internal | 1233 } } // namespace v8::internal |
| 1224 | 1234 |
| 1225 #endif // V8_X64_ASSEMBLER_X64_H_ | 1235 #endif // V8_X64_ASSEMBLER_X64_H_ |
| OLD | NEW |