| 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_MIPS | 5 #if V8_TARGET_ARCH_MIPS |
| 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 955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 966 // Test whether result is zero. Bail out to check for subnormal result. | 966 // Test whether result is zero. Bail out to check for subnormal result. |
| 967 // Due to subnormals, x^-y == (1/x)^y does not hold in all cases. | 967 // Due to subnormals, x^-y == (1/x)^y does not hold in all cases. |
| 968 __ BranchF(&done, NULL, ne, double_result, kDoubleRegZero); | 968 __ BranchF(&done, NULL, ne, double_result, kDoubleRegZero); |
| 969 | 969 |
| 970 // double_exponent may not contain the exponent value if the input was a | 970 // double_exponent may not contain the exponent value if the input was a |
| 971 // smi. We set it with exponent value before bailing out. | 971 // smi. We set it with exponent value before bailing out. |
| 972 __ mtc1(exponent, single_scratch); | 972 __ mtc1(exponent, single_scratch); |
| 973 __ cvt_d_w(double_exponent, single_scratch); | 973 __ cvt_d_w(double_exponent, single_scratch); |
| 974 | 974 |
| 975 // Returning or bailing out. | 975 // Returning or bailing out. |
| 976 Counters* counters = isolate()->counters(); | |
| 977 if (exponent_type() == ON_STACK) { | 976 if (exponent_type() == ON_STACK) { |
| 978 // The arguments are still on the stack. | 977 // The arguments are still on the stack. |
| 979 __ bind(&call_runtime); | 978 __ bind(&call_runtime); |
| 980 __ TailCallRuntime(Runtime::kMathPowRT); | 979 __ TailCallRuntime(Runtime::kMathPowRT); |
| 981 | 980 |
| 982 // The stub is called from non-optimized code, which expects the result | 981 // The stub is called from non-optimized code, which expects the result |
| 983 // as heap number in exponent. | 982 // as heap number in exponent. |
| 984 __ bind(&done); | 983 __ bind(&done); |
| 985 __ AllocateHeapNumber( | 984 __ AllocateHeapNumber( |
| 986 heapnumber, scratch, scratch2, heapnumbermap, &call_runtime); | 985 heapnumber, scratch, scratch2, heapnumbermap, &call_runtime); |
| 987 __ sdc1(double_result, | 986 __ sdc1(double_result, |
| 988 FieldMemOperand(heapnumber, HeapNumber::kValueOffset)); | 987 FieldMemOperand(heapnumber, HeapNumber::kValueOffset)); |
| 989 DCHECK(heapnumber.is(v0)); | 988 DCHECK(heapnumber.is(v0)); |
| 990 __ IncrementCounter(counters->math_pow(), 1, scratch, scratch2); | |
| 991 __ DropAndRet(2); | 989 __ DropAndRet(2); |
| 992 } else { | 990 } else { |
| 993 __ push(ra); | 991 __ push(ra); |
| 994 { | 992 { |
| 995 AllowExternalCallThatCantCauseGC scope(masm); | 993 AllowExternalCallThatCantCauseGC scope(masm); |
| 996 __ PrepareCallCFunction(0, 2, scratch); | 994 __ PrepareCallCFunction(0, 2, scratch); |
| 997 __ MovToFloatParameters(double_base, double_exponent); | 995 __ MovToFloatParameters(double_base, double_exponent); |
| 998 __ CallCFunction( | 996 __ CallCFunction( |
| 999 ExternalReference::power_double_double_function(isolate()), | 997 ExternalReference::power_double_double_function(isolate()), |
| 1000 0, 2); | 998 0, 2); |
| 1001 } | 999 } |
| 1002 __ pop(ra); | 1000 __ pop(ra); |
| 1003 __ MovFromFloatResult(double_result); | 1001 __ MovFromFloatResult(double_result); |
| 1004 | 1002 |
| 1005 __ bind(&done); | 1003 __ bind(&done); |
| 1006 __ IncrementCounter(counters->math_pow(), 1, scratch, scratch2); | |
| 1007 __ Ret(); | 1004 __ Ret(); |
| 1008 } | 1005 } |
| 1009 } | 1006 } |
| 1010 | 1007 |
| 1011 | 1008 |
| 1012 bool CEntryStub::NeedsImmovableCode() { | 1009 bool CEntryStub::NeedsImmovableCode() { |
| 1013 return true; | 1010 return true; |
| 1014 } | 1011 } |
| 1015 | 1012 |
| 1016 | 1013 |
| (...skipping 4602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5619 return_value_operand, NULL); | 5616 return_value_operand, NULL); |
| 5620 } | 5617 } |
| 5621 | 5618 |
| 5622 | 5619 |
| 5623 #undef __ | 5620 #undef __ |
| 5624 | 5621 |
| 5625 } // namespace internal | 5622 } // namespace internal |
| 5626 } // namespace v8 | 5623 } // namespace v8 |
| 5627 | 5624 |
| 5628 #endif // V8_TARGET_ARCH_MIPS | 5625 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |