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 27 matching lines...) Expand all Loading... |
38 #define V8_X64_ASSEMBLER_X64_H_ | 38 #define V8_X64_ASSEMBLER_X64_H_ |
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 inline bool is_uint32(int64_t x) { |
49 static const uint64_t kMaxUInt32 = V8_UINT64_C(0xffffffff); | 49 static const uint64_t kMaxUInt32 = V8_UINT64_C(0xffffffff); |
50 return static_cast<uint64_t>(x) <= kMaxUInt32; | 50 return static_cast<uint64_t>(x) <= kMaxUInt32; |
51 } | 51 } |
52 | 52 |
53 static inline bool is_int32(int64_t x) { | 53 inline bool is_int32(int64_t x) { |
54 static const int64_t kMinInt32 = -V8_INT64_C(0x80000000); | 54 static const int64_t kMinInt32 = -V8_INT64_C(0x80000000); |
55 return is_uint32(x - kMinInt32); | 55 return is_uint32(x - kMinInt32); |
56 } | 56 } |
57 | 57 |
58 static inline bool uint_is_int32(uint64_t x) { | 58 inline bool uint_is_int32(uint64_t x) { |
59 static const uint64_t kMaxInt32 = V8_UINT64_C(0x7fffffff); | 59 static const uint64_t kMaxInt32 = V8_UINT64_C(0x7fffffff); |
60 return x <= kMaxInt32; | 60 return x <= kMaxInt32; |
61 } | 61 } |
62 | 62 |
63 static inline bool is_uint32(uint64_t x) { | 63 inline bool is_uint32(uint64_t x) { |
64 static const uint64_t kMaxUInt32 = V8_UINT64_C(0xffffffff); | 64 static const uint64_t kMaxUInt32 = V8_UINT64_C(0xffffffff); |
65 return x <= kMaxUInt32; | 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 |
(...skipping 1566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1640 private: | 1640 private: |
1641 Assembler* assembler_; | 1641 Assembler* assembler_; |
1642 #ifdef DEBUG | 1642 #ifdef DEBUG |
1643 int space_before_; | 1643 int space_before_; |
1644 #endif | 1644 #endif |
1645 }; | 1645 }; |
1646 | 1646 |
1647 } } // namespace v8::internal | 1647 } } // namespace v8::internal |
1648 | 1648 |
1649 #endif // V8_X64_ASSEMBLER_X64_H_ | 1649 #endif // V8_X64_ASSEMBLER_X64_H_ |
OLD | NEW |