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

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

Issue 10990024: ARM: Small optimisation of VFP immediate creation (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 2 months 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
« no previous file with comments | « src/arm/assembler-arm.cc ('k') | src/arm/lithium-codegen-arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 3618 matching lines...) Expand 10 before | Expand all | Expand 10 after
3629 __ VFPCompareAndSetFlags(double_scratch, double_exponent); 3629 __ VFPCompareAndSetFlags(double_scratch, double_exponent);
3630 __ b(eq, &int_exponent_convert); 3630 __ b(eq, &int_exponent_convert);
3631 3631
3632 if (exponent_type_ == ON_STACK) { 3632 if (exponent_type_ == ON_STACK) {
3633 // Detect square root case. Crankshaft detects constant +/-0.5 at 3633 // Detect square root case. Crankshaft detects constant +/-0.5 at
3634 // compile time and uses DoMathPowHalf instead. We then skip this check 3634 // compile time and uses DoMathPowHalf instead. We then skip this check
3635 // for non-constant cases of +/-0.5 as these hardly occur. 3635 // for non-constant cases of +/-0.5 as these hardly occur.
3636 Label not_plus_half; 3636 Label not_plus_half;
3637 3637
3638 // Test for 0.5. 3638 // Test for 0.5.
3639 __ vmov(double_scratch, 0.5); 3639 __ vmov(double_scratch, 0.5, scratch);
3640 __ VFPCompareAndSetFlags(double_exponent, double_scratch); 3640 __ VFPCompareAndSetFlags(double_exponent, double_scratch);
3641 __ b(ne, &not_plus_half); 3641 __ b(ne, &not_plus_half);
3642 3642
3643 // Calculates square root of base. Check for the special case of 3643 // Calculates square root of base. Check for the special case of
3644 // Math.pow(-Infinity, 0.5) == Infinity (ECMA spec, 15.8.2.13). 3644 // Math.pow(-Infinity, 0.5) == Infinity (ECMA spec, 15.8.2.13).
3645 __ vmov(double_scratch, -V8_INFINITY); 3645 __ vmov(double_scratch, -V8_INFINITY, scratch);
3646 __ VFPCompareAndSetFlags(double_base, double_scratch); 3646 __ VFPCompareAndSetFlags(double_base, double_scratch);
3647 __ vneg(double_result, double_scratch, eq); 3647 __ vneg(double_result, double_scratch, eq);
3648 __ b(eq, &done); 3648 __ b(eq, &done);
3649 3649
3650 // Add +0 to convert -0 to +0. 3650 // Add +0 to convert -0 to +0.
3651 __ vadd(double_scratch, double_base, kDoubleRegZero); 3651 __ vadd(double_scratch, double_base, kDoubleRegZero);
3652 __ vsqrt(double_result, double_scratch); 3652 __ vsqrt(double_result, double_scratch);
3653 __ jmp(&done); 3653 __ jmp(&done);
3654 3654
3655 __ bind(&not_plus_half); 3655 __ bind(&not_plus_half);
3656 __ vmov(double_scratch, -0.5); 3656 __ vmov(double_scratch, -0.5, scratch);
3657 __ VFPCompareAndSetFlags(double_exponent, double_scratch); 3657 __ VFPCompareAndSetFlags(double_exponent, double_scratch);
3658 __ b(ne, &call_runtime); 3658 __ b(ne, &call_runtime);
3659 3659
3660 // Calculates square root of base. Check for the special case of 3660 // Calculates square root of base. Check for the special case of
3661 // Math.pow(-Infinity, -0.5) == 0 (ECMA spec, 15.8.2.13). 3661 // Math.pow(-Infinity, -0.5) == 0 (ECMA spec, 15.8.2.13).
3662 __ vmov(double_scratch, -V8_INFINITY); 3662 __ vmov(double_scratch, -V8_INFINITY, scratch);
3663 __ VFPCompareAndSetFlags(double_base, double_scratch); 3663 __ VFPCompareAndSetFlags(double_base, double_scratch);
3664 __ vmov(double_result, kDoubleRegZero, eq); 3664 __ vmov(double_result, kDoubleRegZero, eq);
3665 __ b(eq, &done); 3665 __ b(eq, &done);
3666 3666
3667 // Add +0 to convert -0 to +0. 3667 // Add +0 to convert -0 to +0.
3668 __ vadd(double_scratch, double_base, kDoubleRegZero); 3668 __ vadd(double_scratch, double_base, kDoubleRegZero);
3669 __ vmov(double_result, 1.0); 3669 __ vmov(double_result, 1.0, scratch);
3670 __ vsqrt(double_scratch, double_scratch); 3670 __ vsqrt(double_scratch, double_scratch);
3671 __ vdiv(double_result, double_result, double_scratch); 3671 __ vdiv(double_result, double_result, double_scratch);
3672 __ jmp(&done); 3672 __ jmp(&done);
3673 } 3673 }
3674 3674
3675 __ push(lr); 3675 __ push(lr);
3676 { 3676 {
3677 AllowExternalCallThatCantCauseGC scope(masm); 3677 AllowExternalCallThatCantCauseGC scope(masm);
3678 __ PrepareCallCFunction(0, 2, scratch); 3678 __ PrepareCallCFunction(0, 2, scratch);
3679 __ SetCallCDoubleArguments(double_base, double_exponent); 3679 __ SetCallCDoubleArguments(double_base, double_exponent);
(...skipping 14 matching lines...) Expand all
3694 __ bind(&int_exponent); 3694 __ bind(&int_exponent);
3695 3695
3696 // Get two copies of exponent in the registers scratch and exponent. 3696 // Get two copies of exponent in the registers scratch and exponent.
3697 if (exponent_type_ == INTEGER) { 3697 if (exponent_type_ == INTEGER) {
3698 __ mov(scratch, exponent); 3698 __ mov(scratch, exponent);
3699 } else { 3699 } else {
3700 // Exponent has previously been stored into scratch as untagged integer. 3700 // Exponent has previously been stored into scratch as untagged integer.
3701 __ mov(exponent, scratch); 3701 __ mov(exponent, scratch);
3702 } 3702 }
3703 __ vmov(double_scratch, double_base); // Back up base. 3703 __ vmov(double_scratch, double_base); // Back up base.
3704 __ vmov(double_result, 1.0); 3704 __ vmov(double_result, 1.0, scratch2);
3705 3705
3706 // Get absolute value of exponent. 3706 // Get absolute value of exponent.
3707 __ cmp(scratch, Operand(0)); 3707 __ cmp(scratch, Operand(0));
3708 __ mov(scratch2, Operand(0), LeaveCC, mi); 3708 __ mov(scratch2, Operand(0), LeaveCC, mi);
3709 __ sub(scratch, scratch2, scratch, LeaveCC, mi); 3709 __ sub(scratch, scratch2, scratch, LeaveCC, mi);
3710 3710
3711 Label while_true; 3711 Label while_true;
3712 __ bind(&while_true); 3712 __ bind(&while_true);
3713 __ mov(scratch, Operand(scratch, ASR, 1), SetCC); 3713 __ mov(scratch, Operand(scratch, ASR, 1), SetCC);
3714 __ vmul(double_result, double_result, double_scratch, cs); 3714 __ vmul(double_result, double_result, double_scratch, cs);
3715 __ vmul(double_scratch, double_scratch, double_scratch, ne); 3715 __ vmul(double_scratch, double_scratch, double_scratch, ne);
3716 __ b(ne, &while_true); 3716 __ b(ne, &while_true);
3717 3717
3718 __ cmp(exponent, Operand(0)); 3718 __ cmp(exponent, Operand(0));
3719 __ b(ge, &done); 3719 __ b(ge, &done);
3720 __ vmov(double_scratch, 1.0); 3720 __ vmov(double_scratch, 1.0, scratch);
3721 __ vdiv(double_result, double_scratch, double_result); 3721 __ vdiv(double_result, double_scratch, double_result);
3722 // Test whether result is zero. Bail out to check for subnormal result. 3722 // Test whether result is zero. Bail out to check for subnormal result.
3723 // Due to subnormals, x^-y == (1/x)^y does not hold in all cases. 3723 // Due to subnormals, x^-y == (1/x)^y does not hold in all cases.
3724 __ VFPCompareAndSetFlags(double_result, 0.0); 3724 __ VFPCompareAndSetFlags(double_result, 0.0);
3725 __ b(ne, &done); 3725 __ b(ne, &done);
3726 // double_exponent may not containe the exponent value if the input was a 3726 // double_exponent may not containe the exponent value if the input was a
3727 // smi. We set it with exponent value before bailing out. 3727 // smi. We set it with exponent value before bailing out.
3728 __ vmov(single_scratch, exponent); 3728 __ vmov(single_scratch, exponent);
3729 __ vcvt_f64_s32(double_exponent, single_scratch); 3729 __ vcvt_f64_s32(double_exponent, single_scratch);
3730 3730
(...skipping 3882 matching lines...) Expand 10 before | Expand all | Expand 10 after
7613 7613
7614 __ Pop(lr, r5, r1); 7614 __ Pop(lr, r5, r1);
7615 __ Ret(); 7615 __ Ret();
7616 } 7616 }
7617 7617
7618 #undef __ 7618 #undef __
7619 7619
7620 } } // namespace v8::internal 7620 } } // namespace v8::internal
7621 7621
7622 #endif // V8_TARGET_ARCH_ARM 7622 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/assembler-arm.cc ('k') | src/arm/lithium-codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698