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

Side by Side Diff: src/compiler/arm/code-generator-arm.cc

Issue 2473643002: Revert of [turbofan] Support variable size argument popping in TF-generated functions (Closed)
Patch Set: Created 4 years, 1 month 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/code-stubs.cc ('k') | src/compiler/arm64/code-generator-arm64.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/code-generator.h" 5 #include "src/compiler/code-generator.h"
6 6
7 #include "src/arm/macro-assembler-arm.h" 7 #include "src/arm/macro-assembler-arm.h"
8 #include "src/compilation-info.h" 8 #include "src/compilation-info.h"
9 #include "src/compiler/code-generator-impl.h" 9 #include "src/compiler/code-generator-impl.h"
10 #include "src/compiler/gap-resolver.h" 10 #include "src/compiler/gap-resolver.h"
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 int deopt_state_id = 737 int deopt_state_id =
738 BuildTranslation(instr, -1, 0, OutputFrameStateCombine::Ignore()); 738 BuildTranslation(instr, -1, 0, OutputFrameStateCombine::Ignore());
739 Deoptimizer::BailoutType bailout_type = 739 Deoptimizer::BailoutType bailout_type =
740 Deoptimizer::BailoutType(MiscField::decode(instr->opcode())); 740 Deoptimizer::BailoutType(MiscField::decode(instr->opcode()));
741 CodeGenResult result = AssembleDeoptimizerCall( 741 CodeGenResult result = AssembleDeoptimizerCall(
742 deopt_state_id, bailout_type, current_source_position_); 742 deopt_state_id, bailout_type, current_source_position_);
743 if (result != kSuccess) return result; 743 if (result != kSuccess) return result;
744 break; 744 break;
745 } 745 }
746 case kArchRet: 746 case kArchRet:
747 AssembleReturn(instr->InputAt(0)); 747 AssembleReturn();
748 DCHECK_EQ(LeaveCC, i.OutputSBit()); 748 DCHECK_EQ(LeaveCC, i.OutputSBit());
749 break; 749 break;
750 case kArchStackPointer: 750 case kArchStackPointer:
751 __ mov(i.OutputRegister(), sp); 751 __ mov(i.OutputRegister(), sp);
752 DCHECK_EQ(LeaveCC, i.OutputSBit()); 752 DCHECK_EQ(LeaveCC, i.OutputSBit());
753 break; 753 break;
754 case kArchFramePointer: 754 case kArchFramePointer:
755 __ mov(i.OutputRegister(), fp); 755 __ mov(i.OutputRegister(), fp);
756 DCHECK_EQ(LeaveCC, i.OutputSBit()); 756 DCHECK_EQ(LeaveCC, i.OutputSBit());
757 break; 757 break;
(...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after
1730 } 1730 }
1731 const RegList saves = FLAG_enable_embedded_constant_pool 1731 const RegList saves = FLAG_enable_embedded_constant_pool
1732 ? (descriptor->CalleeSavedRegisters() & ~pp.bit()) 1732 ? (descriptor->CalleeSavedRegisters() & ~pp.bit())
1733 : descriptor->CalleeSavedRegisters(); 1733 : descriptor->CalleeSavedRegisters();
1734 if (saves != 0) { 1734 if (saves != 0) {
1735 // Save callee-saved registers. 1735 // Save callee-saved registers.
1736 __ stm(db_w, sp, saves); 1736 __ stm(db_w, sp, saves);
1737 } 1737 }
1738 } 1738 }
1739 1739
1740 void CodeGenerator::AssembleReturn(InstructionOperand* pop) { 1740
1741 void CodeGenerator::AssembleReturn() {
1741 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); 1742 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor();
1742 int pop_count = static_cast<int>(descriptor->StackParameterCount()); 1743 int pop_count = static_cast<int>(descriptor->StackParameterCount());
1743 1744
1744 // Restore registers. 1745 // Restore registers.
1745 const RegList saves = FLAG_enable_embedded_constant_pool 1746 const RegList saves = FLAG_enable_embedded_constant_pool
1746 ? (descriptor->CalleeSavedRegisters() & ~pp.bit()) 1747 ? (descriptor->CalleeSavedRegisters() & ~pp.bit())
1747 : descriptor->CalleeSavedRegisters(); 1748 : descriptor->CalleeSavedRegisters();
1748 if (saves != 0) { 1749 if (saves != 0) {
1749 __ ldm(ia_w, sp, saves); 1750 __ ldm(ia_w, sp, saves);
1750 } 1751 }
1751 1752
1752 // Restore FP registers. 1753 // Restore FP registers.
1753 const RegList saves_fp = descriptor->CalleeSavedFPRegisters(); 1754 const RegList saves_fp = descriptor->CalleeSavedFPRegisters();
1754 if (saves_fp != 0) { 1755 if (saves_fp != 0) {
1755 STATIC_ASSERT(DwVfpRegister::kMaxNumRegisters == 32); 1756 STATIC_ASSERT(DwVfpRegister::kMaxNumRegisters == 32);
1756 uint32_t last = base::bits::CountLeadingZeros32(saves_fp) - 1; 1757 uint32_t last = base::bits::CountLeadingZeros32(saves_fp) - 1;
1757 uint32_t first = base::bits::CountTrailingZeros32(saves_fp); 1758 uint32_t first = base::bits::CountTrailingZeros32(saves_fp);
1758 __ vldm(ia_w, sp, DwVfpRegister::from_code(first), 1759 __ vldm(ia_w, sp, DwVfpRegister::from_code(first),
1759 DwVfpRegister::from_code(last)); 1760 DwVfpRegister::from_code(last));
1760 } 1761 }
1761 1762
1762 unwinding_info_writer_.MarkBlockWillExit(); 1763 unwinding_info_writer_.MarkBlockWillExit();
1763 1764
1764 ArmOperandConverter g(this, nullptr);
1765 if (descriptor->IsCFunctionCall()) { 1765 if (descriptor->IsCFunctionCall()) {
1766 AssembleDeconstructFrame(); 1766 AssembleDeconstructFrame();
1767 } else if (frame_access_state()->has_frame()) { 1767 } else if (frame_access_state()->has_frame()) {
1768 // Canonicalize JSFunction return sites for now unless they have an variable 1768 // Canonicalize JSFunction return sites for now.
1769 // number of stack slot pops. 1769 if (return_label_.is_bound()) {
1770 if (pop->IsImmediate() && g.ToConstant(pop).ToInt32() == 0) { 1770 __ b(&return_label_);
1771 if (return_label_.is_bound()) { 1771 return;
1772 __ b(&return_label_);
1773 return;
1774 } else {
1775 __ bind(&return_label_);
1776 AssembleDeconstructFrame();
1777 }
1778 } else { 1772 } else {
1773 __ bind(&return_label_);
1779 AssembleDeconstructFrame(); 1774 AssembleDeconstructFrame();
1780 } 1775 }
1781 } 1776 }
1782 1777 __ Ret(pop_count);
1783 if (pop->IsImmediate()) {
1784 DCHECK_EQ(Constant::kInt32, g.ToConstant(pop).type());
1785 pop_count += g.ToConstant(pop).ToInt32();
1786 } else {
1787 __ Drop(g.ToRegister(pop));
1788 }
1789 __ Drop(pop_count);
1790 __ Ret();
1791 } 1778 }
1792 1779
1793 void CodeGenerator::AssembleMove(InstructionOperand* source, 1780 void CodeGenerator::AssembleMove(InstructionOperand* source,
1794 InstructionOperand* destination) { 1781 InstructionOperand* destination) {
1795 ArmOperandConverter g(this, nullptr); 1782 ArmOperandConverter g(this, nullptr);
1796 // Dispatch on the source and destination operand kinds. Not all 1783 // Dispatch on the source and destination operand kinds. Not all
1797 // combinations are possible. 1784 // combinations are possible.
1798 if (source->IsRegister()) { 1785 if (source->IsRegister()) {
1799 DCHECK(destination->IsRegister() || destination->IsStackSlot()); 1786 DCHECK(destination->IsRegister() || destination->IsStackSlot());
1800 Register src = g.ToRegister(source); 1787 Register src = g.ToRegister(source);
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
2049 padding_size -= v8::internal::Assembler::kInstrSize; 2036 padding_size -= v8::internal::Assembler::kInstrSize;
2050 } 2037 }
2051 } 2038 }
2052 } 2039 }
2053 2040
2054 #undef __ 2041 #undef __
2055 2042
2056 } // namespace compiler 2043 } // namespace compiler
2057 } // namespace internal 2044 } // namespace internal
2058 } // namespace v8 2045 } // namespace v8
OLDNEW
« no previous file with comments | « src/code-stubs.cc ('k') | src/compiler/arm64/code-generator-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698