OLD | NEW |
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 Loading... |
447 __ asm_instr(i.OutputDoubleRegister(), i.InputDoubleRegister(0)); \ | 447 __ asm_instr(i.OutputDoubleRegister(), i.InputDoubleRegister(0)); \ |
448 __ dmfc1(at, i.OutputDoubleRegister()); \ | 448 __ dmfc1(at, i.OutputDoubleRegister()); \ |
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 __ daddiu(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 __ ld(fp, MemOperand(sp, 0 * kPointerSize)); | |
463 __ ld(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 __ daddiu(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 __ Dsubu(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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 case kArchLazyBailout: { | 534 case kArchLazyBailout: { |
532 EnsureSpaceForLazyDeopt(); | 535 EnsureSpaceForLazyDeopt(); |
533 RecordCallPosition(instr); | 536 RecordCallPosition(instr); |
534 break; | 537 break; |
535 } | 538 } |
536 case kArchPrepareCallCFunction: { | 539 case kArchPrepareCallCFunction: { |
537 int const num_parameters = MiscField::decode(instr->opcode()); | 540 int const num_parameters = MiscField::decode(instr->opcode()); |
538 __ PrepareCallCFunction(num_parameters, kScratchReg); | 541 __ PrepareCallCFunction(num_parameters, kScratchReg); |
539 break; | 542 break; |
540 } | 543 } |
| 544 case kArchPrepareTailCall: |
| 545 AssemblePrepareTailCall(i.InputInt32(instr->InputCount() - 1)); |
| 546 break; |
541 case kArchCallCFunction: { | 547 case kArchCallCFunction: { |
542 int const num_parameters = MiscField::decode(instr->opcode()); | 548 int const num_parameters = MiscField::decode(instr->opcode()); |
543 if (instr->InputAt(0)->IsImmediate()) { | 549 if (instr->InputAt(0)->IsImmediate()) { |
544 ExternalReference ref = i.InputExternalReference(0); | 550 ExternalReference ref = i.InputExternalReference(0); |
545 __ CallCFunction(ref, num_parameters); | 551 __ CallCFunction(ref, num_parameters); |
546 } else { | 552 } else { |
547 Register func = i.InputRegister(0); | 553 Register func = i.InputRegister(0); |
548 __ CallCFunction(func, num_parameters); | 554 __ CallCFunction(func, num_parameters); |
549 } | 555 } |
550 break; | 556 break; |
(...skipping 1150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1701 padding_size -= v8::internal::Assembler::kInstrSize; | 1707 padding_size -= v8::internal::Assembler::kInstrSize; |
1702 } | 1708 } |
1703 } | 1709 } |
1704 } | 1710 } |
1705 | 1711 |
1706 #undef __ | 1712 #undef __ |
1707 | 1713 |
1708 } // namespace compiler | 1714 } // namespace compiler |
1709 } // namespace internal | 1715 } // namespace internal |
1710 } // namespace v8 | 1716 } // namespace v8 |
OLD | NEW |