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

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

Issue 2446543002: [turbofan] Support variable size argument popping in TF-generated functions (Closed)
Patch Set: Fix bugs 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
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 #include "src/compilation-info.h" 6 #include "src/compilation-info.h"
7 #include "src/compiler/code-generator-impl.h" 7 #include "src/compiler/code-generator-impl.h"
8 #include "src/compiler/gap-resolver.h" 8 #include "src/compiler/gap-resolver.h"
9 #include "src/compiler/node-matchers.h" 9 #include "src/compiler/node-matchers.h"
10 #include "src/compiler/osr.h" 10 #include "src/compiler/osr.h"
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 int deopt_state_id = 706 int deopt_state_id =
707 BuildTranslation(instr, -1, 0, OutputFrameStateCombine::Ignore()); 707 BuildTranslation(instr, -1, 0, OutputFrameStateCombine::Ignore());
708 Deoptimizer::BailoutType bailout_type = 708 Deoptimizer::BailoutType bailout_type =
709 Deoptimizer::BailoutType(MiscField::decode(instr->opcode())); 709 Deoptimizer::BailoutType(MiscField::decode(instr->opcode()));
710 CodeGenResult result = AssembleDeoptimizerCall( 710 CodeGenResult result = AssembleDeoptimizerCall(
711 deopt_state_id, bailout_type, current_source_position_); 711 deopt_state_id, bailout_type, current_source_position_);
712 if (result != kSuccess) return result; 712 if (result != kSuccess) return result;
713 break; 713 break;
714 } 714 }
715 case kArchRet: 715 case kArchRet:
716 AssembleReturn(); 716 AssembleReturn(instr->InputAt(0));
717 break; 717 break;
718 case kArchStackPointer: 718 case kArchStackPointer:
719 __ mov(i.OutputRegister(), sp); 719 __ mov(i.OutputRegister(), sp);
720 break; 720 break;
721 case kArchFramePointer: 721 case kArchFramePointer:
722 __ mov(i.OutputRegister(), fp); 722 __ mov(i.OutputRegister(), fp);
723 break; 723 break;
724 case kArchParentFramePointer: 724 case kArchParentFramePointer:
725 if (frame_access_state()->has_frame()) { 725 if (frame_access_state()->has_frame()) {
726 __ lw(i.OutputRegister(), MemOperand(fp, 0)); 726 __ lw(i.OutputRegister(), MemOperand(fp, 0));
(...skipping 1230 matching lines...) Expand 10 before | Expand all | Expand 10 after
1957 } 1957 }
1958 1958
1959 const RegList saves = descriptor->CalleeSavedRegisters(); 1959 const RegList saves = descriptor->CalleeSavedRegisters();
1960 if (saves != 0) { 1960 if (saves != 0) {
1961 // Save callee-saved registers. 1961 // Save callee-saved registers.
1962 __ MultiPush(saves); 1962 __ MultiPush(saves);
1963 DCHECK(kNumCalleeSaved == base::bits::CountPopulation32(saves) + 1); 1963 DCHECK(kNumCalleeSaved == base::bits::CountPopulation32(saves) + 1);
1964 } 1964 }
1965 } 1965 }
1966 1966
1967 1967 void CodeGenerator::AssembleReturn(InstructionOperand* pop) {
1968 void CodeGenerator::AssembleReturn() {
1969 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); 1968 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor();
1970 int pop_count = static_cast<int>(descriptor->StackParameterCount()); 1969 int pop_count = static_cast<int>(descriptor->StackParameterCount());
1971 1970
1972 // Restore GP registers. 1971 // Restore GP registers.
1973 const RegList saves = descriptor->CalleeSavedRegisters(); 1972 const RegList saves = descriptor->CalleeSavedRegisters();
1974 if (saves != 0) { 1973 if (saves != 0) {
1975 __ MultiPop(saves); 1974 __ MultiPop(saves);
1976 } 1975 }
1977 1976
1978 // Restore FPU registers. 1977 // Restore FPU registers.
1979 const RegList saves_fpu = descriptor->CalleeSavedFPRegisters(); 1978 const RegList saves_fpu = descriptor->CalleeSavedFPRegisters();
1980 if (saves_fpu != 0) { 1979 if (saves_fpu != 0) {
1981 __ MultiPopFPU(saves_fpu); 1980 __ MultiPopFPU(saves_fpu);
1982 } 1981 }
1983 1982
1984 if (descriptor->IsCFunctionCall()) { 1983 if (descriptor->IsCFunctionCall()) {
1985 AssembleDeconstructFrame(); 1984 AssembleDeconstructFrame();
1986 } else if (frame_access_state()->has_frame()) { 1985 } else if (frame_access_state()->has_frame()) {
1987 // Canonicalize JSFunction return sites for now. 1986 // Canonicalize JSFunction return sites for now.
1988 if (return_label_.is_bound()) { 1987 if (return_label_.is_bound()) {
1989 __ Branch(&return_label_); 1988 __ Branch(&return_label_);
1990 return; 1989 return;
1991 } else { 1990 } else {
1992 __ bind(&return_label_); 1991 __ bind(&return_label_);
1993 AssembleDeconstructFrame(); 1992 AssembleDeconstructFrame();
1994 } 1993 }
1995 } 1994 }
1995 MipsOperandConverter g(this, nullptr);
1996 if (pop->IsImmediate()) {
1997 DCHECK_EQ(Constant::kInt32, g.ToConstant(pop).type());
1998 pop_count += g.ToConstant(pop).ToInt32();
1999 } else {
2000 Register pop_reg = g.ToRegister(pop);
2001 __ sll(pop_reg, pop_reg, kPointerSizeLog2);
2002 __ Addu(sp, sp, Operand(pop_reg));
2003 }
1996 if (pop_count != 0) { 2004 if (pop_count != 0) {
1997 __ DropAndRet(pop_count); 2005 __ DropAndRet(pop_count);
1998 } else { 2006 } else {
1999 __ Ret(); 2007 __ Ret();
2000 } 2008 }
2001 } 2009 }
2002 2010
2003 2011
2004 void CodeGenerator::AssembleMove(InstructionOperand* source, 2012 void CodeGenerator::AssembleMove(InstructionOperand* source,
2005 InstructionOperand* destination) { 2013 InstructionOperand* destination) {
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
2255 padding_size -= v8::internal::Assembler::kInstrSize; 2263 padding_size -= v8::internal::Assembler::kInstrSize;
2256 } 2264 }
2257 } 2265 }
2258 } 2266 }
2259 2267
2260 #undef __ 2268 #undef __
2261 2269
2262 } // namespace compiler 2270 } // namespace compiler
2263 } // namespace internal 2271 } // namespace internal
2264 } // namespace v8 2272 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698