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

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

Issue 190663009: A64: Add and use a double register which holds the 0.0 value. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/a64/code-stubs-a64.cc » ('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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 return IsValidFPRegister(); 257 return IsValidFPRegister();
258 } 258 }
259 259
260 static FPRegister SRegFromCode(unsigned code); 260 static FPRegister SRegFromCode(unsigned code);
261 static FPRegister DRegFromCode(unsigned code); 261 static FPRegister DRegFromCode(unsigned code);
262 262
263 // Start of V8 compatibility section --------------------- 263 // Start of V8 compatibility section ---------------------
264 static const int kMaxNumRegisters = kNumberOfFPRegisters; 264 static const int kMaxNumRegisters = kNumberOfFPRegisters;
265 265
266 // Crankshaft can use all the FP registers except: 266 // Crankshaft can use all the FP registers except:
267 // - d29 which is used in crankshaft as a double scratch register 267 // - d15 which is used to keep the 0 double value
268 // - d30 which is used to keep the 0 double value 268 // - d30 which is used in crankshaft as a double scratch register
269 // - d31 which is used in the MacroAssembler as a double scratch register 269 // - d31 which is used in the MacroAssembler as a double scratch register
270 static const int kNumReservedRegisters = 3; 270 static const unsigned kAllocatableLowRangeBegin = 0;
271 static const unsigned kAllocatableLowRangeEnd = 14;
272 static const unsigned kAllocatableHighRangeBegin = 16;
273 static const unsigned kAllocatableHighRangeEnd = 29;
274
275 static const RegList kAllocatableFPRegisters = 0x3fff7fff;
276
277 // Gap between low and high ranges.
278 static const int kAllocatableRangeGapSize =
279 (kAllocatableHighRangeBegin - kAllocatableLowRangeEnd) - 1;
280
271 static const int kMaxNumAllocatableRegisters = 281 static const int kMaxNumAllocatableRegisters =
272 kNumberOfFPRegisters - kNumReservedRegisters; 282 (kAllocatableLowRangeEnd - kAllocatableLowRangeBegin + 1) +
283 (kAllocatableHighRangeEnd - kAllocatableHighRangeBegin + 1);
273 static int NumAllocatableRegisters() { return kMaxNumAllocatableRegisters; } 284 static int NumAllocatableRegisters() { return kMaxNumAllocatableRegisters; }
274 static const RegList kAllocatableFPRegisters =
275 (1 << kMaxNumAllocatableRegisters) - 1;
276 285
277 static FPRegister FromAllocationIndex(int index) { 286 // Return true if the register is one that crankshaft can allocate.
278 ASSERT((index >= 0) && (index < NumAllocatableRegisters())); 287 bool IsAllocatable() const {
279 return from_code(index); 288 return (Bit() & kAllocatableFPRegisters) != 0;
289 }
290
291 static FPRegister FromAllocationIndex(unsigned int index) {
292 ASSERT(index < static_cast<unsigned>(NumAllocatableRegisters()));
293
294 return (index <= kAllocatableLowRangeEnd)
295 ? from_code(index)
296 : from_code(index + kAllocatableRangeGapSize);
280 } 297 }
281 298
282 static const char* AllocationIndexToString(int index) { 299 static const char* AllocationIndexToString(int index) {
283 ASSERT((index >= 0) && (index < NumAllocatableRegisters())); 300 ASSERT((index >= 0) && (index < NumAllocatableRegisters()));
301 ASSERT((kAllocatableLowRangeBegin == 0) &&
302 (kAllocatableLowRangeEnd == 14) &&
303 (kAllocatableHighRangeBegin == 16) &&
304 (kAllocatableHighRangeEnd == 29));
284 const char* const names[] = { 305 const char* const names[] = {
285 "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", 306 "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7",
286 "d8", "d9", "d10", "d11", "d12", "d13", "d14", "d15", 307 "d8", "d9", "d10", "d11", "d12", "d13", "d14",
287 "d16", "d17", "d18", "d19", "d20", "d21", "d22", "d23", 308 "d16", "d17", "d18", "d19", "d20", "d21", "d22", "d23",
288 "d24", "d25", "d26", "d27", "d28", 309 "d24", "d25", "d26", "d27", "d28", "d29"
289 }; 310 };
290 return names[index]; 311 return names[index];
291 } 312 }
292 313
293 static int ToAllocationIndex(FPRegister reg) { 314 static int ToAllocationIndex(FPRegister reg) {
294 int code = reg.code(); 315 ASSERT(reg.IsAllocatable());
295 ASSERT(code < NumAllocatableRegisters()); 316 unsigned code = reg.code();
296 return code; 317
318 return (code <= kAllocatableLowRangeEnd)
319 ? code
320 : code - kAllocatableRangeGapSize;
297 } 321 }
298 322
299 static FPRegister from_code(int code) { 323 static FPRegister from_code(int code) {
300 // Always return a D register. 324 // Always return a D register.
301 return FPRegister::Create(code, kDRegSize); 325 return FPRegister::Create(code, kDRegSize);
302 } 326 }
303 // End of V8 compatibility section ----------------------- 327 // End of V8 compatibility section -----------------------
304 }; 328 };
305 329
306 330
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 // We chose x28 because it is contiguous with the other specific purpose 392 // We chose x28 because it is contiguous with the other specific purpose
369 // registers. 393 // registers.
370 STATIC_ASSERT(kJSSPCode == 28); 394 STATIC_ASSERT(kJSSPCode == 28);
371 ALIAS_REGISTER(Register, jssp, x28); 395 ALIAS_REGISTER(Register, jssp, x28);
372 ALIAS_REGISTER(Register, wjssp, w28); 396 ALIAS_REGISTER(Register, wjssp, w28);
373 ALIAS_REGISTER(Register, fp, x29); 397 ALIAS_REGISTER(Register, fp, x29);
374 ALIAS_REGISTER(Register, lr, x30); 398 ALIAS_REGISTER(Register, lr, x30);
375 ALIAS_REGISTER(Register, xzr, x31); 399 ALIAS_REGISTER(Register, xzr, x31);
376 ALIAS_REGISTER(Register, wzr, w31); 400 ALIAS_REGISTER(Register, wzr, w31);
377 401
402 // Keeps the 0 double value.
403 ALIAS_REGISTER(FPRegister, fp_zero, d15);
378 // Crankshaft double scratch register. 404 // Crankshaft double scratch register.
379 ALIAS_REGISTER(FPRegister, crankshaft_fp_scratch, d29); 405 ALIAS_REGISTER(FPRegister, crankshaft_fp_scratch, d30);
380 // Keeps the 0 double value.
381 ALIAS_REGISTER(FPRegister, fp_zero, d30);
382 // MacroAssembler double scratch register. 406 // MacroAssembler double scratch register.
383 ALIAS_REGISTER(FPRegister, fp_scratch, d31); 407 ALIAS_REGISTER(FPRegister, fp_scratch, d31);
384 408
385 #undef ALIAS_REGISTER 409 #undef ALIAS_REGISTER
386 410
387 411
388 Register GetAllocatableRegisterThatIsNotOneOf(Register reg1, 412 Register GetAllocatableRegisterThatIsNotOneOf(Register reg1,
389 Register reg2 = NoReg, 413 Register reg2 = NoReg,
390 Register reg3 = NoReg, 414 Register reg3 = NoReg,
391 Register reg4 = NoReg); 415 Register reg4 = NoReg);
(...skipping 1760 matching lines...) Expand 10 before | Expand all | Expand 10 after
2152 class EnsureSpace BASE_EMBEDDED { 2176 class EnsureSpace BASE_EMBEDDED {
2153 public: 2177 public:
2154 explicit EnsureSpace(Assembler* assembler) { 2178 explicit EnsureSpace(Assembler* assembler) {
2155 assembler->CheckBuffer(); 2179 assembler->CheckBuffer();
2156 } 2180 }
2157 }; 2181 };
2158 2182
2159 } } // namespace v8::internal 2183 } } // namespace v8::internal
2160 2184
2161 #endif // V8_A64_ASSEMBLER_A64_H_ 2185 #endif // V8_A64_ASSEMBLER_A64_H_
OLDNEW
« no previous file with comments | « no previous file | src/a64/code-stubs-a64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698