| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 2018 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2029 } | 2029 } |
| 2030 | 2030 |
| 2031 | 2031 |
| 2032 void StoreBufferOverflowStub::Generate(MacroAssembler* masm) { | 2032 void StoreBufferOverflowStub::Generate(MacroAssembler* masm) { |
| 2033 // We don't allow a GC during a store buffer overflow so there is no need to | 2033 // We don't allow a GC during a store buffer overflow so there is no need to |
| 2034 // store the registers in any particular way, but we do have to store and | 2034 // store the registers in any particular way, but we do have to store and |
| 2035 // restore them. | 2035 // restore them. |
| 2036 __ stm(db_w, sp, kCallerSaved | lr.bit()); | 2036 __ stm(db_w, sp, kCallerSaved | lr.bit()); |
| 2037 if (save_doubles_ == kSaveFPRegs) { | 2037 if (save_doubles_ == kSaveFPRegs) { |
| 2038 CpuFeatures::Scope scope(VFP2); | 2038 CpuFeatures::Scope scope(VFP2); |
| 2039 __ sub(sp, sp, Operand(kDoubleSize * DwVfpRegister::kNumRegisters)); | 2039 __ sub(sp, sp, Operand(kDoubleSize * |
| 2040 for (int i = 0; i < DwVfpRegister::kNumRegisters; i++) { | 2040 DwVfpRegister::NumAvailableRegisters())); |
| 2041 for (int i = 0; i < DwVfpRegister::NumAvailableRegisters(); i++) { |
| 2041 DwVfpRegister reg = DwVfpRegister::from_code(i); | 2042 DwVfpRegister reg = DwVfpRegister::from_code(i); |
| 2042 __ vstr(reg, MemOperand(sp, i * kDoubleSize)); | 2043 __ vstr(reg, MemOperand(sp, i * kDoubleSize)); |
| 2043 } | 2044 } |
| 2044 } | 2045 } |
| 2045 const int argument_count = 1; | 2046 const int argument_count = 1; |
| 2046 const int fp_argument_count = 0; | 2047 const int fp_argument_count = 0; |
| 2047 const Register scratch = r1; | 2048 const Register scratch = r1; |
| 2048 | 2049 |
| 2049 AllowExternalCallThatCantCauseGC scope(masm); | 2050 AllowExternalCallThatCantCauseGC scope(masm); |
| 2050 __ PrepareCallCFunction(argument_count, fp_argument_count, scratch); | 2051 __ PrepareCallCFunction(argument_count, fp_argument_count, scratch); |
| 2051 __ mov(r0, Operand(ExternalReference::isolate_address())); | 2052 __ mov(r0, Operand(ExternalReference::isolate_address())); |
| 2052 __ CallCFunction( | 2053 __ CallCFunction( |
| 2053 ExternalReference::store_buffer_overflow_function(masm->isolate()), | 2054 ExternalReference::store_buffer_overflow_function(masm->isolate()), |
| 2054 argument_count); | 2055 argument_count); |
| 2055 if (save_doubles_ == kSaveFPRegs) { | 2056 if (save_doubles_ == kSaveFPRegs) { |
| 2056 CpuFeatures::Scope scope(VFP2); | 2057 CpuFeatures::Scope scope(VFP2); |
| 2057 for (int i = 0; i < DwVfpRegister::kNumRegisters; i++) { | 2058 for (int i = 0; i < DwVfpRegister::NumAvailableRegisters(); i++) { |
| 2058 DwVfpRegister reg = DwVfpRegister::from_code(i); | 2059 DwVfpRegister reg = DwVfpRegister::from_code(i); |
| 2059 __ vldr(reg, MemOperand(sp, i * kDoubleSize)); | 2060 __ vldr(reg, MemOperand(sp, i * kDoubleSize)); |
| 2060 } | 2061 } |
| 2061 __ add(sp, sp, Operand(kDoubleSize * DwVfpRegister::kNumRegisters)); | 2062 __ add(sp, sp, Operand(kDoubleSize * |
| 2063 DwVfpRegister::NumAvailableRegisters())); |
| 2062 } | 2064 } |
| 2063 __ ldm(ia_w, sp, kCallerSaved | pc.bit()); // Also pop pc to get Ret(0). | 2065 __ ldm(ia_w, sp, kCallerSaved | pc.bit()); // Also pop pc to get Ret(0). |
| 2064 } | 2066 } |
| 2065 | 2067 |
| 2066 | 2068 |
| 2067 void UnaryOpStub::PrintName(StringStream* stream) { | 2069 void UnaryOpStub::PrintName(StringStream* stream) { |
| 2068 const char* op_name = Token::Name(op_); | 2070 const char* op_name = Token::Name(op_); |
| 2069 const char* overwrite_name = NULL; // Make g++ happy. | 2071 const char* overwrite_name = NULL; // Make g++ happy. |
| 2070 switch (mode_) { | 2072 switch (mode_) { |
| 2071 case UNARY_NO_OVERWRITE: overwrite_name = "Alloc"; break; | 2073 case UNARY_NO_OVERWRITE: overwrite_name = "Alloc"; break; |
| (...skipping 1565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3637 __ b(ne, ¬_plus_half); | 3639 __ b(ne, ¬_plus_half); |
| 3638 | 3640 |
| 3639 // Calculates square root of base. Check for the special case of | 3641 // Calculates square root of base. Check for the special case of |
| 3640 // Math.pow(-Infinity, 0.5) == Infinity (ECMA spec, 15.8.2.13). | 3642 // Math.pow(-Infinity, 0.5) == Infinity (ECMA spec, 15.8.2.13). |
| 3641 __ vmov(double_scratch, -V8_INFINITY, scratch); | 3643 __ vmov(double_scratch, -V8_INFINITY, scratch); |
| 3642 __ VFPCompareAndSetFlags(double_base, double_scratch); | 3644 __ VFPCompareAndSetFlags(double_base, double_scratch); |
| 3643 __ vneg(double_result, double_scratch, eq); | 3645 __ vneg(double_result, double_scratch, eq); |
| 3644 __ b(eq, &done); | 3646 __ b(eq, &done); |
| 3645 | 3647 |
| 3646 // Add +0 to convert -0 to +0. | 3648 // Add +0 to convert -0 to +0. |
| 3647 __ vadd(double_scratch, double_base, kDoubleRegZero); | 3649 __ vadd(double_scratch, double_base, DwVfpRegister::ZeroReg()); |
| 3648 __ vsqrt(double_result, double_scratch); | 3650 __ vsqrt(double_result, double_scratch); |
| 3649 __ jmp(&done); | 3651 __ jmp(&done); |
| 3650 | 3652 |
| 3651 __ bind(¬_plus_half); | 3653 __ bind(¬_plus_half); |
| 3652 __ vmov(double_scratch, -0.5, scratch); | 3654 __ vmov(double_scratch, -0.5, scratch); |
| 3653 __ VFPCompareAndSetFlags(double_exponent, double_scratch); | 3655 __ VFPCompareAndSetFlags(double_exponent, double_scratch); |
| 3654 __ b(ne, &call_runtime); | 3656 __ b(ne, &call_runtime); |
| 3655 | 3657 |
| 3656 // Calculates square root of base. Check for the special case of | 3658 // Calculates square root of base. Check for the special case of |
| 3657 // Math.pow(-Infinity, -0.5) == 0 (ECMA spec, 15.8.2.13). | 3659 // Math.pow(-Infinity, -0.5) == 0 (ECMA spec, 15.8.2.13). |
| 3658 __ vmov(double_scratch, -V8_INFINITY, scratch); | 3660 __ vmov(double_scratch, -V8_INFINITY, scratch); |
| 3659 __ VFPCompareAndSetFlags(double_base, double_scratch); | 3661 __ VFPCompareAndSetFlags(double_base, double_scratch); |
| 3660 __ vmov(double_result, kDoubleRegZero, eq); | 3662 __ vmov(double_result, DwVfpRegister::ZeroReg(), eq); |
| 3661 __ b(eq, &done); | 3663 __ b(eq, &done); |
| 3662 | 3664 |
| 3663 // Add +0 to convert -0 to +0. | 3665 // Add +0 to convert -0 to +0. |
| 3664 __ vadd(double_scratch, double_base, kDoubleRegZero); | 3666 __ vadd(double_scratch, double_base, DwVfpRegister::ZeroReg()); |
| 3665 __ vmov(double_result, 1.0, scratch); | 3667 __ vmov(double_result, 1.0, scratch); |
| 3666 __ vsqrt(double_scratch, double_scratch); | 3668 __ vsqrt(double_scratch, double_scratch); |
| 3667 __ vdiv(double_result, double_result, double_scratch); | 3669 __ vdiv(double_result, double_result, double_scratch); |
| 3668 __ jmp(&done); | 3670 __ jmp(&done); |
| 3669 } | 3671 } |
| 3670 | 3672 |
| 3671 __ push(lr); | 3673 __ push(lr); |
| 3672 { | 3674 { |
| 3673 AllowExternalCallThatCantCauseGC scope(masm); | 3675 AllowExternalCallThatCantCauseGC scope(masm); |
| 3674 __ PrepareCallCFunction(0, 2, scratch); | 3676 __ PrepareCallCFunction(0, 2, scratch); |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4015 Label invoke, handler_entry, exit; | 4017 Label invoke, handler_entry, exit; |
| 4016 | 4018 |
| 4017 // Called from C, so do not pop argc and args on exit (preserve sp) | 4019 // Called from C, so do not pop argc and args on exit (preserve sp) |
| 4018 // No need to save register-passed args | 4020 // No need to save register-passed args |
| 4019 // Save callee-saved registers (incl. cp and fp), sp, and lr | 4021 // Save callee-saved registers (incl. cp and fp), sp, and lr |
| 4020 __ stm(db_w, sp, kCalleeSaved | lr.bit()); | 4022 __ stm(db_w, sp, kCalleeSaved | lr.bit()); |
| 4021 | 4023 |
| 4022 if (CpuFeatures::IsSupported(VFP2)) { | 4024 if (CpuFeatures::IsSupported(VFP2)) { |
| 4023 CpuFeatures::Scope scope(VFP2); | 4025 CpuFeatures::Scope scope(VFP2); |
| 4024 // Save callee-saved vfp registers. | 4026 // Save callee-saved vfp registers. |
| 4025 __ vstm(db_w, sp, kFirstCalleeSavedDoubleReg, kLastCalleeSavedDoubleReg); | 4027 __ Vstm(db_w, sp, DwVfpRegister::FirstCalleeSavedReg(), |
| 4028 DwVfpRegister::LastCalleeSavedReg()); |
| 4026 // Set up the reserved register for 0.0. | 4029 // Set up the reserved register for 0.0. |
| 4027 __ vmov(kDoubleRegZero, 0.0); | 4030 __ vmov(DwVfpRegister::ZeroReg(), 0.0); |
| 4028 } | 4031 } |
| 4029 | 4032 |
| 4030 // Get address of argv, see stm above. | 4033 // Get address of argv, see stm above. |
| 4031 // r0: code entry | 4034 // r0: code entry |
| 4032 // r1: function | 4035 // r1: function |
| 4033 // r2: receiver | 4036 // r2: receiver |
| 4034 // r3: argc | 4037 // r3: argc |
| 4035 | 4038 |
| 4036 // Set up argv in r4. | 4039 // Set up argv in r4. |
| 4037 int offset_to_argv = (kNumCalleeSaved + 1) * kPointerSize; | 4040 int offset_to_argv = (kNumCalleeSaved + 1) * kPointerSize; |
| 4038 if (CpuFeatures::IsSupported(VFP2)) { | 4041 if (CpuFeatures::IsSupported(VFP2)) { |
| 4039 offset_to_argv += kNumDoubleCalleeSaved * kDoubleSize; | 4042 offset_to_argv += DwVfpRegister::NumCalleeSaved() * kDoubleSize; |
| 4040 } | 4043 } |
| 4041 __ ldr(r4, MemOperand(sp, offset_to_argv)); | 4044 __ ldr(r4, MemOperand(sp, offset_to_argv)); |
| 4042 | 4045 |
| 4043 // Push a frame with special values setup to mark it as an entry frame. | 4046 // Push a frame with special values setup to mark it as an entry frame. |
| 4044 // r0: code entry | 4047 // r0: code entry |
| 4045 // r1: function | 4048 // r1: function |
| 4046 // r2: receiver | 4049 // r2: receiver |
| 4047 // r3: argc | 4050 // r3: argc |
| 4048 // r4: argv | 4051 // r4: argv |
| 4049 Isolate* isolate = masm->isolate(); | 4052 Isolate* isolate = masm->isolate(); |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4169 // Restore callee-saved registers and return. | 4172 // Restore callee-saved registers and return. |
| 4170 #ifdef DEBUG | 4173 #ifdef DEBUG |
| 4171 if (FLAG_debug_code) { | 4174 if (FLAG_debug_code) { |
| 4172 __ mov(lr, Operand(pc)); | 4175 __ mov(lr, Operand(pc)); |
| 4173 } | 4176 } |
| 4174 #endif | 4177 #endif |
| 4175 | 4178 |
| 4176 if (CpuFeatures::IsSupported(VFP2)) { | 4179 if (CpuFeatures::IsSupported(VFP2)) { |
| 4177 CpuFeatures::Scope scope(VFP2); | 4180 CpuFeatures::Scope scope(VFP2); |
| 4178 // Restore callee-saved vfp registers. | 4181 // Restore callee-saved vfp registers. |
| 4179 __ vldm(ia_w, sp, kFirstCalleeSavedDoubleReg, kLastCalleeSavedDoubleReg); | 4182 __ Vldm(ia_w, sp, DwVfpRegister::FirstCalleeSavedReg(), |
| 4183 DwVfpRegister::LastCalleeSavedReg()); |
| 4180 } | 4184 } |
| 4181 | 4185 |
| 4182 __ ldm(ia_w, sp, kCalleeSaved | pc.bit()); | 4186 __ ldm(ia_w, sp, kCalleeSaved | pc.bit()); |
| 4183 } | 4187 } |
| 4184 | 4188 |
| 4185 | 4189 |
| 4186 // Uses registers r0 to r4. | 4190 // Uses registers r0 to r4. |
| 4187 // Expected input (depending on whether args are in registers or on the stack): | 4191 // Expected input (depending on whether args are in registers or on the stack): |
| 4188 // * object: r0 or at sp + 1 * kPointerSize. | 4192 // * object: r0 or at sp + 1 * kPointerSize. |
| 4189 // * function: r1 or at sp. | 4193 // * function: r1 or at sp. |
| (...skipping 3414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7604 | 7608 |
| 7605 __ Pop(lr, r5, r1); | 7609 __ Pop(lr, r5, r1); |
| 7606 __ Ret(); | 7610 __ Ret(); |
| 7607 } | 7611 } |
| 7608 | 7612 |
| 7609 #undef __ | 7613 #undef __ |
| 7610 | 7614 |
| 7611 } } // namespace v8::internal | 7615 } } // namespace v8::internal |
| 7612 | 7616 |
| 7613 #endif // V8_TARGET_ARCH_ARM | 7617 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |