Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Side by Side Diff: src/arm/code-stubs-arm.cc

Issue 11428137: ARM: Make use of d16-d31 when available. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address Rodolph's comments Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 * DwVfpRegister::NumAvailableRegisters()) );
2040 for (int i = 0; i < DwVfpRegister::kNumRegisters; i++) { 2040 for (int i = 0; i < DwVfpRegister::NumAvailableRegisters(); i++) {
2041 DwVfpRegister reg = DwVfpRegister::from_code(i); 2041 DwVfpRegister reg = DwVfpRegister::from_code(i);
2042 __ vstr(reg, MemOperand(sp, i * kDoubleSize)); 2042 __ vstr(reg, MemOperand(sp, i * kDoubleSize));
2043 } 2043 }
2044 } 2044 }
2045 const int argument_count = 1; 2045 const int argument_count = 1;
2046 const int fp_argument_count = 0; 2046 const int fp_argument_count = 0;
2047 const Register scratch = r1; 2047 const Register scratch = r1;
2048 2048
2049 AllowExternalCallThatCantCauseGC scope(masm); 2049 AllowExternalCallThatCantCauseGC scope(masm);
2050 __ PrepareCallCFunction(argument_count, fp_argument_count, scratch); 2050 __ PrepareCallCFunction(argument_count, fp_argument_count, scratch);
2051 __ mov(r0, Operand(ExternalReference::isolate_address())); 2051 __ mov(r0, Operand(ExternalReference::isolate_address()));
2052 __ CallCFunction( 2052 __ CallCFunction(
2053 ExternalReference::store_buffer_overflow_function(masm->isolate()), 2053 ExternalReference::store_buffer_overflow_function(masm->isolate()),
2054 argument_count); 2054 argument_count);
2055 if (save_doubles_ == kSaveFPRegs) { 2055 if (save_doubles_ == kSaveFPRegs) {
2056 CpuFeatures::Scope scope(VFP2); 2056 CpuFeatures::Scope scope(VFP2);
2057 for (int i = 0; i < DwVfpRegister::kNumRegisters; i++) { 2057 for (int i = 0; i < DwVfpRegister::NumAvailableRegisters(); i++) {
2058 DwVfpRegister reg = DwVfpRegister::from_code(i); 2058 DwVfpRegister reg = DwVfpRegister::from_code(i);
2059 __ vldr(reg, MemOperand(sp, i * kDoubleSize)); 2059 __ vldr(reg, MemOperand(sp, i * kDoubleSize));
2060 } 2060 }
2061 __ add(sp, sp, Operand(kDoubleSize * DwVfpRegister::kNumRegisters)); 2061 __ add(sp, sp, Operand(kDoubleSize *
2062 DwVfpRegister::NumAvailableRegisters()));
2062 } 2063 }
2063 __ ldm(ia_w, sp, kCallerSaved | pc.bit()); // Also pop pc to get Ret(0). 2064 __ ldm(ia_w, sp, kCallerSaved | pc.bit()); // Also pop pc to get Ret(0).
2064 } 2065 }
2065 2066
2066 2067
2067 void UnaryOpStub::PrintName(StringStream* stream) { 2068 void UnaryOpStub::PrintName(StringStream* stream) {
2068 const char* op_name = Token::Name(op_); 2069 const char* op_name = Token::Name(op_);
2069 const char* overwrite_name = NULL; // Make g++ happy. 2070 const char* overwrite_name = NULL; // Make g++ happy.
2070 switch (mode_) { 2071 switch (mode_) {
2071 case UNARY_NO_OVERWRITE: overwrite_name = "Alloc"; break; 2072 case UNARY_NO_OVERWRITE: overwrite_name = "Alloc"; break;
(...skipping 1565 matching lines...) Expand 10 before | Expand all | Expand 10 after
3637 __ b(ne, &not_plus_half); 3638 __ b(ne, &not_plus_half);
3638 3639
3639 // Calculates square root of base. Check for the special case of 3640 // Calculates square root of base. Check for the special case of
3640 // Math.pow(-Infinity, 0.5) == Infinity (ECMA spec, 15.8.2.13). 3641 // Math.pow(-Infinity, 0.5) == Infinity (ECMA spec, 15.8.2.13).
3641 __ vmov(double_scratch, -V8_INFINITY, scratch); 3642 __ vmov(double_scratch, -V8_INFINITY, scratch);
3642 __ VFPCompareAndSetFlags(double_base, double_scratch); 3643 __ VFPCompareAndSetFlags(double_base, double_scratch);
3643 __ vneg(double_result, double_scratch, eq); 3644 __ vneg(double_result, double_scratch, eq);
3644 __ b(eq, &done); 3645 __ b(eq, &done);
3645 3646
3646 // Add +0 to convert -0 to +0. 3647 // Add +0 to convert -0 to +0.
3647 __ vadd(double_scratch, double_base, kDoubleRegZero); 3648 __ vadd(double_scratch, double_base, DwVfpRegister::ZeroReg());
3648 __ vsqrt(double_result, double_scratch); 3649 __ vsqrt(double_result, double_scratch);
3649 __ jmp(&done); 3650 __ jmp(&done);
3650 3651
3651 __ bind(&not_plus_half); 3652 __ bind(&not_plus_half);
3652 __ vmov(double_scratch, -0.5, scratch); 3653 __ vmov(double_scratch, -0.5, scratch);
3653 __ VFPCompareAndSetFlags(double_exponent, double_scratch); 3654 __ VFPCompareAndSetFlags(double_exponent, double_scratch);
3654 __ b(ne, &call_runtime); 3655 __ b(ne, &call_runtime);
3655 3656
3656 // Calculates square root of base. Check for the special case of 3657 // Calculates square root of base. Check for the special case of
3657 // Math.pow(-Infinity, -0.5) == 0 (ECMA spec, 15.8.2.13). 3658 // Math.pow(-Infinity, -0.5) == 0 (ECMA spec, 15.8.2.13).
3658 __ vmov(double_scratch, -V8_INFINITY, scratch); 3659 __ vmov(double_scratch, -V8_INFINITY, scratch);
3659 __ VFPCompareAndSetFlags(double_base, double_scratch); 3660 __ VFPCompareAndSetFlags(double_base, double_scratch);
3660 __ vmov(double_result, kDoubleRegZero, eq); 3661 __ vmov(double_result, DwVfpRegister::ZeroReg(), eq);
3661 __ b(eq, &done); 3662 __ b(eq, &done);
3662 3663
3663 // Add +0 to convert -0 to +0. 3664 // Add +0 to convert -0 to +0.
3664 __ vadd(double_scratch, double_base, kDoubleRegZero); 3665 __ vadd(double_scratch, double_base, DwVfpRegister::ZeroReg());
3665 __ vmov(double_result, 1.0, scratch); 3666 __ vmov(double_result, 1.0, scratch);
3666 __ vsqrt(double_scratch, double_scratch); 3667 __ vsqrt(double_scratch, double_scratch);
3667 __ vdiv(double_result, double_result, double_scratch); 3668 __ vdiv(double_result, double_result, double_scratch);
3668 __ jmp(&done); 3669 __ jmp(&done);
3669 } 3670 }
3670 3671
3671 __ push(lr); 3672 __ push(lr);
3672 { 3673 {
3673 AllowExternalCallThatCantCauseGC scope(masm); 3674 AllowExternalCallThatCantCauseGC scope(masm);
3674 __ PrepareCallCFunction(0, 2, scratch); 3675 __ PrepareCallCFunction(0, 2, scratch);
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
4015 Label invoke, handler_entry, exit; 4016 Label invoke, handler_entry, exit;
4016 4017
4017 // Called from C, so do not pop argc and args on exit (preserve sp) 4018 // Called from C, so do not pop argc and args on exit (preserve sp)
4018 // No need to save register-passed args 4019 // No need to save register-passed args
4019 // Save callee-saved registers (incl. cp and fp), sp, and lr 4020 // Save callee-saved registers (incl. cp and fp), sp, and lr
4020 __ stm(db_w, sp, kCalleeSaved | lr.bit()); 4021 __ stm(db_w, sp, kCalleeSaved | lr.bit());
4021 4022
4022 if (CpuFeatures::IsSupported(VFP2)) { 4023 if (CpuFeatures::IsSupported(VFP2)) {
4023 CpuFeatures::Scope scope(VFP2); 4024 CpuFeatures::Scope scope(VFP2);
4024 // Save callee-saved vfp registers. 4025 // Save callee-saved vfp registers.
4025 __ vstm(db_w, sp, kFirstCalleeSavedDoubleReg, kLastCalleeSavedDoubleReg); 4026 __ Vstm(db_w, sp, DwVfpRegister::FirstCalleeSavedReg(),
4027 DwVfpRegister::LastCalleeSavedReg());
4026 // Set up the reserved register for 0.0. 4028 // Set up the reserved register for 0.0.
4027 __ vmov(kDoubleRegZero, 0.0); 4029 __ vmov(DwVfpRegister::ZeroReg(), 0.0);
4028 } 4030 }
4029 4031
4030 // Get address of argv, see stm above. 4032 // Get address of argv, see stm above.
4031 // r0: code entry 4033 // r0: code entry
4032 // r1: function 4034 // r1: function
4033 // r2: receiver 4035 // r2: receiver
4034 // r3: argc 4036 // r3: argc
4035 4037
4036 // Set up argv in r4. 4038 // Set up argv in r4.
4037 int offset_to_argv = (kNumCalleeSaved + 1) * kPointerSize; 4039 int offset_to_argv = (kNumCalleeSaved + 1) * kPointerSize;
4038 if (CpuFeatures::IsSupported(VFP2)) { 4040 if (CpuFeatures::IsSupported(VFP2)) {
4039 offset_to_argv += kNumDoubleCalleeSaved * kDoubleSize; 4041 offset_to_argv += DwVfpRegister::NumCalleeSaved() * kDoubleSize;
4040 } 4042 }
4041 __ ldr(r4, MemOperand(sp, offset_to_argv)); 4043 __ ldr(r4, MemOperand(sp, offset_to_argv));
4042 4044
4043 // Push a frame with special values setup to mark it as an entry frame. 4045 // Push a frame with special values setup to mark it as an entry frame.
4044 // r0: code entry 4046 // r0: code entry
4045 // r1: function 4047 // r1: function
4046 // r2: receiver 4048 // r2: receiver
4047 // r3: argc 4049 // r3: argc
4048 // r4: argv 4050 // r4: argv
4049 Isolate* isolate = masm->isolate(); 4051 Isolate* isolate = masm->isolate();
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
4169 // Restore callee-saved registers and return. 4171 // Restore callee-saved registers and return.
4170 #ifdef DEBUG 4172 #ifdef DEBUG
4171 if (FLAG_debug_code) { 4173 if (FLAG_debug_code) {
4172 __ mov(lr, Operand(pc)); 4174 __ mov(lr, Operand(pc));
4173 } 4175 }
4174 #endif 4176 #endif
4175 4177
4176 if (CpuFeatures::IsSupported(VFP2)) { 4178 if (CpuFeatures::IsSupported(VFP2)) {
4177 CpuFeatures::Scope scope(VFP2); 4179 CpuFeatures::Scope scope(VFP2);
4178 // Restore callee-saved vfp registers. 4180 // Restore callee-saved vfp registers.
4179 __ vldm(ia_w, sp, kFirstCalleeSavedDoubleReg, kLastCalleeSavedDoubleReg); 4181 __ Vldm(ia_w, sp, DwVfpRegister::FirstCalleeSavedReg(),
4182 DwVfpRegister::LastCalleeSavedReg());
4180 } 4183 }
4181 4184
4182 __ ldm(ia_w, sp, kCalleeSaved | pc.bit()); 4185 __ ldm(ia_w, sp, kCalleeSaved | pc.bit());
4183 } 4186 }
4184 4187
4185 4188
4186 // Uses registers r0 to r4. 4189 // Uses registers r0 to r4.
4187 // Expected input (depending on whether args are in registers or on the stack): 4190 // Expected input (depending on whether args are in registers or on the stack):
4188 // * object: r0 or at sp + 1 * kPointerSize. 4191 // * object: r0 or at sp + 1 * kPointerSize.
4189 // * function: r1 or at sp. 4192 // * function: r1 or at sp.
(...skipping 3414 matching lines...) Expand 10 before | Expand all | Expand 10 after
7604 7607
7605 __ Pop(lr, r5, r1); 7608 __ Pop(lr, r5, r1);
7606 __ Ret(); 7609 __ Ret();
7607 } 7610 }
7608 7611
7609 #undef __ 7612 #undef __
7610 7613
7611 } } // namespace v8::internal 7614 } } // namespace v8::internal
7612 7615
7613 #endif // V8_TARGET_ARCH_ARM 7616 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« src/arm/code-stubs-arm.h ('K') | « src/arm/code-stubs-arm.h ('k') | src/arm/codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698