OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if V8_TARGET_ARCH_ARM | 5 #if V8_TARGET_ARCH_ARM |
6 | 6 |
7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/bootstrapper.h" | 8 #include "src/bootstrapper.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
888 // Test whether result is zero. Bail out to check for subnormal result. | 888 // Test whether result is zero. Bail out to check for subnormal result. |
889 // Due to subnormals, x^-y == (1/x)^y does not hold in all cases. | 889 // Due to subnormals, x^-y == (1/x)^y does not hold in all cases. |
890 __ VFPCompareAndSetFlags(double_result, 0.0); | 890 __ VFPCompareAndSetFlags(double_result, 0.0); |
891 __ b(ne, &done); | 891 __ b(ne, &done); |
892 // double_exponent may not containe the exponent value if the input was a | 892 // double_exponent may not containe the exponent value if the input was a |
893 // smi. We set it with exponent value before bailing out. | 893 // smi. We set it with exponent value before bailing out. |
894 __ vmov(single_scratch, exponent); | 894 __ vmov(single_scratch, exponent); |
895 __ vcvt_f64_s32(double_exponent, single_scratch); | 895 __ vcvt_f64_s32(double_exponent, single_scratch); |
896 | 896 |
897 // Returning or bailing out. | 897 // Returning or bailing out. |
898 Counters* counters = isolate()->counters(); | |
899 if (exponent_type() == ON_STACK) { | 898 if (exponent_type() == ON_STACK) { |
900 // The arguments are still on the stack. | 899 // The arguments are still on the stack. |
901 __ bind(&call_runtime); | 900 __ bind(&call_runtime); |
902 __ TailCallRuntime(Runtime::kMathPowRT); | 901 __ TailCallRuntime(Runtime::kMathPowRT); |
903 | 902 |
904 // The stub is called from non-optimized code, which expects the result | 903 // The stub is called from non-optimized code, which expects the result |
905 // as heap number in exponent. | 904 // as heap number in exponent. |
906 __ bind(&done); | 905 __ bind(&done); |
907 __ AllocateHeapNumber( | 906 __ AllocateHeapNumber( |
908 heapnumber, scratch, scratch2, heapnumbermap, &call_runtime); | 907 heapnumber, scratch, scratch2, heapnumbermap, &call_runtime); |
909 __ vstr(double_result, | 908 __ vstr(double_result, |
910 FieldMemOperand(heapnumber, HeapNumber::kValueOffset)); | 909 FieldMemOperand(heapnumber, HeapNumber::kValueOffset)); |
911 DCHECK(heapnumber.is(r0)); | 910 DCHECK(heapnumber.is(r0)); |
912 __ IncrementCounter(counters->math_pow(), 1, scratch, scratch2); | |
913 __ Ret(2); | 911 __ Ret(2); |
914 } else { | 912 } else { |
915 __ push(lr); | 913 __ push(lr); |
916 { | 914 { |
917 AllowExternalCallThatCantCauseGC scope(masm); | 915 AllowExternalCallThatCantCauseGC scope(masm); |
918 __ PrepareCallCFunction(0, 2, scratch); | 916 __ PrepareCallCFunction(0, 2, scratch); |
919 __ MovToFloatParameters(double_base, double_exponent); | 917 __ MovToFloatParameters(double_base, double_exponent); |
920 __ CallCFunction( | 918 __ CallCFunction( |
921 ExternalReference::power_double_double_function(isolate()), | 919 ExternalReference::power_double_double_function(isolate()), |
922 0, 2); | 920 0, 2); |
923 } | 921 } |
924 __ pop(lr); | 922 __ pop(lr); |
925 __ MovFromFloatResult(double_result); | 923 __ MovFromFloatResult(double_result); |
926 | 924 |
927 __ bind(&done); | 925 __ bind(&done); |
928 __ IncrementCounter(counters->math_pow(), 1, scratch, scratch2); | |
929 __ Ret(); | 926 __ Ret(); |
930 } | 927 } |
931 } | 928 } |
932 | 929 |
933 | 930 |
934 bool CEntryStub::NeedsImmovableCode() { | 931 bool CEntryStub::NeedsImmovableCode() { |
935 return true; | 932 return true; |
936 } | 933 } |
937 | 934 |
938 | 935 |
(...skipping 4505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5444 kStackUnwindSpace, NULL, return_value_operand, NULL); | 5441 kStackUnwindSpace, NULL, return_value_operand, NULL); |
5445 } | 5442 } |
5446 | 5443 |
5447 | 5444 |
5448 #undef __ | 5445 #undef __ |
5449 | 5446 |
5450 } // namespace internal | 5447 } // namespace internal |
5451 } // namespace v8 | 5448 } // namespace v8 |
5452 | 5449 |
5453 #endif // V8_TARGET_ARCH_ARM | 5450 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |