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

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

Issue 1455833004: [turbofan]: Implement tail calls with more callee than caller parameters (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Improve comment Created 5 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/compiler/linkage.cc ('k') | src/compiler/mips64/code-generator-mips64.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 #include "src/compiler/code-generator-impl.h" 6 #include "src/compiler/code-generator-impl.h"
7 #include "src/compiler/gap-resolver.h" 7 #include "src/compiler/gap-resolver.h"
8 #include "src/compiler/node-matchers.h" 8 #include "src/compiler/node-matchers.h"
9 #include "src/compiler/osr.h" 9 #include "src/compiler/osr.h"
10 #include "src/mips/macro-assembler-mips.h" 10 #include "src/mips/macro-assembler-mips.h"
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 __ Move(at, kScratchReg2, i.OutputDoubleRegister()); \ 447 __ Move(at, kScratchReg2, i.OutputDoubleRegister()); \
448 __ or_(at, at, kScratchReg2); \ 448 __ or_(at, at, kScratchReg2); \
449 __ Branch(USE_DELAY_SLOT, ool->entry(), eq, at, Operand(zero_reg)); \ 449 __ Branch(USE_DELAY_SLOT, ool->entry(), eq, at, Operand(zero_reg)); \
450 __ cvt_d_l(i.OutputDoubleRegister(), i.OutputDoubleRegister()); \ 450 __ cvt_d_l(i.OutputDoubleRegister(), i.OutputDoubleRegister()); \
451 __ bind(ool->exit()); \ 451 __ bind(ool->exit()); \
452 __ bind(&done); \ 452 __ bind(&done); \
453 } while (0) 453 } while (0)
454 454
455 455
456 void CodeGenerator::AssembleDeconstructActivationRecord(int stack_param_delta) { 456 void CodeGenerator::AssembleDeconstructActivationRecord(int stack_param_delta) {
457 int sp_slot_delta = TailCallFrameStackSlotDelta(stack_param_delta);
458 if (sp_slot_delta > 0) {
459 __ addiu(sp, sp, sp_slot_delta * kPointerSize);
460 }
457 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); 461 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor();
458 int stack_slots = frame()->GetSpillSlotCount(); 462 int spill_slots = frame()->GetSpillSlotCount();
459 int stack_pointer_delta = 0; 463 bool has_frame = descriptor->IsJSFunctionCall() || spill_slots > 0;
460 if (descriptor->IsJSFunctionCall() || stack_slots > 0) { 464 if (has_frame) {
461 __ mov(sp, fp); 465 __ Pop(ra, fp);
462 __ lw(fp, MemOperand(sp, 0 * kPointerSize));
463 __ lw(ra, MemOperand(sp, 1 * kPointerSize));
464 stack_pointer_delta = 2 * kPointerSize;
465 }
466 if (stack_param_delta < 0) {
467 stack_pointer_delta += -stack_param_delta * kPointerSize;
468 }
469 if (stack_pointer_delta != 0) {
470 __ addiu(sp, sp, stack_pointer_delta);
471 } 466 }
472 } 467 }
473 468
469
470 void CodeGenerator::AssemblePrepareTailCall(int stack_param_delta) {
471 int sp_slot_delta = TailCallFrameStackSlotDelta(stack_param_delta);
472 if (sp_slot_delta < 0) {
473 __ Subu(sp, sp, Operand(-sp_slot_delta * kPointerSize));
474 }
475 }
476
474 477
475 // Assembles an instruction after register allocation, producing machine code. 478 // Assembles an instruction after register allocation, producing machine code.
476 void CodeGenerator::AssembleArchInstruction(Instruction* instr) { 479 void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
477 MipsOperandConverter i(this, instr); 480 MipsOperandConverter i(this, instr);
478 InstructionCode opcode = instr->opcode(); 481 InstructionCode opcode = instr->opcode();
479 482
480 switch (ArchOpcodeField::decode(opcode)) { 483 switch (ArchOpcodeField::decode(opcode)) {
481 case kArchCallCodeObject: { 484 case kArchCallCodeObject: {
482 EnsureSpaceForLazyDeopt(); 485 EnsureSpaceForLazyDeopt();
483 if (instr->InputAt(0)->IsImmediate()) { 486 if (instr->InputAt(0)->IsImmediate()) {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 case kArchLazyBailout: { 536 case kArchLazyBailout: {
534 EnsureSpaceForLazyDeopt(); 537 EnsureSpaceForLazyDeopt();
535 RecordCallPosition(instr); 538 RecordCallPosition(instr);
536 break; 539 break;
537 } 540 }
538 case kArchPrepareCallCFunction: { 541 case kArchPrepareCallCFunction: {
539 int const num_parameters = MiscField::decode(instr->opcode()); 542 int const num_parameters = MiscField::decode(instr->opcode());
540 __ PrepareCallCFunction(num_parameters, kScratchReg); 543 __ PrepareCallCFunction(num_parameters, kScratchReg);
541 break; 544 break;
542 } 545 }
546 case kArchPrepareTailCall:
547 AssemblePrepareTailCall(i.InputInt32(instr->InputCount() - 1));
548 break;
543 case kArchCallCFunction: { 549 case kArchCallCFunction: {
544 int const num_parameters = MiscField::decode(instr->opcode()); 550 int const num_parameters = MiscField::decode(instr->opcode());
545 if (instr->InputAt(0)->IsImmediate()) { 551 if (instr->InputAt(0)->IsImmediate()) {
546 ExternalReference ref = i.InputExternalReference(0); 552 ExternalReference ref = i.InputExternalReference(0);
547 __ CallCFunction(ref, num_parameters); 553 __ CallCFunction(ref, num_parameters);
548 } else { 554 } else {
549 Register func = i.InputRegister(0); 555 Register func = i.InputRegister(0);
550 __ CallCFunction(func, num_parameters); 556 __ CallCFunction(func, num_parameters);
551 } 557 }
552 break; 558 break;
(...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after
1591 padding_size -= v8::internal::Assembler::kInstrSize; 1597 padding_size -= v8::internal::Assembler::kInstrSize;
1592 } 1598 }
1593 } 1599 }
1594 } 1600 }
1595 1601
1596 #undef __ 1602 #undef __
1597 1603
1598 } // namespace compiler 1604 } // namespace compiler
1599 } // namespace internal 1605 } // namespace internal
1600 } // namespace v8 1606 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/linkage.cc ('k') | src/compiler/mips64/code-generator-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698