OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
832 | 832 |
833 // Tear down the exit frame, pop the arguments, and return. | 833 // Tear down the exit frame, pop the arguments, and return. |
834 mov(sp, Operand(fp)); | 834 mov(sp, Operand(fp)); |
835 ldm(ia_w, sp, fp.bit() | lr.bit()); | 835 ldm(ia_w, sp, fp.bit() | lr.bit()); |
836 if (argument_count.is_valid()) { | 836 if (argument_count.is_valid()) { |
837 add(sp, sp, Operand(argument_count, LSL, kPointerSizeLog2)); | 837 add(sp, sp, Operand(argument_count, LSL, kPointerSizeLog2)); |
838 } | 838 } |
839 } | 839 } |
840 | 840 |
841 void MacroAssembler::GetCFunctionDoubleResult(const DoubleRegister dst) { | 841 void MacroAssembler::GetCFunctionDoubleResult(const DoubleRegister dst) { |
842 vmov(dst, r0, r1); | 842 if (FLAG_hardfloat) { |
Søren Thygesen Gjesse
2011/04/27 08:19:01
Please check whether dst is d0.
Karl Klose
2011/04/27 12:54:13
I replaced the vmov with the new MacroAssembler::M
| |
843 vmov(dst, d0); | |
844 } else { | |
845 vmov(dst, r0, r1); | |
846 } | |
843 } | 847 } |
844 | 848 |
845 | 849 |
846 void MacroAssembler::InvokePrologue(const ParameterCount& expected, | 850 void MacroAssembler::InvokePrologue(const ParameterCount& expected, |
847 const ParameterCount& actual, | 851 const ParameterCount& actual, |
848 Handle<Code> code_constant, | 852 Handle<Code> code_constant, |
849 Register code_reg, | 853 Register code_reg, |
850 Label* done, | 854 Label* done, |
851 InvokeFlag flag, | 855 InvokeFlag flag, |
852 CallWrapper* call_wrapper) { | 856 CallWrapper* call_wrapper) { |
(...skipping 1934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2787 int kFlatAsciiStringMask = | 2791 int kFlatAsciiStringMask = |
2788 kIsNotStringMask | kStringEncodingMask | kStringRepresentationMask; | 2792 kIsNotStringMask | kStringEncodingMask | kStringRepresentationMask; |
2789 int kFlatAsciiStringTag = ASCII_STRING_TYPE; | 2793 int kFlatAsciiStringTag = ASCII_STRING_TYPE; |
2790 and_(scratch, type, Operand(kFlatAsciiStringMask)); | 2794 and_(scratch, type, Operand(kFlatAsciiStringMask)); |
2791 cmp(scratch, Operand(kFlatAsciiStringTag)); | 2795 cmp(scratch, Operand(kFlatAsciiStringTag)); |
2792 b(ne, failure); | 2796 b(ne, failure); |
2793 } | 2797 } |
2794 | 2798 |
2795 static const int kRegisterPassedArguments = 4; | 2799 static const int kRegisterPassedArguments = 4; |
2796 | 2800 |
2797 void MacroAssembler::PrepareCallCFunction(int num_arguments, Register scratch) { | 2801 |
2802 void MacroAssembler::PrepareCallCFunction(int num_reg_arguments, | |
2803 int num_double_arguments, | |
2804 Register scratch) { | |
2798 int frame_alignment = ActivationFrameAlignment(); | 2805 int frame_alignment = ActivationFrameAlignment(); |
2799 | 2806 |
2807 int stack_passed_arguments = 0; | |
Søren Thygesen Gjesse
2011/04/27 08:19:01
I am not sure this calculation is 100% correct. If
Karl Klose
2011/04/27 12:54:13
I have added the comment.
| |
2808 if (FLAG_hardfloat) { | |
2809 // In the hard floating point calling convention, we can use | |
2810 // all double registers to pass doubles. | |
2811 if (num_double_arguments > DoubleRegister::kNumRegisters) { | |
2812 stack_passed_arguments += | |
2813 2 * (num_double_arguments - DoubleRegister::kNumRegisters); | |
2814 } | |
2815 } else { | |
2816 // In the soft floating point calling convention, every double | |
2817 // argument is passed using two registers. | |
2818 num_reg_arguments += 2 * num_double_arguments; | |
2819 } | |
2800 // Up to four simple arguments are passed in registers r0..r3. | 2820 // Up to four simple arguments are passed in registers r0..r3. |
2801 int stack_passed_arguments = (num_arguments <= kRegisterPassedArguments) ? | 2821 if (num_reg_arguments > kRegisterPassedArguments) { |
2802 0 : num_arguments - kRegisterPassedArguments; | 2822 stack_passed_arguments += num_reg_arguments - kRegisterPassedArguments; |
2823 } | |
2803 if (frame_alignment > kPointerSize) { | 2824 if (frame_alignment > kPointerSize) { |
2804 // Make stack end at alignment and make room for num_arguments - 4 words | 2825 // Make stack end at alignment and make room for num_arguments - 4 words |
2805 // and the original value of sp. | 2826 // and the original value of sp. |
2806 mov(scratch, sp); | 2827 mov(scratch, sp); |
2807 sub(sp, sp, Operand((stack_passed_arguments + 1) * kPointerSize)); | 2828 sub(sp, sp, Operand((stack_passed_arguments + 1) * kPointerSize)); |
2808 ASSERT(IsPowerOf2(frame_alignment)); | 2829 ASSERT(IsPowerOf2(frame_alignment)); |
2809 and_(sp, sp, Operand(-frame_alignment)); | 2830 and_(sp, sp, Operand(-frame_alignment)); |
2810 str(scratch, MemOperand(sp, stack_passed_arguments * kPointerSize)); | 2831 str(scratch, MemOperand(sp, stack_passed_arguments * kPointerSize)); |
2811 } else { | 2832 } else { |
2812 sub(sp, sp, Operand(stack_passed_arguments * kPointerSize)); | 2833 sub(sp, sp, Operand(stack_passed_arguments * kPointerSize)); |
2813 } | 2834 } |
2814 } | 2835 } |
2815 | 2836 |
2816 | 2837 |
2838 void MacroAssembler::PrepareCallCFunction(int num_reg_arguments, | |
2839 Register scratch) { | |
2840 PrepareCallCFunction(num_reg_arguments, 0, scratch); | |
2841 } | |
2842 | |
2843 | |
2844 void MacroAssembler::SetCallCDoubleArguments(DoubleRegister dreg) { | |
2845 if (FLAG_hardfloat) { | |
Søren Thygesen Gjesse
2011/04/27 08:19:01
Please check if dreg is d0. Maybe add VMove to the
Karl Klose
2011/04/27 12:54:13
Used Move.
| |
2846 vmov(d0, dreg); | |
2847 } else { | |
2848 vmov(r0, r1, dreg); | |
2849 } | |
2850 } | |
2851 | |
2852 | |
2853 void MacroAssembler::SetCallCDoubleArguments(DoubleRegister dreg1, | |
2854 DoubleRegister dreg2) { | |
2855 if (FLAG_hardfloat) { | |
Søren Thygesen Gjesse
2011/04/27 08:19:01
Ditto.
Karl Klose
2011/04/27 12:54:13
Done.
| |
2856 vmov(d0, dreg1); | |
2857 vmov(d1, dreg2); | |
2858 } else { | |
2859 vmov(r0, r1, dreg1); | |
2860 vmov(r2, r3, dreg2); | |
2861 } | |
2862 } | |
2863 | |
2864 | |
2865 void MacroAssembler::SetCallCDoubleArguments(DoubleRegister dreg, | |
2866 Register reg) { | |
2867 if (FLAG_hardfloat) { | |
Søren Thygesen Gjesse
2011/04/27 08:19:01
Ditto (also mov -> Move).
Karl Klose
2011/04/27 12:54:13
Done.
| |
2868 vmov(d0, dreg); | |
2869 mov(r0, reg); | |
2870 } else { | |
2871 mov(r2, reg); | |
2872 vmov(r0, r1, dreg); | |
2873 } | |
2874 } | |
2875 | |
2876 | |
2817 void MacroAssembler::CallCFunction(ExternalReference function, | 2877 void MacroAssembler::CallCFunction(ExternalReference function, |
2818 int num_arguments) { | 2878 int num_arguments) { |
2819 CallCFunctionHelper(no_reg, function, ip, num_arguments); | 2879 CallCFunctionHelper(no_reg, function, ip, num_arguments); |
2820 } | 2880 } |
2821 | 2881 |
2882 | |
2822 void MacroAssembler::CallCFunction(Register function, | 2883 void MacroAssembler::CallCFunction(Register function, |
2823 Register scratch, | 2884 Register scratch, |
2824 int num_arguments) { | 2885 int num_arguments) { |
2825 CallCFunctionHelper(function, | 2886 CallCFunctionHelper(function, |
2826 ExternalReference::the_hole_value_location(isolate()), | 2887 ExternalReference::the_hole_value_location(isolate()), |
2827 scratch, | 2888 scratch, |
2828 num_arguments); | 2889 num_arguments); |
2829 } | 2890 } |
2830 | 2891 |
2831 | 2892 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2926 void CodePatcher::EmitCondition(Condition cond) { | 2987 void CodePatcher::EmitCondition(Condition cond) { |
2927 Instr instr = Assembler::instr_at(masm_.pc_); | 2988 Instr instr = Assembler::instr_at(masm_.pc_); |
2928 instr = (instr & ~kCondMask) | cond; | 2989 instr = (instr & ~kCondMask) | cond; |
2929 masm_.emit(instr); | 2990 masm_.emit(instr); |
2930 } | 2991 } |
2931 | 2992 |
2932 | 2993 |
2933 } } // namespace v8::internal | 2994 } } // namespace v8::internal |
2934 | 2995 |
2935 #endif // V8_TARGET_ARCH_ARM | 2996 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |