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 #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. | |
48 inline bool is_uint32(int64_t x) { | |
49 static const uint64_t kMaxUInt32 = V8_UINT64_C(0xffffffff); | |
50 return static_cast<uint64_t>(x) <= kMaxUInt32; | |
51 } | |
52 | |
53 inline bool is_int32(int64_t x) { | |
54 static const int64_t kMinInt32 = -V8_INT64_C(0x80000000); | |
55 return is_uint32(x - kMinInt32); | |
56 } | |
57 | |
58 inline bool uint_is_int32(uint64_t x) { | |
59 static const uint64_t kMaxInt32 = V8_UINT64_C(0x7fffffff); | |
60 return x <= kMaxInt32; | |
61 } | |
62 | |
63 inline bool is_uint32(uint64_t x) { | |
64 static const uint64_t kMaxUInt32 = V8_UINT64_C(0xffffffff); | |
65 return x <= kMaxUInt32; | |
66 } | |
67 | |
68 // CPU Registers. | 47 // CPU Registers. |
69 // | 48 // |
70 // 1) We would prefer to use an enum, but enum values are assignment- | 49 // 1) We would prefer to use an enum, but enum values are assignment- |
71 // compatible with int, which has caused code-generation bugs. | 50 // compatible with int, which has caused code-generation bugs. |
72 // | 51 // |
73 // 2) We would prefer to use a class instead of a struct but we don't like | 52 // 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 | 53 // the register initialization to depend on the particular initialization |
75 // order (which appears to be different on OS X, Linux, and Windows for the | 54 // order (which appears to be different on OS X, Linux, and Windows for the |
76 // installed versions of C++ we tried). Using a struct permits C-style | 55 // installed versions of C++ we tried). Using a struct permits C-style |
77 // "initialization". Also, the Register objects cannot be const as this | 56 // "initialization". Also, the Register objects cannot be const as this |
(...skipping 1675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1753 private: | 1732 private: |
1754 Assembler* assembler_; | 1733 Assembler* assembler_; |
1755 #ifdef DEBUG | 1734 #ifdef DEBUG |
1756 int space_before_; | 1735 int space_before_; |
1757 #endif | 1736 #endif |
1758 }; | 1737 }; |
1759 | 1738 |
1760 } } // namespace v8::internal | 1739 } } // namespace v8::internal |
1761 | 1740 |
1762 #endif // V8_X64_ASSEMBLER_X64_H_ | 1741 #endif // V8_X64_ASSEMBLER_X64_H_ |
OLD | NEW |