| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_PPC | 5 #if V8_TARGET_ARCH_PPC |
| 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 924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 935 __ fdiv(double_result, double_scratch, double_result); | 935 __ fdiv(double_result, double_scratch, double_result); |
| 936 // Test whether result is zero. Bail out to check for subnormal result. | 936 // Test whether result is zero. Bail out to check for subnormal result. |
| 937 // Due to subnormals, x^-y == (1/x)^y does not hold in all cases. | 937 // Due to subnormals, x^-y == (1/x)^y does not hold in all cases. |
| 938 __ fcmpu(double_result, kDoubleRegZero); | 938 __ fcmpu(double_result, kDoubleRegZero); |
| 939 __ bne(&done); | 939 __ bne(&done); |
| 940 // double_exponent may not containe the exponent value if the input was a | 940 // double_exponent may not containe the exponent value if the input was a |
| 941 // smi. We set it with exponent value before bailing out. | 941 // smi. We set it with exponent value before bailing out. |
| 942 __ ConvertIntToDouble(exponent, double_exponent); | 942 __ ConvertIntToDouble(exponent, double_exponent); |
| 943 | 943 |
| 944 // Returning or bailing out. | 944 // Returning or bailing out. |
| 945 Counters* counters = isolate()->counters(); | |
| 946 if (exponent_type() == ON_STACK) { | 945 if (exponent_type() == ON_STACK) { |
| 947 // The arguments are still on the stack. | 946 // The arguments are still on the stack. |
| 948 __ bind(&call_runtime); | 947 __ bind(&call_runtime); |
| 949 __ TailCallRuntime(Runtime::kMathPowRT); | 948 __ TailCallRuntime(Runtime::kMathPowRT); |
| 950 | 949 |
| 951 // The stub is called from non-optimized code, which expects the result | 950 // The stub is called from non-optimized code, which expects the result |
| 952 // as heap number in exponent. | 951 // as heap number in exponent. |
| 953 __ bind(&done); | 952 __ bind(&done); |
| 954 __ AllocateHeapNumber(heapnumber, scratch, scratch2, heapnumbermap, | 953 __ AllocateHeapNumber(heapnumber, scratch, scratch2, heapnumbermap, |
| 955 &call_runtime); | 954 &call_runtime); |
| 956 __ stfd(double_result, | 955 __ stfd(double_result, |
| 957 FieldMemOperand(heapnumber, HeapNumber::kValueOffset)); | 956 FieldMemOperand(heapnumber, HeapNumber::kValueOffset)); |
| 958 DCHECK(heapnumber.is(r3)); | 957 DCHECK(heapnumber.is(r3)); |
| 959 __ IncrementCounter(counters->math_pow(), 1, scratch, scratch2); | |
| 960 __ Ret(2); | 958 __ Ret(2); |
| 961 } else { | 959 } else { |
| 962 __ mflr(r0); | 960 __ mflr(r0); |
| 963 __ push(r0); | 961 __ push(r0); |
| 964 { | 962 { |
| 965 AllowExternalCallThatCantCauseGC scope(masm); | 963 AllowExternalCallThatCantCauseGC scope(masm); |
| 966 __ PrepareCallCFunction(0, 2, scratch); | 964 __ PrepareCallCFunction(0, 2, scratch); |
| 967 __ MovToFloatParameters(double_base, double_exponent); | 965 __ MovToFloatParameters(double_base, double_exponent); |
| 968 __ CallCFunction( | 966 __ CallCFunction( |
| 969 ExternalReference::power_double_double_function(isolate()), 0, 2); | 967 ExternalReference::power_double_double_function(isolate()), 0, 2); |
| 970 } | 968 } |
| 971 __ pop(r0); | 969 __ pop(r0); |
| 972 __ mtlr(r0); | 970 __ mtlr(r0); |
| 973 __ MovFromFloatResult(double_result); | 971 __ MovFromFloatResult(double_result); |
| 974 | 972 |
| 975 __ bind(&done); | 973 __ bind(&done); |
| 976 __ IncrementCounter(counters->math_pow(), 1, scratch, scratch2); | |
| 977 __ Ret(); | 974 __ Ret(); |
| 978 } | 975 } |
| 979 } | 976 } |
| 980 | 977 |
| 981 | 978 |
| 982 bool CEntryStub::NeedsImmovableCode() { return true; } | 979 bool CEntryStub::NeedsImmovableCode() { return true; } |
| 983 | 980 |
| 984 | 981 |
| 985 void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) { | 982 void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) { |
| 986 CEntryStub::GenerateAheadOfTime(isolate); | 983 CEntryStub::GenerateAheadOfTime(isolate); |
| (...skipping 4694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5681 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, | 5678 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, |
| 5682 kStackUnwindSpace, NULL, return_value_operand, NULL); | 5679 kStackUnwindSpace, NULL, return_value_operand, NULL); |
| 5683 } | 5680 } |
| 5684 | 5681 |
| 5685 | 5682 |
| 5686 #undef __ | 5683 #undef __ |
| 5687 } // namespace internal | 5684 } // namespace internal |
| 5688 } // namespace v8 | 5685 } // namespace v8 |
| 5689 | 5686 |
| 5690 #endif // V8_TARGET_ARCH_PPC | 5687 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |