| 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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 } | 279 } |
| 280 | 280 |
| 281 | 281 |
| 282 void MacroAssembler::Move(Register dst, Register src) { | 282 void MacroAssembler::Move(Register dst, Register src) { |
| 283 if (!dst.is(src)) { | 283 if (!dst.is(src)) { |
| 284 mov(dst, src); | 284 mov(dst, src); |
| 285 } | 285 } |
| 286 } | 286 } |
| 287 | 287 |
| 288 | 288 |
| 289 void MacroAssembler::Move(DoubleRegister dst, DoubleRegister src) { |
| 290 ASSERT(CpuFeatures::IsSupported(VFP3)); |
| 291 CpuFeatures::Scope scope(VFP3); |
| 292 if (!dst.is(src)) { |
| 293 vmov(dst, src); |
| 294 } |
| 295 } |
| 296 |
| 297 |
| 289 void MacroAssembler::And(Register dst, Register src1, const Operand& src2, | 298 void MacroAssembler::And(Register dst, Register src1, const Operand& src2, |
| 290 Condition cond) { | 299 Condition cond) { |
| 291 if (!src2.is_reg() && | 300 if (!src2.is_reg() && |
| 292 !src2.must_use_constant_pool() && | 301 !src2.must_use_constant_pool() && |
| 293 src2.immediate() == 0) { | 302 src2.immediate() == 0) { |
| 294 mov(dst, Operand(0, RelocInfo::NONE), LeaveCC, cond); | 303 mov(dst, Operand(0, RelocInfo::NONE), LeaveCC, cond); |
| 295 | 304 |
| 296 } else if (!src2.is_single_instruction() && | 305 } else if (!src2.is_single_instruction() && |
| 297 !src2.must_use_constant_pool() && | 306 !src2.must_use_constant_pool() && |
| 298 CpuFeatures::IsSupported(ARMv7) && | 307 CpuFeatures::IsSupported(ARMv7) && |
| (...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 832 | 841 |
| 833 // Tear down the exit frame, pop the arguments, and return. | 842 // Tear down the exit frame, pop the arguments, and return. |
| 834 mov(sp, Operand(fp)); | 843 mov(sp, Operand(fp)); |
| 835 ldm(ia_w, sp, fp.bit() | lr.bit()); | 844 ldm(ia_w, sp, fp.bit() | lr.bit()); |
| 836 if (argument_count.is_valid()) { | 845 if (argument_count.is_valid()) { |
| 837 add(sp, sp, Operand(argument_count, LSL, kPointerSizeLog2)); | 846 add(sp, sp, Operand(argument_count, LSL, kPointerSizeLog2)); |
| 838 } | 847 } |
| 839 } | 848 } |
| 840 | 849 |
| 841 void MacroAssembler::GetCFunctionDoubleResult(const DoubleRegister dst) { | 850 void MacroAssembler::GetCFunctionDoubleResult(const DoubleRegister dst) { |
| 842 vmov(dst, r0, r1); | 851 if (FLAG_hardfloat) { |
| 852 Move(dst, d0); |
| 853 } else { |
| 854 vmov(dst, r0, r1); |
| 855 } |
| 843 } | 856 } |
| 844 | 857 |
| 845 | 858 |
| 846 void MacroAssembler::InvokePrologue(const ParameterCount& expected, | 859 void MacroAssembler::InvokePrologue(const ParameterCount& expected, |
| 847 const ParameterCount& actual, | 860 const ParameterCount& actual, |
| 848 Handle<Code> code_constant, | 861 Handle<Code> code_constant, |
| 849 Register code_reg, | 862 Register code_reg, |
| 850 Label* done, | 863 Label* done, |
| 851 InvokeFlag flag, | 864 InvokeFlag flag, |
| 852 CallWrapper* call_wrapper) { | 865 CallWrapper* call_wrapper) { |
| (...skipping 1934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2787 int kFlatAsciiStringMask = | 2800 int kFlatAsciiStringMask = |
| 2788 kIsNotStringMask | kStringEncodingMask | kStringRepresentationMask; | 2801 kIsNotStringMask | kStringEncodingMask | kStringRepresentationMask; |
| 2789 int kFlatAsciiStringTag = ASCII_STRING_TYPE; | 2802 int kFlatAsciiStringTag = ASCII_STRING_TYPE; |
| 2790 and_(scratch, type, Operand(kFlatAsciiStringMask)); | 2803 and_(scratch, type, Operand(kFlatAsciiStringMask)); |
| 2791 cmp(scratch, Operand(kFlatAsciiStringTag)); | 2804 cmp(scratch, Operand(kFlatAsciiStringTag)); |
| 2792 b(ne, failure); | 2805 b(ne, failure); |
| 2793 } | 2806 } |
| 2794 | 2807 |
| 2795 static const int kRegisterPassedArguments = 4; | 2808 static const int kRegisterPassedArguments = 4; |
| 2796 | 2809 |
| 2797 void MacroAssembler::PrepareCallCFunction(int num_arguments, Register scratch) { | 2810 |
| 2811 void MacroAssembler::PrepareCallCFunction(int num_reg_arguments, |
| 2812 int num_double_arguments, |
| 2813 Register scratch) { |
| 2798 int frame_alignment = ActivationFrameAlignment(); | 2814 int frame_alignment = ActivationFrameAlignment(); |
| 2799 | 2815 |
| 2816 int stack_passed_arguments = 0; |
| 2817 if (FLAG_hardfloat) { |
| 2818 // In the hard floating point calling convention, we can use |
| 2819 // all double registers to pass doubles. |
| 2820 if (num_double_arguments > DoubleRegister::kNumRegisters) { |
| 2821 stack_passed_arguments += |
| 2822 2 * (num_double_arguments - DoubleRegister::kNumRegisters); |
| 2823 } |
| 2824 } else { |
| 2825 // In the soft floating point calling convention, every double |
| 2826 // argument is passed using two registers. |
| 2827 num_reg_arguments += 2 * num_double_arguments; |
| 2828 } |
| 2800 // Up to four simple arguments are passed in registers r0..r3. | 2829 // Up to four simple arguments are passed in registers r0..r3. |
| 2801 int stack_passed_arguments = (num_arguments <= kRegisterPassedArguments) ? | 2830 if (num_reg_arguments > kRegisterPassedArguments) { |
| 2802 0 : num_arguments - kRegisterPassedArguments; | 2831 stack_passed_arguments += num_reg_arguments - kRegisterPassedArguments; |
| 2832 } |
| 2803 if (frame_alignment > kPointerSize) { | 2833 if (frame_alignment > kPointerSize) { |
| 2804 // Make stack end at alignment and make room for num_arguments - 4 words | 2834 // Make stack end at alignment and make room for num_arguments - 4 words |
| 2805 // and the original value of sp. | 2835 // and the original value of sp. |
| 2806 mov(scratch, sp); | 2836 mov(scratch, sp); |
| 2807 sub(sp, sp, Operand((stack_passed_arguments + 1) * kPointerSize)); | 2837 sub(sp, sp, Operand((stack_passed_arguments + 1) * kPointerSize)); |
| 2808 ASSERT(IsPowerOf2(frame_alignment)); | 2838 ASSERT(IsPowerOf2(frame_alignment)); |
| 2809 and_(sp, sp, Operand(-frame_alignment)); | 2839 and_(sp, sp, Operand(-frame_alignment)); |
| 2810 str(scratch, MemOperand(sp, stack_passed_arguments * kPointerSize)); | 2840 str(scratch, MemOperand(sp, stack_passed_arguments * kPointerSize)); |
| 2811 } else { | 2841 } else { |
| 2812 sub(sp, sp, Operand(stack_passed_arguments * kPointerSize)); | 2842 sub(sp, sp, Operand(stack_passed_arguments * kPointerSize)); |
| 2813 } | 2843 } |
| 2814 } | 2844 } |
| 2815 | 2845 |
| 2816 | 2846 |
| 2847 void MacroAssembler::PrepareCallCFunction(int num_reg_arguments, |
| 2848 Register scratch) { |
| 2849 PrepareCallCFunction(num_reg_arguments, 0, scratch); |
| 2850 } |
| 2851 |
| 2852 |
| 2853 void MacroAssembler::SetCallCDoubleArguments(DoubleRegister dreg) { |
| 2854 if (FLAG_hardfloat) { |
| 2855 Move(d0, dreg); |
| 2856 } else { |
| 2857 vmov(r0, r1, dreg); |
| 2858 } |
| 2859 } |
| 2860 |
| 2861 |
| 2862 void MacroAssembler::SetCallCDoubleArguments(DoubleRegister dreg1, |
| 2863 DoubleRegister dreg2) { |
| 2864 if (FLAG_hardfloat) { |
| 2865 if (dreg2.is(d0)) { |
| 2866 ASSERT(!dreg1.is(d1)); |
| 2867 Move(d1, dreg2); |
| 2868 Move(d0, dreg1); |
| 2869 } else { |
| 2870 Move(d0, dreg1); |
| 2871 Move(d1, dreg2); |
| 2872 } |
| 2873 } else { |
| 2874 vmov(r0, r1, dreg1); |
| 2875 vmov(r2, r3, dreg2); |
| 2876 } |
| 2877 } |
| 2878 |
| 2879 |
| 2880 void MacroAssembler::SetCallCDoubleArguments(DoubleRegister dreg, |
| 2881 Register reg) { |
| 2882 if (FLAG_hardfloat) { |
| 2883 Move(d0, dreg); |
| 2884 Move(r0, reg); |
| 2885 } else { |
| 2886 Move(r2, reg); |
| 2887 vmov(r0, r1, dreg); |
| 2888 } |
| 2889 } |
| 2890 |
| 2891 |
| 2817 void MacroAssembler::CallCFunction(ExternalReference function, | 2892 void MacroAssembler::CallCFunction(ExternalReference function, |
| 2818 int num_arguments) { | 2893 int num_arguments) { |
| 2819 CallCFunctionHelper(no_reg, function, ip, num_arguments); | 2894 CallCFunctionHelper(no_reg, function, ip, num_arguments); |
| 2820 } | 2895 } |
| 2821 | 2896 |
| 2897 |
| 2822 void MacroAssembler::CallCFunction(Register function, | 2898 void MacroAssembler::CallCFunction(Register function, |
| 2823 Register scratch, | 2899 Register scratch, |
| 2824 int num_arguments) { | 2900 int num_arguments) { |
| 2825 CallCFunctionHelper(function, | 2901 CallCFunctionHelper(function, |
| 2826 ExternalReference::the_hole_value_location(isolate()), | 2902 ExternalReference::the_hole_value_location(isolate()), |
| 2827 scratch, | 2903 scratch, |
| 2828 num_arguments); | 2904 num_arguments); |
| 2829 } | 2905 } |
| 2830 | 2906 |
| 2831 | 2907 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2926 void CodePatcher::EmitCondition(Condition cond) { | 3002 void CodePatcher::EmitCondition(Condition cond) { |
| 2927 Instr instr = Assembler::instr_at(masm_.pc_); | 3003 Instr instr = Assembler::instr_at(masm_.pc_); |
| 2928 instr = (instr & ~kCondMask) | cond; | 3004 instr = (instr & ~kCondMask) | cond; |
| 2929 masm_.emit(instr); | 3005 masm_.emit(instr); |
| 2930 } | 3006 } |
| 2931 | 3007 |
| 2932 | 3008 |
| 2933 } } // namespace v8::internal | 3009 } } // namespace v8::internal |
| 2934 | 3010 |
| 2935 #endif // V8_TARGET_ARCH_ARM | 3011 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |