| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
| 8 #include "src/compiler/code-generator-impl.h" | 8 #include "src/compiler/code-generator-impl.h" |
| 9 #include "src/compiler/gap-resolver.h" | 9 #include "src/compiler/gap-resolver.h" |
| 10 #include "src/compiler/node-matchers.h" | 10 #include "src/compiler/node-matchers.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 MemOperand MemoryOperand(AddressingMode* mode, size_t first_index = 0) { | 85 MemOperand MemoryOperand(AddressingMode* mode, size_t first_index = 0) { |
| 86 return MemoryOperand(mode, &first_index); | 86 return MemoryOperand(mode, &first_index); |
| 87 } | 87 } |
| 88 | 88 |
| 89 MemOperand ToMemOperand(InstructionOperand* op) const { | 89 MemOperand ToMemOperand(InstructionOperand* op) const { |
| 90 DCHECK_NOT_NULL(op); | 90 DCHECK_NOT_NULL(op); |
| 91 DCHECK(op->IsStackSlot() || op->IsDoubleStackSlot()); | 91 DCHECK(op->IsStackSlot() || op->IsDoubleStackSlot()); |
| 92 return SlotToMemOperand(AllocatedOperand::cast(op)->index()); | 92 return SlotToMemOperand(AllocatedOperand::cast(op)->index()); |
| 93 } | 93 } |
| 94 | 94 |
| 95 MemOperand SlotToMemOperand(int slot) { | 95 MemOperand SlotToMemOperand(int slot) const { |
| 96 FrameOffset offset = frame_access_state()->GetFrameOffset(slot); | 96 FrameOffset offset = frame_access_state()->GetFrameOffset(slot); |
| 97 return MemOperand(offset.from_stack_pointer() ? sp : fp, offset.offset()); | 97 return MemOperand(offset.from_stack_pointer() ? sp : fp, offset.offset()); |
| 98 } | 98 } |
| 99 }; | 99 }; |
| 100 | 100 |
| 101 static inline bool HasRegisterInput(Instruction* instr, int index) { | 101 static inline bool HasRegisterInput(Instruction* instr, int index) { |
| 102 return instr->InputAt(index)->IsRegister(); | 102 return instr->InputAt(index)->IsRegister(); |
| 103 } | 103 } |
| 104 | 104 |
| 105 namespace { | 105 namespace { |
| (...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 if (sp_slot_delta < 0) { | 573 if (sp_slot_delta < 0) { |
| 574 __ AddP(sp, sp, Operand(sp_slot_delta * kPointerSize)); | 574 __ AddP(sp, sp, Operand(sp_slot_delta * kPointerSize)); |
| 575 frame_access_state()->IncreaseSPDelta(-sp_slot_delta); | 575 frame_access_state()->IncreaseSPDelta(-sp_slot_delta); |
| 576 } | 576 } |
| 577 if (frame()->needs_frame()) { | 577 if (frame()->needs_frame()) { |
| 578 __ RestoreFrameStateForTailCall(); | 578 __ RestoreFrameStateForTailCall(); |
| 579 } | 579 } |
| 580 frame_access_state()->SetFrameAccessToSP(); | 580 frame_access_state()->SetFrameAccessToSP(); |
| 581 } | 581 } |
| 582 | 582 |
| 583 void CodeGenerator::AssemblePopArgumentsAdaptorFrame(Register args_reg, |
| 584 Register scratch1, |
| 585 Register scratch2, |
| 586 Register scratch3) { |
| 587 DCHECK(!AreAliased(args_reg, scratch1, scratch2, scratch3)); |
| 588 Label done; |
| 589 |
| 590 // Check if current frame is an arguments adaptor frame. |
| 591 __ LoadP(scratch1, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 592 __ CmpSmiLiteral(scratch1, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR), r0); |
| 593 __ bne(&done); |
| 594 |
| 595 // Load arguments count from current arguments adaptor frame (note, it |
| 596 // does not include receiver). |
| 597 Register caller_args_count_reg = scratch1; |
| 598 __ LoadP(caller_args_count_reg, |
| 599 MemOperand(fp, ArgumentsAdaptorFrameConstants::kLengthOffset)); |
| 600 __ SmiUntag(caller_args_count_reg); |
| 601 |
| 602 ParameterCount callee_args_count(args_reg); |
| 603 __ PrepareForTailCall(callee_args_count, caller_args_count_reg, scratch2, |
| 604 scratch3); |
| 605 __ bind(&done); |
| 606 } |
| 607 |
| 583 // Assembles an instruction after register allocation, producing machine code. | 608 // Assembles an instruction after register allocation, producing machine code. |
| 584 void CodeGenerator::AssembleArchInstruction(Instruction* instr) { | 609 void CodeGenerator::AssembleArchInstruction(Instruction* instr) { |
| 585 S390OperandConverter i(this, instr); | 610 S390OperandConverter i(this, instr); |
| 586 ArchOpcode opcode = ArchOpcodeField::decode(instr->opcode()); | 611 ArchOpcode opcode = ArchOpcodeField::decode(instr->opcode()); |
| 587 | 612 |
| 588 switch (opcode) { | 613 switch (opcode) { |
| 589 case kArchCallCodeObject: { | 614 case kArchCallCodeObject: { |
| 590 EnsureSpaceForLazyDeopt(); | 615 EnsureSpaceForLazyDeopt(); |
| 591 if (HasRegisterInput(instr, 0)) { | 616 if (HasRegisterInput(instr, 0)) { |
| 592 __ AddP(ip, i.InputRegister(0), | 617 __ AddP(ip, i.InputRegister(0), |
| 593 Operand(Code::kHeaderSize - kHeapObjectTag)); | 618 Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 594 __ Call(ip); | 619 __ Call(ip); |
| 595 } else { | 620 } else { |
| 596 __ Call(Handle<Code>::cast(i.InputHeapObject(0)), | 621 __ Call(Handle<Code>::cast(i.InputHeapObject(0)), |
| 597 RelocInfo::CODE_TARGET); | 622 RelocInfo::CODE_TARGET); |
| 598 } | 623 } |
| 599 RecordCallPosition(instr); | 624 RecordCallPosition(instr); |
| 600 frame_access_state()->ClearSPDelta(); | 625 frame_access_state()->ClearSPDelta(); |
| 601 break; | 626 break; |
| 602 } | 627 } |
| 628 case kArchTailCallCodeObjectFromJSFunction: |
| 603 case kArchTailCallCodeObject: { | 629 case kArchTailCallCodeObject: { |
| 604 int stack_param_delta = i.InputInt32(instr->InputCount() - 1); | 630 int stack_param_delta = i.InputInt32(instr->InputCount() - 1); |
| 605 AssembleDeconstructActivationRecord(stack_param_delta); | 631 AssembleDeconstructActivationRecord(stack_param_delta); |
| 632 if (opcode == kArchTailCallCodeObjectFromJSFunction) { |
| 633 AssemblePopArgumentsAdaptorFrame(kJavaScriptCallArgCountRegister, |
| 634 i.TempRegister(0), i.TempRegister(1), |
| 635 i.TempRegister(2)); |
| 636 } |
| 606 if (HasRegisterInput(instr, 0)) { | 637 if (HasRegisterInput(instr, 0)) { |
| 607 __ AddP(ip, i.InputRegister(0), | 638 __ AddP(ip, i.InputRegister(0), |
| 608 Operand(Code::kHeaderSize - kHeapObjectTag)); | 639 Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 609 __ Jump(ip); | 640 __ Jump(ip); |
| 610 } else { | 641 } else { |
| 611 // We cannot use the constant pool to load the target since | 642 // We cannot use the constant pool to load the target since |
| 612 // we've already restored the caller's frame. | 643 // we've already restored the caller's frame. |
| 613 ConstantPoolUnavailableScope constant_pool_unavailable(masm()); | 644 ConstantPoolUnavailableScope constant_pool_unavailable(masm()); |
| 614 __ Jump(Handle<Code>::cast(i.InputHeapObject(0)), | 645 __ Jump(Handle<Code>::cast(i.InputHeapObject(0)), |
| 615 RelocInfo::CODE_TARGET); | 646 RelocInfo::CODE_TARGET); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 626 FieldMemOperand(func, JSFunction::kContextOffset)); | 657 FieldMemOperand(func, JSFunction::kContextOffset)); |
| 627 __ CmpP(cp, kScratchReg); | 658 __ CmpP(cp, kScratchReg); |
| 628 __ Assert(eq, kWrongFunctionContext); | 659 __ Assert(eq, kWrongFunctionContext); |
| 629 } | 660 } |
| 630 __ LoadP(ip, FieldMemOperand(func, JSFunction::kCodeEntryOffset)); | 661 __ LoadP(ip, FieldMemOperand(func, JSFunction::kCodeEntryOffset)); |
| 631 __ Call(ip); | 662 __ Call(ip); |
| 632 RecordCallPosition(instr); | 663 RecordCallPosition(instr); |
| 633 frame_access_state()->ClearSPDelta(); | 664 frame_access_state()->ClearSPDelta(); |
| 634 break; | 665 break; |
| 635 } | 666 } |
| 667 case kArchTailCallJSFunctionFromJSFunction: |
| 636 case kArchTailCallJSFunction: { | 668 case kArchTailCallJSFunction: { |
| 637 Register func = i.InputRegister(0); | 669 Register func = i.InputRegister(0); |
| 638 if (FLAG_debug_code) { | 670 if (FLAG_debug_code) { |
| 639 // Check the function's context matches the context argument. | 671 // Check the function's context matches the context argument. |
| 640 __ LoadP(kScratchReg, | 672 __ LoadP(kScratchReg, |
| 641 FieldMemOperand(func, JSFunction::kContextOffset)); | 673 FieldMemOperand(func, JSFunction::kContextOffset)); |
| 642 __ CmpP(cp, kScratchReg); | 674 __ CmpP(cp, kScratchReg); |
| 643 __ Assert(eq, kWrongFunctionContext); | 675 __ Assert(eq, kWrongFunctionContext); |
| 644 } | 676 } |
| 645 int stack_param_delta = i.InputInt32(instr->InputCount() - 1); | 677 int stack_param_delta = i.InputInt32(instr->InputCount() - 1); |
| 646 AssembleDeconstructActivationRecord(stack_param_delta); | 678 AssembleDeconstructActivationRecord(stack_param_delta); |
| 679 if (opcode == kArchTailCallJSFunctionFromJSFunction) { |
| 680 AssemblePopArgumentsAdaptorFrame(kJavaScriptCallArgCountRegister, |
| 681 i.TempRegister(0), i.TempRegister(1), |
| 682 i.TempRegister(2)); |
| 683 } |
| 647 __ LoadP(ip, FieldMemOperand(func, JSFunction::kCodeEntryOffset)); | 684 __ LoadP(ip, FieldMemOperand(func, JSFunction::kCodeEntryOffset)); |
| 648 __ Jump(ip); | 685 __ Jump(ip); |
| 649 frame_access_state()->ClearSPDelta(); | 686 frame_access_state()->ClearSPDelta(); |
| 650 break; | 687 break; |
| 651 } | 688 } |
| 652 case kArchPrepareCallCFunction: { | 689 case kArchPrepareCallCFunction: { |
| 653 int const num_parameters = MiscField::decode(instr->opcode()); | 690 int const num_parameters = MiscField::decode(instr->opcode()); |
| 654 __ PrepareCallCFunction(num_parameters, kScratchReg); | 691 __ PrepareCallCFunction(num_parameters, kScratchReg); |
| 655 // Frame alignment requires using FP-relative frame addressing. | 692 // Frame alignment requires using FP-relative frame addressing. |
| 656 frame_access_state()->SetFrameAccessToFP(); | 693 frame_access_state()->SetFrameAccessToFP(); |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 799 } | 836 } |
| 800 #if V8_TARGET_ARCH_S390X | 837 #if V8_TARGET_ARCH_S390X |
| 801 __ lgfr(i.OutputRegister(0), i.OutputRegister(0)); | 838 __ lgfr(i.OutputRegister(0), i.OutputRegister(0)); |
| 802 #endif | 839 #endif |
| 803 break; | 840 break; |
| 804 #if V8_TARGET_ARCH_S390X | 841 #if V8_TARGET_ARCH_S390X |
| 805 case kS390_ShiftRight64: | 842 case kS390_ShiftRight64: |
| 806 ASSEMBLE_BINOP(srlg, srlg); | 843 ASSEMBLE_BINOP(srlg, srlg); |
| 807 break; | 844 break; |
| 808 #endif | 845 #endif |
| 809 case kS390_ShiftRightAlg32: | 846 case kS390_ShiftRightArith32: |
| 810 if (HasRegisterInput(instr, 1)) { | 847 if (HasRegisterInput(instr, 1)) { |
| 811 if (i.OutputRegister().is(i.InputRegister(1))) { | 848 if (i.OutputRegister().is(i.InputRegister(1))) { |
| 812 __ LoadRR(kScratchReg, i.InputRegister(1)); | 849 __ LoadRR(kScratchReg, i.InputRegister(1)); |
| 813 __ ShiftRightArith(i.OutputRegister(), i.InputRegister(0), | 850 __ ShiftRightArith(i.OutputRegister(), i.InputRegister(0), |
| 814 kScratchReg); | 851 kScratchReg); |
| 815 } else { | 852 } else { |
| 816 ASSEMBLE_BINOP(ShiftRightArith, ShiftRightArith); | 853 ASSEMBLE_BINOP(ShiftRightArith, ShiftRightArith); |
| 817 } | 854 } |
| 818 } else { | 855 } else { |
| 819 ASSEMBLE_BINOP(ShiftRightArith, ShiftRightArith); | 856 ASSEMBLE_BINOP(ShiftRightArith, ShiftRightArith); |
| 820 } | 857 } |
| 821 break; | 858 break; |
| 822 #if V8_TARGET_ARCH_S390X | 859 #if V8_TARGET_ARCH_S390X |
| 823 case kS390_ShiftRightAlg64: | 860 case kS390_ShiftRightArith64: |
| 824 ASSEMBLE_BINOP(srag, srag); | 861 ASSEMBLE_BINOP(srag, srag); |
| 825 break; | 862 break; |
| 826 #endif | 863 #endif |
| 864 #if !V8_TARGET_ARCH_S390X |
| 865 case kS390_ShiftLeftPair: |
| 866 if (instr->InputAt(2)->IsImmediate()) { |
| 867 __ ShiftLeftPair(i.OutputRegister(0), i.OutputRegister(1), |
| 868 i.InputRegister(0), i.InputRegister(1), |
| 869 i.InputInt32(2)); |
| 870 } else { |
| 871 __ ShiftLeftPair(i.OutputRegister(0), i.OutputRegister(1), |
| 872 i.InputRegister(0), i.InputRegister(1), kScratchReg, |
| 873 i.InputRegister(2)); |
| 874 } |
| 875 break; |
| 876 case kS390_ShiftRightPair: |
| 877 if (instr->InputAt(2)->IsImmediate()) { |
| 878 __ ShiftRightPair(i.OutputRegister(0), i.OutputRegister(1), |
| 879 i.InputRegister(0), i.InputRegister(1), |
| 880 i.InputInt32(2)); |
| 881 } else { |
| 882 __ ShiftRightPair(i.OutputRegister(0), i.OutputRegister(1), |
| 883 i.InputRegister(0), i.InputRegister(1), kScratchReg, |
| 884 i.InputRegister(2)); |
| 885 } |
| 886 break; |
| 887 case kS390_ShiftRightArithPair: |
| 888 if (instr->InputAt(2)->IsImmediate()) { |
| 889 __ ShiftRightArithPair(i.OutputRegister(0), i.OutputRegister(1), |
| 890 i.InputRegister(0), i.InputRegister(1), |
| 891 i.InputInt32(2)); |
| 892 } else { |
| 893 __ ShiftRightArithPair(i.OutputRegister(0), i.OutputRegister(1), |
| 894 i.InputRegister(0), i.InputRegister(1), |
| 895 kScratchReg, i.InputRegister(2)); |
| 896 } |
| 897 break; |
| 898 #endif |
| 827 case kS390_RotRight32: | 899 case kS390_RotRight32: |
| 828 if (HasRegisterInput(instr, 1)) { | 900 if (HasRegisterInput(instr, 1)) { |
| 829 __ LoadComplementRR(kScratchReg, i.InputRegister(1)); | 901 __ LoadComplementRR(kScratchReg, i.InputRegister(1)); |
| 830 __ rll(i.OutputRegister(), i.InputRegister(0), kScratchReg); | 902 __ rll(i.OutputRegister(), i.InputRegister(0), kScratchReg); |
| 831 } else { | 903 } else { |
| 832 __ rll(i.OutputRegister(), i.InputRegister(0), | 904 __ rll(i.OutputRegister(), i.InputRegister(0), |
| 833 Operand(32 - i.InputInt32(1))); | 905 Operand(32 - i.InputInt32(1))); |
| 834 } | 906 } |
| 835 break; | 907 break; |
| 836 #if V8_TARGET_ARCH_S390X | 908 #if V8_TARGET_ARCH_S390X |
| (...skipping 14 matching lines...) Expand all Loading... |
| 851 break; | 923 break; |
| 852 case kS390_RotLeftAndMask32: | 924 case kS390_RotLeftAndMask32: |
| 853 if (CpuFeatures::IsSupported(GENERAL_INSTR_EXT)) { | 925 if (CpuFeatures::IsSupported(GENERAL_INSTR_EXT)) { |
| 854 int shiftAmount = i.InputInt32(1); | 926 int shiftAmount = i.InputInt32(1); |
| 855 int endBit = 63 - i.InputInt32(3); | 927 int endBit = 63 - i.InputInt32(3); |
| 856 int startBit = 63 - i.InputInt32(2); | 928 int startBit = 63 - i.InputInt32(2); |
| 857 __ rll(i.OutputRegister(), i.InputRegister(0), Operand(shiftAmount)); | 929 __ rll(i.OutputRegister(), i.InputRegister(0), Operand(shiftAmount)); |
| 858 __ risbg(i.OutputRegister(), i.OutputRegister(), Operand(startBit), | 930 __ risbg(i.OutputRegister(), i.OutputRegister(), Operand(startBit), |
| 859 Operand(endBit), Operand::Zero(), true); | 931 Operand(endBit), Operand::Zero(), true); |
| 860 } else { | 932 } else { |
| 861 UNIMPLEMENTED(); | 933 int shiftAmount = i.InputInt32(1); |
| 934 int clearBitLeft = 63 - i.InputInt32(2); |
| 935 int clearBitRight = i.InputInt32(3); |
| 936 __ rll(i.OutputRegister(), i.InputRegister(0), Operand(shiftAmount)); |
| 937 __ sllg(i.OutputRegister(), i.OutputRegister(), Operand(clearBitLeft)); |
| 938 __ srlg(i.OutputRegister(), i.OutputRegister(), |
| 939 Operand((clearBitLeft + clearBitRight))); |
| 940 __ sllg(i.OutputRegister(), i.OutputRegister(), Operand(clearBitRight)); |
| 862 } | 941 } |
| 863 break; | 942 break; |
| 864 #if V8_TARGET_ARCH_S390X | 943 #if V8_TARGET_ARCH_S390X |
| 865 case kS390_RotLeftAndClear64: | 944 case kS390_RotLeftAndClear64: |
| 866 UNIMPLEMENTED(); // Find correct instruction | 945 UNIMPLEMENTED(); // Find correct instruction |
| 867 break; | 946 break; |
| 868 case kS390_RotLeftAndClearLeft64: | 947 case kS390_RotLeftAndClearLeft64: |
| 869 if (CpuFeatures::IsSupported(GENERAL_INSTR_EXT)) { | 948 if (CpuFeatures::IsSupported(GENERAL_INSTR_EXT)) { |
| 870 int shiftAmount = i.InputInt32(1); | 949 int shiftAmount = i.InputInt32(1); |
| 871 int endBit = 63; | 950 int endBit = 63; |
| 872 int startBit = 63 - i.InputInt32(2); | 951 int startBit = 63 - i.InputInt32(2); |
| 873 __ risbg(i.OutputRegister(), i.InputRegister(0), Operand(startBit), | 952 __ risbg(i.OutputRegister(), i.InputRegister(0), Operand(startBit), |
| 874 Operand(endBit), Operand(shiftAmount), true); | 953 Operand(endBit), Operand(shiftAmount), true); |
| 875 } else { | 954 } else { |
| 876 UNIMPLEMENTED(); | 955 int shiftAmount = i.InputInt32(1); |
| 956 int clearBit = 63 - i.InputInt32(2); |
| 957 __ rllg(i.OutputRegister(), i.InputRegister(0), Operand(shiftAmount)); |
| 958 __ sllg(i.OutputRegister(), i.OutputRegister(), Operand(clearBit)); |
| 959 __ srlg(i.OutputRegister(), i.OutputRegister(), Operand(clearBit)); |
| 877 } | 960 } |
| 878 break; | 961 break; |
| 879 case kS390_RotLeftAndClearRight64: | 962 case kS390_RotLeftAndClearRight64: |
| 880 if (CpuFeatures::IsSupported(GENERAL_INSTR_EXT)) { | 963 if (CpuFeatures::IsSupported(GENERAL_INSTR_EXT)) { |
| 881 int shiftAmount = i.InputInt32(1); | 964 int shiftAmount = i.InputInt32(1); |
| 882 int endBit = 63 - i.InputInt32(2); | 965 int endBit = 63 - i.InputInt32(2); |
| 883 int startBit = 0; | 966 int startBit = 0; |
| 884 __ risbg(i.OutputRegister(), i.InputRegister(0), Operand(startBit), | 967 __ risbg(i.OutputRegister(), i.InputRegister(0), Operand(startBit), |
| 885 Operand(endBit), Operand(shiftAmount), true); | 968 Operand(endBit), Operand(shiftAmount), true); |
| 886 } else { | 969 } else { |
| 887 UNIMPLEMENTED(); | 970 int shiftAmount = i.InputInt32(1); |
| 971 int clearBit = i.InputInt32(2); |
| 972 __ rllg(i.OutputRegister(), i.InputRegister(0), Operand(shiftAmount)); |
| 973 __ srlg(i.OutputRegister(), i.OutputRegister(), Operand(clearBit)); |
| 974 __ sllg(i.OutputRegister(), i.OutputRegister(), Operand(clearBit)); |
| 888 } | 975 } |
| 889 break; | 976 break; |
| 890 #endif | 977 #endif |
| 891 case kS390_Add: | 978 case kS390_Add: |
| 892 #if V8_TARGET_ARCH_S390X | 979 #if V8_TARGET_ARCH_S390X |
| 893 if (FlagsModeField::decode(instr->opcode()) != kFlags_none) { | 980 if (FlagsModeField::decode(instr->opcode()) != kFlags_none) { |
| 894 ASSEMBLE_ADD_WITH_OVERFLOW(); | 981 ASSEMBLE_ADD_WITH_OVERFLOW(); |
| 895 } else { | 982 } else { |
| 896 #endif | 983 #endif |
| 897 ASSEMBLE_BINOP(AddP, AddP); | 984 ASSEMBLE_BINOP(AddP, AddP); |
| (...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1645 isolate(), deoptimization_id, bailout_type); | 1732 isolate(), deoptimization_id, bailout_type); |
| 1646 // TODO(turbofan): We should be able to generate better code by sharing the | 1733 // TODO(turbofan): We should be able to generate better code by sharing the |
| 1647 // actual final call site and just bl'ing to it here, similar to what we do | 1734 // actual final call site and just bl'ing to it here, similar to what we do |
| 1648 // in the lithium backend. | 1735 // in the lithium backend. |
| 1649 __ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY); | 1736 __ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY); |
| 1650 } | 1737 } |
| 1651 | 1738 |
| 1652 void CodeGenerator::AssemblePrologue() { | 1739 void CodeGenerator::AssemblePrologue() { |
| 1653 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); | 1740 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
| 1654 | 1741 |
| 1655 if (descriptor->IsCFunctionCall()) { | 1742 if (frame()->needs_frame()) { |
| 1656 __ Push(r14, fp); | 1743 if (descriptor->IsCFunctionCall()) { |
| 1657 __ LoadRR(fp, sp); | 1744 __ Push(r14, fp); |
| 1658 } else if (descriptor->IsJSFunctionCall()) { | 1745 __ LoadRR(fp, sp); |
| 1659 __ Prologue(this->info()->GeneratePreagedPrologue(), ip); | 1746 } else if (descriptor->IsJSFunctionCall()) { |
| 1660 } else if (frame()->needs_frame()) { | 1747 __ Prologue(this->info()->GeneratePreagedPrologue(), ip); |
| 1661 if (!ABI_CALL_VIA_IP && info()->output_code_kind() == Code::WASM_FUNCTION) { | |
| 1662 // TODO(mbrandy): Restrict only to the wasm wrapper case. | |
| 1663 __ StubPrologue(); | |
| 1664 } else { | 1748 } else { |
| 1665 __ StubPrologue(ip); | 1749 StackFrame::Type type = info()->GetOutputStackFrameType(); |
| 1750 if (!ABI_CALL_VIA_IP && |
| 1751 info()->output_code_kind() == Code::WASM_FUNCTION) { |
| 1752 // TODO(mbrandy): Restrict only to the wasm wrapper case. |
| 1753 __ StubPrologue(type); |
| 1754 } else { |
| 1755 __ StubPrologue(type, ip); |
| 1756 } |
| 1666 } | 1757 } |
| 1667 } else { | 1758 } else { |
| 1668 frame()->SetElidedFrameSizeInSlots(0); | 1759 frame()->SetElidedFrameSizeInSlots(0); |
| 1669 } | 1760 } |
| 1670 frame_access_state()->SetFrameAccessToDefault(); | 1761 frame_access_state()->SetFrameAccessToDefault(); |
| 1671 | 1762 |
| 1672 int stack_shrink_slots = frame()->GetSpillSlotCount(); | 1763 int stack_shrink_slots = frame()->GetSpillSlotCount(); |
| 1673 if (info()->is_osr()) { | 1764 if (info()->is_osr()) { |
| 1674 // TurboFan OSR-compiled functions cannot be entered directly. | 1765 // TurboFan OSR-compiled functions cannot be entered directly. |
| 1675 __ Abort(kShouldNotDirectlyEnterOsrFunction); | 1766 __ Abort(kShouldNotDirectlyEnterOsrFunction); |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1947 padding_size -= 2; | 2038 padding_size -= 2; |
| 1948 } | 2039 } |
| 1949 } | 2040 } |
| 1950 } | 2041 } |
| 1951 | 2042 |
| 1952 #undef __ | 2043 #undef __ |
| 1953 | 2044 |
| 1954 } // namespace compiler | 2045 } // namespace compiler |
| 1955 } // namespace internal | 2046 } // namespace internal |
| 1956 } // namespace v8 | 2047 } // namespace v8 |
| OLD | NEW |