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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 // order. | 54 // order. |
55 // | 55 // |
56 // 3) By not using an enum, we are possibly preventing the compiler from | 56 // 3) By not using an enum, we are possibly preventing the compiler from |
57 // doing certain constant folds, which may significantly reduce the | 57 // doing certain constant folds, which may significantly reduce the |
58 // code generated for some assembly instructions (because they boil down | 58 // code generated for some assembly instructions (because they boil down |
59 // to a few constants). If this is a problem, we could change the code | 59 // to a few constants). If this is a problem, we could change the code |
60 // such that we use an enum in optimized mode, and the struct in debug | 60 // such that we use an enum in optimized mode, and the struct in debug |
61 // mode. This way we get the compile-time error checking in debug mode | 61 // mode. This way we get the compile-time error checking in debug mode |
62 // and best performance in optimized code. | 62 // and best performance in optimized code. |
63 // | 63 // |
64 const int kNumRegisters = 16; | |
65 | 64 |
66 struct Register { | 65 struct Register { |
67 bool is_valid() const { return 0 <= code_ && code_ < kNumRegisters; } | 66 bool is_valid() const { return 0 <= code_ && code_ < 16; } |
68 bool is(Register reg) const { return code_ == reg.code_; } | 67 bool is(Register reg) const { return code_ == reg.code_; } |
69 // The byte-register distinction of ai32 has dissapeared. | 68 // The byte-register distinction of ai32 has dissapeared. |
70 bool is_byte_register() const { return false; } | 69 bool is_byte_register() const { return false; } |
71 int code() const { | 70 int code() const { |
72 ASSERT(is_valid()); | 71 ASSERT(is_valid()); |
73 return code_; | 72 return code_; |
74 } | 73 } |
75 int bit() const { | 74 int bit() const { |
76 UNIMPLEMENTED(); | 75 UNIMPLEMENTED(); |
77 return 0; | 76 return 0; |
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
909 private: | 908 private: |
910 Assembler* assembler_; | 909 Assembler* assembler_; |
911 #ifdef DEBUG | 910 #ifdef DEBUG |
912 int space_before_; | 911 int space_before_; |
913 #endif | 912 #endif |
914 }; | 913 }; |
915 | 914 |
916 } } // namespace v8::internal | 915 } } // namespace v8::internal |
917 | 916 |
918 #endif // V8_X64_ASSEMBLER_X64_H_ | 917 #endif // V8_X64_ASSEMBLER_X64_H_ |
OLD | NEW |