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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 108 return code_ >> 3; | 108 return code_ >> 3; |
| 109 } | 109 } |
| 110 // Return the 3 low bits of the register code. Used when encoding registers | 110 // Return the 3 low bits of the register code. Used when encoding registers |
| 111 // in modR/M, SIB, and opcode bytes. | 111 // in modR/M, SIB, and opcode bytes. |
| 112 int low_bits() const { | 112 int low_bits() const { |
| 113 return code_ & 0x7; | 113 return code_ & 0x7; |
| 114 } | 114 } |
| 115 | 115 |
| 116 // Unfortunately we can't make this private in a struct when initializing | 116 // Unfortunately we can't make this private in a struct when initializing |
| 117 // by assignment. | 117 // by assignment. |
| 118 int code_; | 118 int code_; |
|
Lasse Reichstein
2010/02/22 11:36:40
Could we make it const?
William Hesse
2010/02/22 11:41:08
The whole struct is const in all its accessors. W
| |
| 119 }; | 119 }; |
| 120 | 120 |
| 121 extern Register rax; | 121 const Register rax = { 0 }; |
| 122 extern Register rcx; | 122 const Register rcx = { 1 }; |
| 123 extern Register rdx; | 123 const Register rdx = { 2 }; |
| 124 extern Register rbx; | 124 const Register rbx = { 3 }; |
| 125 extern Register rsp; | 125 const Register rsp = { 4 }; |
| 126 extern Register rbp; | 126 const Register rbp = { 5 }; |
| 127 extern Register rsi; | 127 const Register rsi = { 6 }; |
| 128 extern Register rdi; | 128 const Register rdi = { 7 }; |
| 129 extern Register r8; | 129 const Register r8 = { 8 }; |
| 130 extern Register r9; | 130 const Register r9 = { 9 }; |
| 131 extern Register r10; | 131 const Register r10 = { 10 }; |
| 132 extern Register r11; | 132 const Register r11 = { 11 }; |
| 133 extern Register r12; | 133 const Register r12 = { 12 }; |
| 134 extern Register r13; | 134 const Register r13 = { 13 }; |
| 135 extern Register r14; | 135 const Register r14 = { 14 }; |
| 136 extern Register r15; | 136 const Register r15 = { 15 }; |
| 137 extern Register no_reg; | 137 const Register no_reg = { -1 }; |
| 138 | |
| 139 | |
| 140 struct MMXRegister { | |
| 141 bool is_valid() const { return 0 <= code_ && code_ < 2; } | |
| 142 int code() const { | |
| 143 ASSERT(is_valid()); | |
| 144 return code_; | |
| 145 } | |
| 146 | |
| 147 int code_; | |
| 148 }; | |
| 149 | |
| 150 extern MMXRegister mm0; | |
| 151 extern MMXRegister mm1; | |
| 152 extern MMXRegister mm2; | |
| 153 extern MMXRegister mm3; | |
| 154 extern MMXRegister mm4; | |
| 155 extern MMXRegister mm5; | |
| 156 extern MMXRegister mm6; | |
| 157 extern MMXRegister mm7; | |
| 158 extern MMXRegister mm8; | |
| 159 extern MMXRegister mm9; | |
| 160 extern MMXRegister mm10; | |
| 161 extern MMXRegister mm11; | |
| 162 extern MMXRegister mm12; | |
| 163 extern MMXRegister mm13; | |
| 164 extern MMXRegister mm14; | |
| 165 extern MMXRegister mm15; | |
|
Lasse Reichstein
2010/02/22 11:36:40
And good riddance to MMX!
| |
| 166 | 138 |
| 167 | 139 |
| 168 struct XMMRegister { | 140 struct XMMRegister { |
| 169 bool is_valid() const { return 0 <= code_ && code_ < 16; } | 141 bool is_valid() const { return 0 <= code_ && code_ < 16; } |
| 170 int code() const { | 142 int code() const { |
| 171 ASSERT(is_valid()); | 143 ASSERT(is_valid()); |
| 172 return code_; | 144 return code_; |
| 173 } | 145 } |
| 174 | 146 |
| 175 // Return the high bit of the register code as a 0 or 1. Used often | 147 // Return the high bit of the register code as a 0 or 1. Used often |
| 176 // when constructing the REX prefix byte. | 148 // when constructing the REX prefix byte. |
| 177 int high_bit() const { | 149 int high_bit() const { |
| 178 return code_ >> 3; | 150 return code_ >> 3; |
| 179 } | 151 } |
| 180 // Return the 3 low bits of the register code. Used when encoding registers | 152 // Return the 3 low bits of the register code. Used when encoding registers |
| 181 // in modR/M, SIB, and opcode bytes. | 153 // in modR/M, SIB, and opcode bytes. |
| 182 int low_bits() const { | 154 int low_bits() const { |
| 183 return code_ & 0x7; | 155 return code_ & 0x7; |
| 184 } | 156 } |
| 185 | 157 |
| 186 int code_; | 158 int code_; |
| 187 }; | 159 }; |
| 188 | 160 |
| 189 extern XMMRegister xmm0; | 161 const XMMRegister xmm0 = { 0 }; |
| 190 extern XMMRegister xmm1; | 162 const XMMRegister xmm1 = { 1 }; |
| 191 extern XMMRegister xmm2; | 163 const XMMRegister xmm2 = { 2 }; |
| 192 extern XMMRegister xmm3; | 164 const XMMRegister xmm3 = { 3 }; |
| 193 extern XMMRegister xmm4; | 165 const XMMRegister xmm4 = { 4 }; |
| 194 extern XMMRegister xmm5; | 166 const XMMRegister xmm5 = { 5 }; |
| 195 extern XMMRegister xmm6; | 167 const XMMRegister xmm6 = { 6 }; |
| 196 extern XMMRegister xmm7; | 168 const XMMRegister xmm7 = { 7 }; |
| 197 extern XMMRegister xmm8; | 169 const XMMRegister xmm8 = { 8 }; |
| 198 extern XMMRegister xmm9; | 170 const XMMRegister xmm9 = { 9 }; |
| 199 extern XMMRegister xmm10; | 171 const XMMRegister xmm10 = { 10 }; |
| 200 extern XMMRegister xmm11; | 172 const XMMRegister xmm11 = { 11 }; |
| 201 extern XMMRegister xmm12; | 173 const XMMRegister xmm12 = { 12 }; |
| 202 extern XMMRegister xmm13; | 174 const XMMRegister xmm13 = { 13 }; |
| 203 extern XMMRegister xmm14; | 175 const XMMRegister xmm14 = { 14 }; |
| 204 extern XMMRegister xmm15; | 176 const XMMRegister xmm15 = { 15 }; |
| 205 | 177 |
| 206 enum Condition { | 178 enum Condition { |
| 207 // any value < 0 is considered no_condition | 179 // any value < 0 is considered no_condition |
| 208 no_condition = -1, | 180 no_condition = -1, |
| 209 | 181 |
| 210 overflow = 0, | 182 overflow = 0, |
| 211 no_overflow = 1, | 183 no_overflow = 1, |
| 212 below = 2, | 184 below = 2, |
| 213 above_equal = 3, | 185 above_equal = 3, |
| 214 equal = 4, | 186 equal = 4, |
| (...skipping 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1401 private: | 1373 private: |
| 1402 Assembler* assembler_; | 1374 Assembler* assembler_; |
| 1403 #ifdef DEBUG | 1375 #ifdef DEBUG |
| 1404 int space_before_; | 1376 int space_before_; |
| 1405 #endif | 1377 #endif |
| 1406 }; | 1378 }; |
| 1407 | 1379 |
| 1408 } } // namespace v8::internal | 1380 } } // namespace v8::internal |
| 1409 | 1381 |
| 1410 #endif // V8_X64_ASSEMBLER_X64_H_ | 1382 #endif // V8_X64_ASSEMBLER_X64_H_ |
| OLD | NEW |