| 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 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 #include "serialize.h" | 40 #include "serialize.h" |
| 41 | 41 |
| 42 namespace v8 { | 42 namespace v8 { |
| 43 namespace internal { | 43 namespace internal { |
| 44 | 44 |
| 45 // Utility functions | 45 // Utility functions |
| 46 | 46 |
| 47 // Test whether a 64-bit value is in a specific range. | 47 // Test whether a 64-bit value is in a specific range. |
| 48 static inline bool is_uint32(int64_t x) { | 48 static inline bool is_uint32(int64_t x) { |
| 49 static const int64_t kUInt32Mask = V8_INT64_C(0xffffffff); | 49 static const uint64_t kMaxUInt32 = V8_UINT64_C(0xffffffff); |
| 50 return x == (x & kUInt32Mask); | 50 return static_cast<uint64_t>(x) <= kMaxUInt32; |
| 51 } | 51 } |
| 52 | 52 |
| 53 static inline bool is_int32(int64_t x) { | 53 static inline bool is_int32(int64_t x) { |
| 54 static const int64_t kMinIntValue = V8_INT64_C(-0x80000000); | 54 static const int64_t kMinInt32 = -V8_INT64_C(0x80000000); |
| 55 return is_uint32(x - kMinIntValue); | 55 return is_uint32(x - kMinInt32); |
| 56 } | 56 } |
| 57 | 57 |
| 58 static inline bool uint_is_int32(uint64_t x) { | 58 static inline bool uint_is_int32(uint64_t x) { |
| 59 static const uint64_t kMaxIntValue = V8_UINT64_C(0x80000000); | 59 static const uint64_t kMaxInt32 = V8_UINT64_C(0x7fffffff); |
| 60 return x < kMaxIntValue; | 60 return x <= kMaxInt32; |
| 61 } | 61 } |
| 62 | 62 |
| 63 static inline bool is_uint32(uint64_t x) { | 63 static inline bool is_uint32(uint64_t x) { |
| 64 static const uint64_t kMaxUIntValue = V8_UINT64_C(0x100000000); | 64 static const uint64_t kMaxUInt32 = V8_UINT64_C(0xffffffff); |
| 65 return x < kMaxUIntValue; | 65 return x <= kMaxUInt32; |
| 66 } | 66 } |
| 67 | 67 |
| 68 // CPU Registers. | 68 // CPU Registers. |
| 69 // | 69 // |
| 70 // 1) We would prefer to use an enum, but enum values are assignment- | 70 // 1) We would prefer to use an enum, but enum values are assignment- |
| 71 // compatible with int, which has caused code-generation bugs. | 71 // compatible with int, which has caused code-generation bugs. |
| 72 // | 72 // |
| 73 // 2) We would prefer to use a class instead of a struct but we don't like | 73 // 2) We would prefer to use a class instead of a struct but we don't like |
| 74 // the register initialization to depend on the particular initialization | 74 // the register initialization to depend on the particular initialization |
| 75 // order (which appears to be different on OS X, Linux, and Windows for the | 75 // order (which appears to be different on OS X, Linux, and Windows for the |
| (...skipping 1342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1418 private: | 1418 private: |
| 1419 Assembler* assembler_; | 1419 Assembler* assembler_; |
| 1420 #ifdef DEBUG | 1420 #ifdef DEBUG |
| 1421 int space_before_; | 1421 int space_before_; |
| 1422 #endif | 1422 #endif |
| 1423 }; | 1423 }; |
| 1424 | 1424 |
| 1425 } } // namespace v8::internal | 1425 } } // namespace v8::internal |
| 1426 | 1426 |
| 1427 #endif // V8_X64_ASSEMBLER_X64_H_ | 1427 #endif // V8_X64_ASSEMBLER_X64_H_ |
| OLD | NEW |