Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(288)

Side by Side Diff: src/mips/assembler-mips.h

Issue 2733503003: [assembler] Make register definitions constexpr (Closed)
Patch Set: [assembler] Make register definitions constexpr Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/ia32/assembler-ia32.h ('k') | src/mips/macro-assembler-mips.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 // to a few constants). If this is a problem, we could change the code 90 // to a few constants). If this is a problem, we could change the code
91 // such that we use an enum in optimized mode, and the struct in debug 91 // such that we use an enum in optimized mode, and the struct in debug
92 // mode. This way we get the compile-time error checking in debug mode 92 // mode. This way we get the compile-time error checking in debug mode
93 // and best performance in optimized code. 93 // and best performance in optimized code.
94 94
95 95
96 // ----------------------------------------------------------------------------- 96 // -----------------------------------------------------------------------------
97 // Implementation of Register and FPURegister. 97 // Implementation of Register and FPURegister.
98 98
99 struct Register { 99 struct Register {
100 static const int kCpRegister = 23; // cp (s7) is the 23rd register. 100 static constexpr int kCpRegister = 23; // cp (s7) is the 23rd register.
101 101
102 enum Code { 102 enum Code {
103 #define REGISTER_CODE(R) kCode_##R, 103 #define REGISTER_CODE(R) kCode_##R,
104 GENERAL_REGISTERS(REGISTER_CODE) 104 GENERAL_REGISTERS(REGISTER_CODE)
105 #undef REGISTER_CODE 105 #undef REGISTER_CODE
106 kAfterLast, 106 kAfterLast,
107 kCode_no_reg = -1 107 kCode_no_reg = -1
108 }; 108 };
109 109
110 static const int kNumRegisters = Code::kAfterLast; 110 static constexpr int kNumRegisters = Code::kAfterLast;
111 111
112 #if defined(V8_TARGET_LITTLE_ENDIAN) 112 #if defined(V8_TARGET_LITTLE_ENDIAN)
113 static const int kMantissaOffset = 0; 113 static constexpr int kMantissaOffset = 0;
114 static const int kExponentOffset = 4; 114 static constexpr int kExponentOffset = 4;
115 #elif defined(V8_TARGET_BIG_ENDIAN) 115 #elif defined(V8_TARGET_BIG_ENDIAN)
116 static const int kMantissaOffset = 4; 116 static constexpr int kMantissaOffset = 4;
117 static const int kExponentOffset = 0; 117 static constexpr int kExponentOffset = 0;
118 #else 118 #else
119 #error Unknown endianness 119 #error Unknown endianness
120 #endif 120 #endif
121 121
122 122
123 static Register from_code(int code) { 123 static Register from_code(int code) {
124 DCHECK(code >= 0); 124 DCHECK_LE(0, code);
125 DCHECK(code < kNumRegisters); 125 DCHECK_GT(kNumRegisters, code);
126 Register r = {code}; 126 return Register{code};
127 return r;
128 } 127 }
129 bool is_valid() const { return 0 <= reg_code && reg_code < kNumRegisters; } 128 bool is_valid() const { return 0 <= reg_code && reg_code < kNumRegisters; }
130 bool is(Register reg) const { return reg_code == reg.reg_code; } 129 bool is(Register reg) const { return reg_code == reg.reg_code; }
131 int code() const { 130 int code() const {
132 DCHECK(is_valid()); 131 DCHECK(is_valid());
133 return reg_code; 132 return reg_code;
134 } 133 }
135 int bit() const { 134 int bit() const {
136 DCHECK(is_valid()); 135 DCHECK(is_valid());
137 return 1 << reg_code; 136 return 1 << reg_code;
138 } 137 }
139 138
140 // Unfortunately we can't make this private in a struct. 139 // Unfortunately we can't make this private in a struct.
141 int reg_code; 140 int reg_code;
142 }; 141 };
143 142
144 // s7: context register 143 // s7: context register
145 // s3: lithium scratch 144 // s3: lithium scratch
146 // s4: lithium scratch2 145 // s4: lithium scratch2
147 #define DECLARE_REGISTER(R) const Register R = {Register::kCode_##R}; 146 #define DECLARE_REGISTER(R) constexpr Register R = {Register::kCode_##R};
148 GENERAL_REGISTERS(DECLARE_REGISTER) 147 GENERAL_REGISTERS(DECLARE_REGISTER)
149 #undef DECLARE_REGISTER 148 #undef DECLARE_REGISTER
150 const Register no_reg = {Register::kCode_no_reg}; 149 constexpr Register no_reg = {Register::kCode_no_reg};
151
152 150
153 int ToNumber(Register reg); 151 int ToNumber(Register reg);
154 152
155 Register ToRegister(int num); 153 Register ToRegister(int num);
156 154
157 static const bool kSimpleFPAliasing = true; 155 constexpr bool kSimpleFPAliasing = true;
158 static const bool kSimdMaskRegisters = false; 156 constexpr bool kSimdMaskRegisters = false;
159 157
160 // Coprocessor register. 158 // Coprocessor register.
161 struct FPURegister { 159 struct FPURegister {
162 enum Code { 160 enum Code {
163 #define REGISTER_CODE(R) kCode_##R, 161 #define REGISTER_CODE(R) kCode_##R,
164 DOUBLE_REGISTERS(REGISTER_CODE) 162 DOUBLE_REGISTERS(REGISTER_CODE)
165 #undef REGISTER_CODE 163 #undef REGISTER_CODE
166 kAfterLast, 164 kAfterLast,
167 kCode_no_reg = -1 165 kCode_no_reg = -1
168 }; 166 };
169 167
170 static const int kMaxNumRegisters = Code::kAfterLast; 168 static constexpr int kMaxNumRegisters = Code::kAfterLast;
171 169
172 inline static int NumRegisters(); 170 inline static int NumRegisters();
173 171
174 // TODO(plind): Warning, inconsistent numbering here. kNumFPURegisters refers 172 // TODO(plind): Warning, inconsistent numbering here. kNumFPURegisters refers
175 // to number of 32-bit FPU regs, but kNumAllocatableRegisters refers to 173 // to number of 32-bit FPU regs, but kNumAllocatableRegisters refers to
176 // number of Double regs (64-bit regs, or FPU-reg-pairs). 174 // number of Double regs (64-bit regs, or FPU-reg-pairs).
177 175
178 bool is_valid() const { return 0 <= reg_code && reg_code < kMaxNumRegisters; } 176 bool is_valid() const { return 0 <= reg_code && reg_code < kMaxNumRegisters; }
179 bool is(FPURegister reg) const { return reg_code == reg.reg_code; } 177 bool is(FPURegister reg) const { return reg_code == reg.reg_code; }
180 FPURegister low() const { 178 FPURegister low() const {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 // but it is not in common use. Someday we will want to support this in v8.) 227 // but it is not in common use. Someday we will want to support this in v8.)
230 228
231 // For O32 ABI, Floats and Doubles refer to same set of 32 32-bit registers. 229 // For O32 ABI, Floats and Doubles refer to same set of 32 32-bit registers.
232 typedef FPURegister FloatRegister; 230 typedef FPURegister FloatRegister;
233 231
234 typedef FPURegister DoubleRegister; 232 typedef FPURegister DoubleRegister;
235 233
236 // TODO(mips) Define SIMD registers. 234 // TODO(mips) Define SIMD registers.
237 typedef FPURegister Simd128Register; 235 typedef FPURegister Simd128Register;
238 236
239 const DoubleRegister no_freg = {-1}; 237 constexpr DoubleRegister no_freg = {-1};
240 238
241 const DoubleRegister f0 = {0}; // Return value in hard float mode. 239 constexpr DoubleRegister f0 = {0}; // Return value in hard float mode.
242 const DoubleRegister f1 = {1}; 240 constexpr DoubleRegister f1 = {1};
243 const DoubleRegister f2 = {2}; 241 constexpr DoubleRegister f2 = {2};
244 const DoubleRegister f3 = {3}; 242 constexpr DoubleRegister f3 = {3};
245 const DoubleRegister f4 = {4}; 243 constexpr DoubleRegister f4 = {4};
246 const DoubleRegister f5 = {5}; 244 constexpr DoubleRegister f5 = {5};
247 const DoubleRegister f6 = {6}; 245 constexpr DoubleRegister f6 = {6};
248 const DoubleRegister f7 = {7}; 246 constexpr DoubleRegister f7 = {7};
249 const DoubleRegister f8 = {8}; 247 constexpr DoubleRegister f8 = {8};
250 const DoubleRegister f9 = {9}; 248 constexpr DoubleRegister f9 = {9};
251 const DoubleRegister f10 = {10}; 249 constexpr DoubleRegister f10 = {10};
252 const DoubleRegister f11 = {11}; 250 constexpr DoubleRegister f11 = {11};
253 const DoubleRegister f12 = {12}; // Arg 0 in hard float mode. 251 constexpr DoubleRegister f12 = {12}; // Arg 0 in hard float mode.
254 const DoubleRegister f13 = {13}; 252 constexpr DoubleRegister f13 = {13};
255 const DoubleRegister f14 = {14}; // Arg 1 in hard float mode. 253 constexpr DoubleRegister f14 = {14}; // Arg 1 in hard float mode.
256 const DoubleRegister f15 = {15}; 254 constexpr DoubleRegister f15 = {15};
257 const DoubleRegister f16 = {16}; 255 constexpr DoubleRegister f16 = {16};
258 const DoubleRegister f17 = {17}; 256 constexpr DoubleRegister f17 = {17};
259 const DoubleRegister f18 = {18}; 257 constexpr DoubleRegister f18 = {18};
260 const DoubleRegister f19 = {19}; 258 constexpr DoubleRegister f19 = {19};
261 const DoubleRegister f20 = {20}; 259 constexpr DoubleRegister f20 = {20};
262 const DoubleRegister f21 = {21}; 260 constexpr DoubleRegister f21 = {21};
263 const DoubleRegister f22 = {22}; 261 constexpr DoubleRegister f22 = {22};
264 const DoubleRegister f23 = {23}; 262 constexpr DoubleRegister f23 = {23};
265 const DoubleRegister f24 = {24}; 263 constexpr DoubleRegister f24 = {24};
266 const DoubleRegister f25 = {25}; 264 constexpr DoubleRegister f25 = {25};
267 const DoubleRegister f26 = {26}; 265 constexpr DoubleRegister f26 = {26};
268 const DoubleRegister f27 = {27}; 266 constexpr DoubleRegister f27 = {27};
269 const DoubleRegister f28 = {28}; 267 constexpr DoubleRegister f28 = {28};
270 const DoubleRegister f29 = {29}; 268 constexpr DoubleRegister f29 = {29};
271 const DoubleRegister f30 = {30}; 269 constexpr DoubleRegister f30 = {30};
272 const DoubleRegister f31 = {31}; 270 constexpr DoubleRegister f31 = {31};
273 271
274 // Register aliases. 272 // Register aliases.
275 // cp is assumed to be a callee saved register. 273 // cp is assumed to be a callee saved register.
276 // Defined using #define instead of "static const Register&" because Clang 274 constexpr Register kRootRegister = s6;
277 // complains otherwise when a compilation unit that includes this header 275 constexpr Register cp = s7;
278 // doesn't use the variables. 276 constexpr Register kLithiumScratchReg = s3;
279 #define kRootRegister s6 277 constexpr Register kLithiumScratchReg2 = s4;
280 #define cp s7 278 constexpr DoubleRegister kLithiumScratchDouble = f30;
281 #define kLithiumScratchReg s3 279 constexpr DoubleRegister kDoubleRegZero = f28;
282 #define kLithiumScratchReg2 s4
283 #define kLithiumScratchDouble f30
284 #define kDoubleRegZero f28
285 // Used on mips32r6 for compare operations. 280 // Used on mips32r6 for compare operations.
286 #define kDoubleCompareReg f26 281 constexpr DoubleRegister kDoubleCompareReg = f26;
287 282
288 // FPU (coprocessor 1) control registers. 283 // FPU (coprocessor 1) control registers.
289 // Currently only FCSR (#31) is implemented. 284 // Currently only FCSR (#31) is implemented.
290 struct FPUControlRegister { 285 struct FPUControlRegister {
291 bool is_valid() const { return reg_code == kFCSRRegister; } 286 bool is_valid() const { return reg_code == kFCSRRegister; }
292 bool is(FPUControlRegister creg) const { return reg_code == creg.reg_code; } 287 bool is(FPUControlRegister creg) const { return reg_code == creg.reg_code; }
293 int code() const { 288 int code() const {
294 DCHECK(is_valid()); 289 DCHECK(is_valid());
295 return reg_code; 290 return reg_code;
296 } 291 }
297 int bit() const { 292 int bit() const {
298 DCHECK(is_valid()); 293 DCHECK(is_valid());
299 return 1 << reg_code; 294 return 1 << reg_code;
300 } 295 }
301 void setcode(int f) { 296 void setcode(int f) {
302 reg_code = f; 297 reg_code = f;
303 DCHECK(is_valid()); 298 DCHECK(is_valid());
304 } 299 }
305 // Unfortunately we can't make this private in a struct. 300 // Unfortunately we can't make this private in a struct.
306 int reg_code; 301 int reg_code;
307 }; 302 };
308 303
309 const FPUControlRegister no_fpucreg = { kInvalidFPUControlRegister }; 304 constexpr FPUControlRegister no_fpucreg = {kInvalidFPUControlRegister};
310 const FPUControlRegister FCSR = { kFCSRRegister }; 305 constexpr FPUControlRegister FCSR = {kFCSRRegister};
311 306
312 // ----------------------------------------------------------------------------- 307 // -----------------------------------------------------------------------------
313 // Machine instruction Operands. 308 // Machine instruction Operands.
314 309
315 // Class Operand represents a shifter operand in data processing instructions. 310 // Class Operand represents a shifter operand in data processing instructions.
316 class Operand BASE_EMBEDDED { 311 class Operand BASE_EMBEDDED {
317 public: 312 public:
318 // Immediate. 313 // Immediate.
319 INLINE(explicit Operand(int32_t immediate, 314 INLINE(explicit Operand(int32_t immediate,
320 RelocInfo::Mode rmode = RelocInfo::NONE32)); 315 RelocInfo::Mode rmode = RelocInfo::NONE32));
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 instruction_payload - kInstructionsFor32BitConstant * kInstrSize, code, 490 instruction_payload - kInstructionsFor32BitConstant * kInstrSize, code,
496 target); 491 target);
497 } 492 }
498 493
499 // This sets the internal reference at the pc. 494 // This sets the internal reference at the pc.
500 inline static void deserialization_set_target_internal_reference_at( 495 inline static void deserialization_set_target_internal_reference_at(
501 Isolate* isolate, Address pc, Address target, 496 Isolate* isolate, Address pc, Address target,
502 RelocInfo::Mode mode = RelocInfo::INTERNAL_REFERENCE); 497 RelocInfo::Mode mode = RelocInfo::INTERNAL_REFERENCE);
503 498
504 // Size of an instruction. 499 // Size of an instruction.
505 static const int kInstrSize = sizeof(Instr); 500 static constexpr int kInstrSize = sizeof(Instr);
506 501
507 // Difference between address of current opcode and target address offset. 502 // Difference between address of current opcode and target address offset.
508 static const int kBranchPCOffset = 4; 503 static constexpr int kBranchPCOffset = 4;
509 504
510 // Here we are patching the address in the LUI/ORI instruction pair. 505 // Here we are patching the address in the LUI/ORI instruction pair.
511 // These values are used in the serialization process and must be zero for 506 // These values are used in the serialization process and must be zero for
512 // MIPS platform, as Code, Embedded Object or External-reference pointers 507 // MIPS platform, as Code, Embedded Object or External-reference pointers
513 // are split across two consecutive instructions and don't exist separately 508 // are split across two consecutive instructions and don't exist separately
514 // in the code, so the serializer should not step forwards in memory after 509 // in the code, so the serializer should not step forwards in memory after
515 // a target is resolved and written. 510 // a target is resolved and written.
516 static const int kSpecialTargetSize = 0; 511 static constexpr int kSpecialTargetSize = 0;
517 512
518 // Number of consecutive instructions used to store 32bit constant. This 513 // Number of consecutive instructions used to store 32bit constant. This
519 // constant is used in RelocInfo::target_address_address() function to tell 514 // constant is used in RelocInfo::target_address_address() function to tell
520 // serializer address of the instruction that follows LUI/ORI instruction 515 // serializer address of the instruction that follows LUI/ORI instruction
521 // pair. 516 // pair.
522 static const int kInstructionsFor32BitConstant = 2; 517 static constexpr int kInstructionsFor32BitConstant = 2;
523 518
524 // Distance between the instruction referring to the address of the call 519 // Distance between the instruction referring to the address of the call
525 // target and the return address. 520 // target and the return address.
526 #ifdef _MIPS_ARCH_MIPS32R6 521 #ifdef _MIPS_ARCH_MIPS32R6
527 static const int kCallTargetAddressOffset = 3 * kInstrSize; 522 static constexpr int kCallTargetAddressOffset = 3 * kInstrSize;
528 #else 523 #else
529 static const int kCallTargetAddressOffset = 4 * kInstrSize; 524 static constexpr int kCallTargetAddressOffset = 4 * kInstrSize;
530 #endif 525 #endif
531 526
532 // Distance between start of patched debug break slot and the emitted address 527 // Distance between start of patched debug break slot and the emitted address
533 // to jump to. 528 // to jump to.
534 static const int kPatchDebugBreakSlotAddressOffset = 4 * kInstrSize; 529 static constexpr int kPatchDebugBreakSlotAddressOffset = 4 * kInstrSize;
535 530
536 // Difference between address of current opcode and value read from pc 531 // Difference between address of current opcode and value read from pc
537 // register. 532 // register.
538 static const int kPcLoadDelta = 4; 533 static constexpr int kPcLoadDelta = 4;
539 534
540 #ifdef _MIPS_ARCH_MIPS32R6 535 #ifdef _MIPS_ARCH_MIPS32R6
541 static const int kDebugBreakSlotInstructions = 3; 536 static constexpr int kDebugBreakSlotInstructions = 3;
542 #else 537 #else
543 static const int kDebugBreakSlotInstructions = 4; 538 static constexpr int kDebugBreakSlotInstructions = 4;
544 #endif 539 #endif
545 static const int kDebugBreakSlotLength = 540 static constexpr int kDebugBreakSlotLength =
546 kDebugBreakSlotInstructions * kInstrSize; 541 kDebugBreakSlotInstructions * kInstrSize;
547 542
548 // Max offset for instructions with 16-bit offset field 543 // Max offset for instructions with 16-bit offset field
549 static const int kMaxBranchOffset = (1 << (18 - 1)) - 1; 544 static constexpr int kMaxBranchOffset = (1 << (18 - 1)) - 1;
550 545
551 // Max offset for compact branch instructions with 26-bit offset field 546 // Max offset for compact branch instructions with 26-bit offset field
552 static const int kMaxCompactBranchOffset = (1 << (28 - 1)) - 1; 547 static constexpr int kMaxCompactBranchOffset = (1 << (28 - 1)) - 1;
553 548
554 #ifdef _MIPS_ARCH_MIPS32R6 549 #ifdef _MIPS_ARCH_MIPS32R6
555 static const int kTrampolineSlotsSize = 2 * kInstrSize; 550 static constexpr int kTrampolineSlotsSize = 2 * kInstrSize;
556 #else 551 #else
557 static const int kTrampolineSlotsSize = 4 * kInstrSize; 552 static constexpr int kTrampolineSlotsSize = 4 * kInstrSize;
558 #endif 553 #endif
559 554
560 // --------------------------------------------------------------------------- 555 // ---------------------------------------------------------------------------
561 // Code generation. 556 // Code generation.
562 557
563 // Insert the smallest number of nop instructions 558 // Insert the smallest number of nop instructions
564 // possible to align the pc offset to a multiple 559 // possible to align the pc offset to a multiple
565 // of m. m must be a power of 2 (>= 4). 560 // of m. m must be a power of 2 (>= 4).
566 void Align(int m); 561 void Align(int m);
567 // Insert the smallest number of zero bytes possible to align the pc offset 562 // Insert the smallest number of zero bytes possible to align the pc offset
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
1256 inline void CheckTrampolinePoolQuick(int extra_instructions = 0); 1251 inline void CheckTrampolinePoolQuick(int extra_instructions = 0);
1257 1252
1258 inline void CheckBuffer(); 1253 inline void CheckBuffer();
1259 1254
1260 private: 1255 private:
1261 inline static void set_target_internal_reference_encoded_at(Address pc, 1256 inline static void set_target_internal_reference_encoded_at(Address pc,
1262 Address target); 1257 Address target);
1263 1258
1264 // Buffer size and constant pool distance are checked together at regular 1259 // Buffer size and constant pool distance are checked together at regular
1265 // intervals of kBufferCheckInterval emitted bytes. 1260 // intervals of kBufferCheckInterval emitted bytes.
1266 static const int kBufferCheckInterval = 1*KB/2; 1261 static constexpr int kBufferCheckInterval = 1 * KB / 2;
1267 1262
1268 // Code generation. 1263 // Code generation.
1269 // The relocation writer's position is at least kGap bytes below the end of 1264 // The relocation writer's position is at least kGap bytes below the end of
1270 // the generated instructions. This is so that multi-instruction sequences do 1265 // the generated instructions. This is so that multi-instruction sequences do
1271 // not have to check for overflow. The same is true for writes of large 1266 // not have to check for overflow. The same is true for writes of large
1272 // relocation info entries. 1267 // relocation info entries.
1273 static const int kGap = 32; 1268 static constexpr int kGap = 32;
1274
1275 1269
1276 // Repeated checking whether the trampoline pool should be emitted is rather 1270 // Repeated checking whether the trampoline pool should be emitted is rather
1277 // expensive. By default we only check again once a number of instructions 1271 // expensive. By default we only check again once a number of instructions
1278 // has been generated. 1272 // has been generated.
1279 static const int kCheckConstIntervalInst = 32; 1273 static constexpr int kCheckConstIntervalInst = 32;
1280 static const int kCheckConstInterval = kCheckConstIntervalInst * kInstrSize; 1274 static constexpr int kCheckConstInterval =
1275 kCheckConstIntervalInst * kInstrSize;
1281 1276
1282 int next_buffer_check_; // pc offset of next buffer check. 1277 int next_buffer_check_; // pc offset of next buffer check.
1283 1278
1284 // Emission of the trampoline pool may be blocked in some code sequences. 1279 // Emission of the trampoline pool may be blocked in some code sequences.
1285 int trampoline_pool_blocked_nesting_; // Block emission if this is not zero. 1280 int trampoline_pool_blocked_nesting_; // Block emission if this is not zero.
1286 int no_trampoline_pool_before_; // Block emission before this pc offset. 1281 int no_trampoline_pool_before_; // Block emission before this pc offset.
1287 1282
1288 // Keep track of the last emitted pool to guarantee a maximal distance. 1283 // Keep track of the last emitted pool to guarantee a maximal distance.
1289 int last_trampoline_pool_end_; // pc offset of the end of the last pool. 1284 int last_trampoline_pool_end_; // pc offset of the end of the last pool.
1290 1285
1291 // Automatic growth of the assembly buffer may be blocked for some sequences. 1286 // Automatic growth of the assembly buffer may be blocked for some sequences.
1292 bool block_buffer_growth_; // Block growth when true. 1287 bool block_buffer_growth_; // Block growth when true.
1293 1288
1294 // Relocation information generation. 1289 // Relocation information generation.
1295 // Each relocation is encoded as a variable size value. 1290 // Each relocation is encoded as a variable size value.
1296 static const int kMaxRelocSize = RelocInfoWriter::kMaxSize; 1291 static constexpr int kMaxRelocSize = RelocInfoWriter::kMaxSize;
1297 RelocInfoWriter reloc_info_writer; 1292 RelocInfoWriter reloc_info_writer;
1298 1293
1299 // The bound position, before this we cannot do instruction elimination. 1294 // The bound position, before this we cannot do instruction elimination.
1300 int last_bound_pos_; 1295 int last_bound_pos_;
1301 1296
1302 // Readable constants for compact branch handling in emit() 1297 // Readable constants for compact branch handling in emit()
1303 enum class CompactBranchType : bool { NO = false, COMPACT_BRANCH = true }; 1298 enum class CompactBranchType : bool { NO = false, COMPACT_BRANCH = true };
1304 1299
1305 // Code emission. 1300 // Code emission.
1306 void GrowBuffer(); 1301 void GrowBuffer();
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
1440 }; 1435 };
1441 1436
1442 int32_t get_trampoline_entry(int32_t pos); 1437 int32_t get_trampoline_entry(int32_t pos);
1443 int unbound_labels_count_; 1438 int unbound_labels_count_;
1444 // If trampoline is emitted, generated code is becoming large. As this is 1439 // If trampoline is emitted, generated code is becoming large. As this is
1445 // already a slow case which can possibly break our code generation for the 1440 // already a slow case which can possibly break our code generation for the
1446 // extreme case, we use this information to trigger different mode of 1441 // extreme case, we use this information to trigger different mode of
1447 // branch instruction generation, where we use jump instructions rather 1442 // branch instruction generation, where we use jump instructions rather
1448 // than regular branch instructions. 1443 // than regular branch instructions.
1449 bool trampoline_emitted_; 1444 bool trampoline_emitted_;
1450 static const int kInvalidSlotPos = -1; 1445 static constexpr int kInvalidSlotPos = -1;
1451 1446
1452 // Internal reference positions, required for unbounded internal reference 1447 // Internal reference positions, required for unbounded internal reference
1453 // labels. 1448 // labels.
1454 std::set<int> internal_reference_positions_; 1449 std::set<int> internal_reference_positions_;
1455 bool is_internal_reference(Label* L) { 1450 bool is_internal_reference(Label* L) {
1456 return internal_reference_positions_.find(L->pos()) != 1451 return internal_reference_positions_.find(L->pos()) !=
1457 internal_reference_positions_.end(); 1452 internal_reference_positions_.end();
1458 } 1453 }
1459 1454
1460 void EmittedCompactBranchInstruction() { prev_instr_compact_branch_ = true; } 1455 void EmittedCompactBranchInstruction() { prev_instr_compact_branch_ = true; }
(...skipping 15 matching lines...) Expand all
1476 public: 1471 public:
1477 explicit EnsureSpace(Assembler* assembler) { 1472 explicit EnsureSpace(Assembler* assembler) {
1478 assembler->CheckBuffer(); 1473 assembler->CheckBuffer();
1479 } 1474 }
1480 }; 1475 };
1481 1476
1482 } // namespace internal 1477 } // namespace internal
1483 } // namespace v8 1478 } // namespace v8
1484 1479
1485 #endif // V8_ARM_ASSEMBLER_MIPS_H_ 1480 #endif // V8_ARM_ASSEMBLER_MIPS_H_
OLDNEW
« no previous file with comments | « src/ia32/assembler-ia32.h ('k') | src/mips/macro-assembler-mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698