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

Side by Side Diff: src/a64/code-stubs-a64.cc

Issue 164793003: A64: Use a scope utility to allocate scratch registers. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address _all_ of the latest review comments. 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
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 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after
1215 // where base is -INFINITY or -0. 1215 // where base is -INFINITY or -0.
1216 1216
1217 // Add +0 to base. This has no effect other than turning -0 into +0. 1217 // Add +0 to base. This has no effect other than turning -0 into +0.
1218 __ Fmov(zero_double, 0.0); 1218 __ Fmov(zero_double, 0.0);
1219 __ Fadd(base_double, base_double, zero_double); 1219 __ Fadd(base_double, base_double, zero_double);
1220 // The operation -0+0 results in +0 in all cases except where the 1220 // The operation -0+0 results in +0 in all cases except where the
1221 // FPCR rounding mode is 'round towards minus infinity' (RM). The 1221 // FPCR rounding mode is 'round towards minus infinity' (RM). The
1222 // A64 simulator does not currently simulate FPCR (where the rounding 1222 // A64 simulator does not currently simulate FPCR (where the rounding
1223 // mode is set), so test the operation with some debug code. 1223 // mode is set), so test the operation with some debug code.
1224 if (masm->emit_debug_code()) { 1224 if (masm->emit_debug_code()) {
1225 Register temp = masm->Tmp1(); 1225 UseScratchRegisterScope temps(masm);
1226 Register temp = temps.AcquireX();
1226 // d5 zero_double The value +0.0 as a double. 1227 // d5 zero_double The value +0.0 as a double.
1227 __ Fneg(scratch0_double, zero_double); 1228 __ Fneg(scratch0_double, zero_double);
1228 // Verify that we correctly generated +0.0 and -0.0. 1229 // Verify that we correctly generated +0.0 and -0.0.
1229 // bits(+0.0) = 0x0000000000000000 1230 // bits(+0.0) = 0x0000000000000000
1230 // bits(-0.0) = 0x8000000000000000 1231 // bits(-0.0) = 0x8000000000000000
1231 __ Fmov(temp, zero_double); 1232 __ Fmov(temp, zero_double);
1232 __ CheckRegisterIsClear(temp, kCouldNotGenerateZero); 1233 __ CheckRegisterIsClear(temp, kCouldNotGenerateZero);
1233 __ Fmov(temp, scratch0_double); 1234 __ Fmov(temp, scratch0_double);
1234 __ Eor(temp, temp, kDSignMask); 1235 __ Eor(temp, temp, kDSignMask);
1235 __ CheckRegisterIsClear(temp, kCouldNotGenerateNegativeZero); 1236 __ CheckRegisterIsClear(temp, kCouldNotGenerateNegativeZero);
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
1493 1494
1494 // Store the return address on the stack, in the space previously allocated 1495 // Store the return address on the stack, in the space previously allocated
1495 // by EnterExitFrame. The return address is queried by 1496 // by EnterExitFrame. The return address is queried by
1496 // ExitFrame::GetStateForFramePointer. 1497 // ExitFrame::GetStateForFramePointer.
1497 Label return_location; 1498 Label return_location;
1498 __ Adr(x12, &return_location); 1499 __ Adr(x12, &return_location);
1499 __ Poke(x12, 0); 1500 __ Poke(x12, 0);
1500 if (__ emit_debug_code()) { 1501 if (__ emit_debug_code()) {
1501 // Verify that the slot below fp[kSPOffset]-8 points to the return location 1502 // Verify that the slot below fp[kSPOffset]-8 points to the return location
1502 // (currently in x12). 1503 // (currently in x12).
1503 Register temp = masm->Tmp1(); 1504 UseScratchRegisterScope temps(masm);
1505 Register temp = temps.AcquireX();
1504 __ Ldr(temp, MemOperand(fp, ExitFrameConstants::kSPOffset)); 1506 __ Ldr(temp, MemOperand(fp, ExitFrameConstants::kSPOffset));
1505 __ Ldr(temp, MemOperand(temp, -static_cast<int64_t>(kXRegSizeInBytes))); 1507 __ Ldr(temp, MemOperand(temp, -static_cast<int64_t>(kXRegSizeInBytes)));
1506 __ Cmp(temp, x12); 1508 __ Cmp(temp, x12);
1507 __ Check(eq, kReturnAddressNotFoundInFrame); 1509 __ Check(eq, kReturnAddressNotFoundInFrame);
1508 } 1510 }
1509 1511
1510 // Call the builtin. 1512 // Call the builtin.
1511 __ Blr(target); 1513 __ Blr(target);
1512 __ Bind(&return_location); 1514 __ Bind(&return_location);
1513 const Register& result = x0; 1515 const Register& result = x0;
(...skipping 3191 matching lines...) Expand 10 before | Expand all | Expand 10 after
4705 value, 4707 value,
4706 1 << MemoryChunk::SCAN_ON_SCAVENGE, 4708 1 << MemoryChunk::SCAN_ON_SCAVENGE,
4707 &dont_need_remembered_set); 4709 &dont_need_remembered_set);
4708 4710
4709 // First notify the incremental marker if necessary, then update the 4711 // First notify the incremental marker if necessary, then update the
4710 // remembered set. 4712 // remembered set.
4711 CheckNeedsToInformIncrementalMarker( 4713 CheckNeedsToInformIncrementalMarker(
4712 masm, kUpdateRememberedSetOnNoNeedToInformIncrementalMarker, mode); 4714 masm, kUpdateRememberedSetOnNoNeedToInformIncrementalMarker, mode);
4713 InformIncrementalMarker(masm, mode); 4715 InformIncrementalMarker(masm, mode);
4714 regs_.Restore(masm); // Restore the extra scratch registers we used. 4716 regs_.Restore(masm); // Restore the extra scratch registers we used.
4717
4718 UseScratchRegisterScope temps(masm);
rmcilroy 2014/02/28 17:13:34 You don't need this anymore
jbramley 2014/02/28 17:36:24 Done.
4715 __ RememberedSetHelper(object_, 4719 __ RememberedSetHelper(object_,
4716 address_, 4720 address_,
4717 value_, 4721 value_, // scratch1
4718 save_fp_regs_mode_, 4722 save_fp_regs_mode_,
4719 MacroAssembler::kReturnAtEnd); 4723 MacroAssembler::kReturnAtEnd);
4720 4724
4721 __ Bind(&dont_need_remembered_set); 4725 __ Bind(&dont_need_remembered_set);
4722 } 4726 }
4723 4727
4724 CheckNeedsToInformIncrementalMarker( 4728 CheckNeedsToInformIncrementalMarker(
4725 masm, kReturnOnNoNeedToInformIncrementalMarker, mode); 4729 masm, kReturnOnNoNeedToInformIncrementalMarker, mode);
4726 InformIncrementalMarker(masm, mode); 4730 InformIncrementalMarker(masm, mode);
4727 regs_.Restore(masm); // Restore the extra scratch registers we used. 4731 regs_.Restore(masm); // Restore the extra scratch registers we used.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
4768 __ Subs(counter, counter, 1); 4772 __ Subs(counter, counter, 1);
4769 __ Str(counter, 4773 __ Str(counter,
4770 MemOperand(mem_chunk, MemoryChunk::kWriteBarrierCounterOffset)); 4774 MemOperand(mem_chunk, MemoryChunk::kWriteBarrierCounterOffset));
4771 __ B(mi, &need_incremental); 4775 __ B(mi, &need_incremental);
4772 4776
4773 // If the object is not black we don't have to inform the incremental marker. 4777 // If the object is not black we don't have to inform the incremental marker.
4774 __ JumpIfBlack(regs_.object(), regs_.scratch0(), regs_.scratch1(), &on_black); 4778 __ JumpIfBlack(regs_.object(), regs_.scratch0(), regs_.scratch1(), &on_black);
4775 4779
4776 regs_.Restore(masm); // Restore the extra scratch registers we used. 4780 regs_.Restore(masm); // Restore the extra scratch registers we used.
4777 if (on_no_need == kUpdateRememberedSetOnNoNeedToInformIncrementalMarker) { 4781 if (on_no_need == kUpdateRememberedSetOnNoNeedToInformIncrementalMarker) {
4782 UseScratchRegisterScope temps(masm);
rmcilroy 2014/02/28 17:13:34 ditto
jbramley 2014/02/28 17:36:24 Done.
4778 __ RememberedSetHelper(object_, 4783 __ RememberedSetHelper(object_,
4779 address_, 4784 address_,
4780 value_, 4785 value_, // scratch1
4781 save_fp_regs_mode_, 4786 save_fp_regs_mode_,
4782 MacroAssembler::kReturnAtEnd); 4787 MacroAssembler::kReturnAtEnd);
4783 } else { 4788 } else {
4784 __ Ret(); 4789 __ Ret();
4785 } 4790 }
4786 4791
4787 __ Bind(&on_black); 4792 __ Bind(&on_black);
4788 // Get the value from the slot. 4793 // Get the value from the slot.
4789 Register value = regs_.scratch0(); 4794 Register value = regs_.scratch0();
4790 __ Ldr(value, MemOperand(regs_.address())); 4795 __ Ldr(value, MemOperand(regs_.address()));
(...skipping 20 matching lines...) Expand all
4811 __ EnsureNotWhite(value, 4816 __ EnsureNotWhite(value,
4812 regs_.scratch1(), // Scratch. 4817 regs_.scratch1(), // Scratch.
4813 regs_.object(), // Scratch. 4818 regs_.object(), // Scratch.
4814 regs_.address(), // Scratch. 4819 regs_.address(), // Scratch.
4815 regs_.scratch2(), // Scratch. 4820 regs_.scratch2(), // Scratch.
4816 &need_incremental_pop_scratch); 4821 &need_incremental_pop_scratch);
4817 __ Pop(regs_.object(), regs_.address()); 4822 __ Pop(regs_.object(), regs_.address());
4818 4823
4819 regs_.Restore(masm); // Restore the extra scratch registers we used. 4824 regs_.Restore(masm); // Restore the extra scratch registers we used.
4820 if (on_no_need == kUpdateRememberedSetOnNoNeedToInformIncrementalMarker) { 4825 if (on_no_need == kUpdateRememberedSetOnNoNeedToInformIncrementalMarker) {
4826 UseScratchRegisterScope temps(masm);
rmcilroy 2014/02/28 17:13:34 ditto
jbramley 2014/02/28 17:36:24 Done.
4821 __ RememberedSetHelper(object_, 4827 __ RememberedSetHelper(object_,
4822 address_, 4828 address_,
4823 value_, 4829 value_, // scratch1
4824 save_fp_regs_mode_, 4830 save_fp_regs_mode_,
4825 MacroAssembler::kReturnAtEnd); 4831 MacroAssembler::kReturnAtEnd);
4826 } else { 4832 } else {
4827 __ Ret(); 4833 __ Ret();
4828 } 4834 }
4829 4835
4830 __ Bind(&need_incremental_pop_scratch); 4836 __ Bind(&need_incremental_pop_scratch);
4831 __ Pop(regs_.object(), regs_.address()); 4837 __ Pop(regs_.object(), regs_.address());
4832 4838
4833 __ Bind(&need_incremental); 4839 __ Bind(&need_incremental);
(...skipping 10 matching lines...) Expand all
4844 // Initially the stub is expected to be in STORE_BUFFER_ONLY mode, so 2 nops 4850 // Initially the stub is expected to be in STORE_BUFFER_ONLY mode, so 2 nops
4845 // are generated. 4851 // are generated.
4846 // See RecordWriteStub::Patch for details. 4852 // See RecordWriteStub::Patch for details.
4847 { 4853 {
4848 InstructionAccurateScope scope(masm, 2); 4854 InstructionAccurateScope scope(masm, 2);
4849 __ adr(xzr, &skip_to_incremental_noncompacting); 4855 __ adr(xzr, &skip_to_incremental_noncompacting);
4850 __ adr(xzr, &skip_to_incremental_compacting); 4856 __ adr(xzr, &skip_to_incremental_compacting);
4851 } 4857 }
4852 4858
4853 if (remembered_set_action_ == EMIT_REMEMBERED_SET) { 4859 if (remembered_set_action_ == EMIT_REMEMBERED_SET) {
4860 UseScratchRegisterScope temps(masm);
rmcilroy 2014/02/28 17:13:34 ditto
jbramley 2014/02/28 17:36:24 Done.
4854 __ RememberedSetHelper(object_, 4861 __ RememberedSetHelper(object_,
4855 address_, 4862 address_,
4856 value_, 4863 value_, // scratch1
4857 save_fp_regs_mode_, 4864 save_fp_regs_mode_,
4858 MacroAssembler::kReturnAtEnd); 4865 MacroAssembler::kReturnAtEnd);
4859 } 4866 }
4860 __ Ret(); 4867 __ Ret();
4861 4868
4862 __ Bind(&skip_to_incremental_noncompacting); 4869 __ Bind(&skip_to_incremental_noncompacting);
4863 GenerateIncremental(masm, INCREMENTAL); 4870 GenerateIncremental(masm, INCREMENTAL);
4864 4871
4865 __ Bind(&skip_to_incremental_compacting); 4872 __ Bind(&skip_to_incremental_compacting);
4866 GenerateIncremental(masm, INCREMENTAL_COMPACTION); 4873 GenerateIncremental(masm, INCREMENTAL_COMPACTION);
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
5078 __ Add(scratch2, scratch2, Operand( 5085 __ Add(scratch2, scratch2, Operand(
5079 NameDictionary::GetProbeOffset(i) << Name::kHashShift)); 5086 NameDictionary::GetProbeOffset(i) << Name::kHashShift));
5080 } 5087 }
5081 __ And(scratch2, scratch1, Operand(scratch2, LSR, Name::kHashShift)); 5088 __ And(scratch2, scratch1, Operand(scratch2, LSR, Name::kHashShift));
5082 5089
5083 // Scale the index by multiplying by the element size. 5090 // Scale the index by multiplying by the element size.
5084 ASSERT(NameDictionary::kEntrySize == 3); 5091 ASSERT(NameDictionary::kEntrySize == 3);
5085 __ Add(scratch2, scratch2, Operand(scratch2, LSL, 1)); 5092 __ Add(scratch2, scratch2, Operand(scratch2, LSL, 1));
5086 5093
5087 // Check if the key is identical to the name. 5094 // Check if the key is identical to the name.
5095 UseScratchRegisterScope temps(masm);
5096 Register scratch3 = temps.AcquireX();
5088 __ Add(scratch2, elements, Operand(scratch2, LSL, kPointerSizeLog2)); 5097 __ Add(scratch2, elements, Operand(scratch2, LSL, kPointerSizeLog2));
5089 // TODO(jbramley): We need another scratch here, but some callers can't 5098 __ Ldr(scratch3, FieldMemOperand(scratch2, kElementsStartOffset));
5090 // provide a scratch3 so we have to use Tmp1(). We should find a clean way 5099 __ Cmp(name, scratch3);
5091 // to make it unavailable to the MacroAssembler for a short time.
5092 __ Ldr(__ Tmp1(), FieldMemOperand(scratch2, kElementsStartOffset));
5093 __ Cmp(name, __ Tmp1());
5094 __ B(eq, done); 5100 __ B(eq, done);
5095 } 5101 }
5096 5102
5097 // The inlined probes didn't find the entry. 5103 // The inlined probes didn't find the entry.
5098 // Call the complete stub to scan the whole dictionary. 5104 // Call the complete stub to scan the whole dictionary.
5099 5105
5100 CPURegList spill_list(CPURegister::kRegister, kXRegSize, 0, 6); 5106 CPURegList spill_list(CPURegister::kRegister, kXRegSize, 0, 6);
5101 spill_list.Combine(lr); 5107 spill_list.Combine(lr);
5102 spill_list.Remove(scratch1); 5108 spill_list.Remove(scratch1);
5103 spill_list.Remove(scratch2); 5109 spill_list.Remove(scratch2);
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after
5796 MemOperand(fp, 6 * kPointerSize), 5802 MemOperand(fp, 6 * kPointerSize),
5797 NULL); 5803 NULL);
5798 } 5804 }
5799 5805
5800 5806
5801 #undef __ 5807 #undef __
5802 5808
5803 } } // namespace v8::internal 5809 } } // namespace v8::internal
5804 5810
5805 #endif // V8_TARGET_ARCH_A64 5811 #endif // V8_TARGET_ARCH_A64
OLDNEW
« no previous file with comments | « src/a64/assembler-a64-inl.h ('k') | src/a64/debug-a64.cc » ('j') | src/a64/macro-assembler-a64.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698