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

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

Issue 164793003: A64: Use a scope utility to allocate scratch registers. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebase. 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 | « src/a64/macro-assembler-a64.cc ('k') | src/a64/stub-cache-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 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 581
582 void MacroAssembler::Fcmp(const FPRegister& fn, const FPRegister& fm) { 582 void MacroAssembler::Fcmp(const FPRegister& fn, const FPRegister& fm) {
583 ASSERT(allow_macro_instructions_); 583 ASSERT(allow_macro_instructions_);
584 fcmp(fn, fm); 584 fcmp(fn, fm);
585 } 585 }
586 586
587 587
588 void MacroAssembler::Fcmp(const FPRegister& fn, double value) { 588 void MacroAssembler::Fcmp(const FPRegister& fn, double value) {
589 ASSERT(allow_macro_instructions_); 589 ASSERT(allow_macro_instructions_);
590 if (value != 0.0) { 590 if (value != 0.0) {
591 FPRegister tmp = AppropriateTempFor(fn); 591 UseScratchRegisterScope temps(this);
592 FPRegister tmp = temps.AcquireSameSizeAs(fn);
592 Fmov(tmp, value); 593 Fmov(tmp, value);
593 fcmp(fn, tmp); 594 fcmp(fn, tmp);
594 } else { 595 } else {
595 fcmp(fn, value); 596 fcmp(fn, value);
596 } 597 }
597 } 598 }
598 599
599 600
600 void MacroAssembler::Fcsel(const FPRegister& fd, 601 void MacroAssembler::Fcsel(const FPRegister& fd,
601 const FPRegister& fn, 602 const FPRegister& fn,
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 736
736 737
737 void MacroAssembler::Fmov(FPRegister fd, double imm) { 738 void MacroAssembler::Fmov(FPRegister fd, double imm) {
738 ASSERT(allow_macro_instructions_); 739 ASSERT(allow_macro_instructions_);
739 if ((fd.Is64Bits() && IsImmFP64(imm)) || 740 if ((fd.Is64Bits() && IsImmFP64(imm)) ||
740 (fd.Is32Bits() && IsImmFP32(imm)) || 741 (fd.Is32Bits() && IsImmFP32(imm)) ||
741 ((imm == 0.0) && (copysign(1.0, imm) == 1.0))) { 742 ((imm == 0.0) && (copysign(1.0, imm) == 1.0))) {
742 // These cases can be handled by the Assembler. 743 // These cases can be handled by the Assembler.
743 fmov(fd, imm); 744 fmov(fd, imm);
744 } else { 745 } else {
746 UseScratchRegisterScope temps(this);
745 // TODO(all): The Assembler would try to relocate the immediate with 747 // TODO(all): The Assembler would try to relocate the immediate with
746 // Assembler::ldr(const FPRegister& ft, double imm) but it is not 748 // Assembler::ldr(const FPRegister& ft, double imm) but it is not
747 // implemented yet. 749 // implemented yet.
748 if (fd.SizeInBits() == kDRegSize) { 750 if (fd.SizeInBits() == kDRegSize) {
749 Mov(Tmp0(), double_to_rawbits(imm)); 751 Register tmp = temps.AcquireX();
750 Fmov(fd, Tmp0()); 752 Mov(tmp, double_to_rawbits(imm));
753 Fmov(fd, tmp);
751 } else { 754 } else {
752 ASSERT(fd.SizeInBits() == kSRegSize); 755 ASSERT(fd.SizeInBits() == kSRegSize);
753 Mov(WTmp0(), float_to_rawbits(static_cast<float>(imm))); 756 Register tmp = temps.AcquireW();
754 Fmov(fd, WTmp0()); 757 Mov(tmp, float_to_rawbits(static_cast<float>(imm)));
758 Fmov(fd, tmp);
755 } 759 }
756 } 760 }
757 } 761 }
758 762
759 763
760 void MacroAssembler::Fmov(Register rd, FPRegister fn) { 764 void MacroAssembler::Fmov(Register rd, FPRegister fn) {
761 ASSERT(allow_macro_instructions_); 765 ASSERT(allow_macro_instructions_);
762 ASSERT(!rd.IsZero()); 766 ASSERT(!rd.IsZero());
763 fmov(rd, fn); 767 fmov(rd, fn);
764 } 768 }
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
1344 void MacroAssembler::JumpIfNotSmi(Register value, Label* not_smi_label) { 1348 void MacroAssembler::JumpIfNotSmi(Register value, Label* not_smi_label) {
1345 JumpIfSmi(value, NULL, not_smi_label); 1349 JumpIfSmi(value, NULL, not_smi_label);
1346 } 1350 }
1347 1351
1348 1352
1349 void MacroAssembler::JumpIfBothSmi(Register value1, 1353 void MacroAssembler::JumpIfBothSmi(Register value1,
1350 Register value2, 1354 Register value2,
1351 Label* both_smi_label, 1355 Label* both_smi_label,
1352 Label* not_smi_label) { 1356 Label* not_smi_label) {
1353 STATIC_ASSERT((kSmiTagSize == 1) && (kSmiTag == 0)); 1357 STATIC_ASSERT((kSmiTagSize == 1) && (kSmiTag == 0));
1358 UseScratchRegisterScope temps(this);
1359 Register tmp = temps.AcquireX();
1354 // Check if both tag bits are clear. 1360 // Check if both tag bits are clear.
1355 Orr(Tmp0(), value1, value2); 1361 Orr(tmp, value1, value2);
1356 JumpIfSmi(Tmp0(), both_smi_label, not_smi_label); 1362 JumpIfSmi(tmp, both_smi_label, not_smi_label);
1357 } 1363 }
1358 1364
1359 1365
1360 void MacroAssembler::JumpIfEitherSmi(Register value1, 1366 void MacroAssembler::JumpIfEitherSmi(Register value1,
1361 Register value2, 1367 Register value2,
1362 Label* either_smi_label, 1368 Label* either_smi_label,
1363 Label* not_smi_label) { 1369 Label* not_smi_label) {
1364 STATIC_ASSERT((kSmiTagSize == 1) && (kSmiTag == 0)); 1370 STATIC_ASSERT((kSmiTagSize == 1) && (kSmiTag == 0));
1371 UseScratchRegisterScope temps(this);
1372 Register tmp = temps.AcquireX();
1365 // Check if either tag bit is clear. 1373 // Check if either tag bit is clear.
1366 And(Tmp0(), value1, value2); 1374 And(tmp, value1, value2);
1367 JumpIfSmi(Tmp0(), either_smi_label, not_smi_label); 1375 JumpIfSmi(tmp, either_smi_label, not_smi_label);
1368 } 1376 }
1369 1377
1370 1378
1371 void MacroAssembler::JumpIfEitherNotSmi(Register value1, 1379 void MacroAssembler::JumpIfEitherNotSmi(Register value1,
1372 Register value2, 1380 Register value2,
1373 Label* not_smi_label) { 1381 Label* not_smi_label) {
1374 JumpIfBothSmi(value1, value2, NULL, not_smi_label); 1382 JumpIfBothSmi(value1, value2, NULL, not_smi_label);
1375 } 1383 }
1376 1384
1377 1385
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1430 } else if (not_string == NULL) { 1438 } else if (not_string == NULL) {
1431 TestAndBranchIfAllClear(type.W(), kIsNotStringMask, string); 1439 TestAndBranchIfAllClear(type.W(), kIsNotStringMask, string);
1432 } else { 1440 } else {
1433 TestAndBranchIfAnySet(type.W(), kIsNotStringMask, not_string); 1441 TestAndBranchIfAnySet(type.W(), kIsNotStringMask, not_string);
1434 B(string); 1442 B(string);
1435 } 1443 }
1436 } 1444 }
1437 1445
1438 1446
1439 void MacroAssembler::Push(Handle<Object> handle) { 1447 void MacroAssembler::Push(Handle<Object> handle) {
1440 Mov(Tmp0(), Operand(handle)); 1448 UseScratchRegisterScope temps(this);
1441 Push(Tmp0()); 1449 Register tmp = temps.AcquireX();
1450 Mov(tmp, Operand(handle));
1451 Push(tmp);
1442 } 1452 }
1443 1453
1444 1454
1445 void MacroAssembler::Claim(uint64_t count, uint64_t unit_size) { 1455 void MacroAssembler::Claim(uint64_t count, uint64_t unit_size) {
1446 uint64_t size = count * unit_size; 1456 uint64_t size = count * unit_size;
1447 1457
1448 if (size == 0) { 1458 if (size == 0) {
1449 return; 1459 return;
1450 } 1460 }
1451 1461
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
1639 // characters are reserved for controlling features of the instrumentation. 1649 // characters are reserved for controlling features of the instrumentation.
1640 ASSERT(isprint(marker_name[0]) && isprint(marker_name[1])); 1650 ASSERT(isprint(marker_name[0]) && isprint(marker_name[1]));
1641 1651
1642 InstructionAccurateScope scope(this, 1); 1652 InstructionAccurateScope scope(this, 1);
1643 movn(xzr, (marker_name[1] << 8) | marker_name[0]); 1653 movn(xzr, (marker_name[1] << 8) | marker_name[0]);
1644 } 1654 }
1645 1655
1646 } } // namespace v8::internal 1656 } } // namespace v8::internal
1647 1657
1648 #endif // V8_A64_MACRO_ASSEMBLER_A64_INL_H_ 1658 #endif // V8_A64_MACRO_ASSEMBLER_A64_INL_H_
OLDNEW
« no previous file with comments | « src/a64/macro-assembler-a64.cc ('k') | src/a64/stub-cache-a64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698