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_MIPS64 | 5 #if V8_TARGET_ARCH_MIPS64 |
6 | 6 |
7 #include "src/bootstrapper.h" | 7 #include "src/bootstrapper.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/ic/handler-compiler.h" | 10 #include "src/ic/handler-compiler.h" |
(...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
964 // Test whether result is zero. Bail out to check for subnormal result. | 964 // Test whether result is zero. Bail out to check for subnormal result. |
965 // Due to subnormals, x^-y == (1/x)^y does not hold in all cases. | 965 // Due to subnormals, x^-y == (1/x)^y does not hold in all cases. |
966 __ BranchF(&done, NULL, ne, double_result, kDoubleRegZero); | 966 __ BranchF(&done, NULL, ne, double_result, kDoubleRegZero); |
967 | 967 |
968 // double_exponent may not contain the exponent value if the input was a | 968 // double_exponent may not contain the exponent value if the input was a |
969 // smi. We set it with exponent value before bailing out. | 969 // smi. We set it with exponent value before bailing out. |
970 __ mtc1(exponent, single_scratch); | 970 __ mtc1(exponent, single_scratch); |
971 __ cvt_d_w(double_exponent, single_scratch); | 971 __ cvt_d_w(double_exponent, single_scratch); |
972 | 972 |
973 // Returning or bailing out. | 973 // Returning or bailing out. |
974 Counters* counters = isolate()->counters(); | |
975 if (exponent_type() == ON_STACK) { | 974 if (exponent_type() == ON_STACK) { |
976 // The arguments are still on the stack. | 975 // The arguments are still on the stack. |
977 __ bind(&call_runtime); | 976 __ bind(&call_runtime); |
978 __ TailCallRuntime(Runtime::kMathPowRT); | 977 __ TailCallRuntime(Runtime::kMathPowRT); |
979 | 978 |
980 // The stub is called from non-optimized code, which expects the result | 979 // The stub is called from non-optimized code, which expects the result |
981 // as heap number in exponent. | 980 // as heap number in exponent. |
982 __ bind(&done); | 981 __ bind(&done); |
983 __ AllocateHeapNumber( | 982 __ AllocateHeapNumber( |
984 heapnumber, scratch, scratch2, heapnumbermap, &call_runtime); | 983 heapnumber, scratch, scratch2, heapnumbermap, &call_runtime); |
985 __ sdc1(double_result, | 984 __ sdc1(double_result, |
986 FieldMemOperand(heapnumber, HeapNumber::kValueOffset)); | 985 FieldMemOperand(heapnumber, HeapNumber::kValueOffset)); |
987 DCHECK(heapnumber.is(v0)); | 986 DCHECK(heapnumber.is(v0)); |
988 __ IncrementCounter(counters->math_pow(), 1, scratch, scratch2); | |
989 __ DropAndRet(2); | 987 __ DropAndRet(2); |
990 } else { | 988 } else { |
991 __ push(ra); | 989 __ push(ra); |
992 { | 990 { |
993 AllowExternalCallThatCantCauseGC scope(masm); | 991 AllowExternalCallThatCantCauseGC scope(masm); |
994 __ PrepareCallCFunction(0, 2, scratch); | 992 __ PrepareCallCFunction(0, 2, scratch); |
995 __ MovToFloatParameters(double_base, double_exponent); | 993 __ MovToFloatParameters(double_base, double_exponent); |
996 __ CallCFunction( | 994 __ CallCFunction( |
997 ExternalReference::power_double_double_function(isolate()), | 995 ExternalReference::power_double_double_function(isolate()), |
998 0, 2); | 996 0, 2); |
999 } | 997 } |
1000 __ pop(ra); | 998 __ pop(ra); |
1001 __ MovFromFloatResult(double_result); | 999 __ MovFromFloatResult(double_result); |
1002 | 1000 |
1003 __ bind(&done); | 1001 __ bind(&done); |
1004 __ IncrementCounter(counters->math_pow(), 1, scratch, scratch2); | |
1005 __ Ret(); | 1002 __ Ret(); |
1006 } | 1003 } |
1007 } | 1004 } |
1008 | 1005 |
1009 | 1006 |
1010 bool CEntryStub::NeedsImmovableCode() { | 1007 bool CEntryStub::NeedsImmovableCode() { |
1011 return true; | 1008 return true; |
1012 } | 1009 } |
1013 | 1010 |
1014 | 1011 |
(...skipping 4627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5642 return_value_operand, NULL); | 5639 return_value_operand, NULL); |
5643 } | 5640 } |
5644 | 5641 |
5645 | 5642 |
5646 #undef __ | 5643 #undef __ |
5647 | 5644 |
5648 } // namespace internal | 5645 } // namespace internal |
5649 } // namespace v8 | 5646 } // namespace v8 |
5650 | 5647 |
5651 #endif // V8_TARGET_ARCH_MIPS64 | 5648 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |