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

Unified Diff: src/s390/code-stubs-s390.cc

Issue 2106883002: PPC/s390: [turbofan] Introduce Float64Pow and NumberPow operators. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ppc/code-stubs-ppc.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/s390/code-stubs-s390.cc
diff --git a/src/s390/code-stubs-s390.cc b/src/s390/code-stubs-s390.cc
index 6098c37c4409267082f45ef412a4b527eb795851..ab85852a4945b1dc2eeff6c5f42a34dadeb8eeec 100644
--- a/src/s390/code-stubs-s390.cc
+++ b/src/s390/code-stubs-s390.cc
@@ -711,11 +711,8 @@ void RestoreRegistersStateStub::Generate(MacroAssembler* masm) {
}
void MathPowStub::Generate(MacroAssembler* masm) {
- const Register base = r3;
const Register exponent = MathPowTaggedDescriptor::exponent();
DCHECK(exponent.is(r4));
- const Register heapnumbermap = r7;
- const Register heapnumber = r2;
const DoubleRegister double_base = d1;
const DoubleRegister double_exponent = d2;
const DoubleRegister double_result = d3;
@@ -724,36 +721,7 @@ void MathPowStub::Generate(MacroAssembler* masm) {
const Register scratch2 = r9;
Label call_runtime, done, int_exponent;
- if (exponent_type() == ON_STACK) {
- Label base_is_smi, unpack_exponent;
- // The exponent and base are supplied as arguments on the stack.
- // This can only happen if the stub is called from non-optimized code.
- // Load input parameters from stack to double registers.
- __ LoadP(base, MemOperand(sp, 1 * kPointerSize));
- __ LoadP(exponent, MemOperand(sp, 0 * kPointerSize));
-
- __ LoadRoot(heapnumbermap, Heap::kHeapNumberMapRootIndex);
-
- __ UntagAndJumpIfSmi(scratch, base, &base_is_smi);
- __ LoadP(scratch, FieldMemOperand(base, JSObject::kMapOffset));
- __ CmpP(scratch, heapnumbermap);
- __ bne(&call_runtime);
-
- __ LoadDouble(double_base, FieldMemOperand(base, HeapNumber::kValueOffset));
- __ b(&unpack_exponent, Label::kNear);
-
- __ bind(&base_is_smi);
- __ ConvertIntToDouble(scratch, double_base);
- __ bind(&unpack_exponent);
-
- __ UntagAndJumpIfSmi(scratch, exponent, &int_exponent);
- __ LoadP(scratch, FieldMemOperand(exponent, JSObject::kMapOffset));
- __ CmpP(scratch, heapnumbermap);
- __ bne(&call_runtime);
-
- __ LoadDouble(double_exponent,
- FieldMemOperand(exponent, HeapNumber::kValueOffset));
- } else if (exponent_type() == TAGGED) {
+ if (exponent_type() == TAGGED) {
// Base is already in double_base.
__ UntagAndJumpIfSmi(scratch, exponent, &int_exponent);
@@ -767,57 +735,6 @@ void MathPowStub::Generate(MacroAssembler* masm) {
double_scratch);
__ beq(&int_exponent, Label::kNear);
- if (exponent_type() == ON_STACK) {
- // Detect square root case. Crankshaft detects constant +/-0.5 at
- // compile time and uses DoMathPowHalf instead. We then skip this check
- // for non-constant cases of +/-0.5 as these hardly occur.
- Label not_plus_half, not_minus_inf1, not_minus_inf2;
-
- // Test for 0.5.
- __ LoadDoubleLiteral(double_scratch, 0.5, scratch);
- __ cdbr(double_exponent, double_scratch);
- __ bne(&not_plus_half, Label::kNear);
-
- // Calculates square root of base. Check for the special case of
- // Math.pow(-Infinity, 0.5) == Infinity (ECMA spec, 15.8.2.13).
- __ LoadDoubleLiteral(double_scratch, -V8_INFINITY, scratch);
- __ cdbr(double_base, double_scratch);
- __ bne(&not_minus_inf1, Label::kNear);
- __ lcdbr(double_result, double_scratch);
- __ b(&done);
- __ bind(&not_minus_inf1);
-
- // Add +0 to convert -0 to +0.
- __ ldr(double_scratch, double_base);
- __ lzdr(kDoubleRegZero);
- __ adbr(double_scratch, kDoubleRegZero);
- __ sqdbr(double_result, double_scratch);
- __ b(&done);
-
- __ bind(&not_plus_half);
- __ LoadDoubleLiteral(double_scratch, -0.5, scratch);
- __ cdbr(double_exponent, double_scratch);
- __ bne(&call_runtime);
-
- // Calculates square root of base. Check for the special case of
- // Math.pow(-Infinity, -0.5) == 0 (ECMA spec, 15.8.2.13).
- __ LoadDoubleLiteral(double_scratch, -V8_INFINITY, scratch);
- __ cdbr(double_base, double_scratch);
- __ bne(&not_minus_inf2, Label::kNear);
- __ ldr(double_result, kDoubleRegZero);
- __ b(&done);
- __ bind(&not_minus_inf2);
-
- // Add +0 to convert -0 to +0.
- __ ldr(double_scratch, double_base);
- __ lzdr(kDoubleRegZero);
- __ adbr(double_scratch, kDoubleRegZero);
- __ LoadDoubleLiteral(double_result, 1.0, scratch);
- __ sqdbr(double_scratch, double_scratch);
- __ ddbr(double_result, double_scratch);
- __ b(&done);
- }
-
__ push(r14);
{
AllowExternalCallThatCantCauseGC scope(masm);
@@ -884,35 +801,19 @@ void MathPowStub::Generate(MacroAssembler* masm) {
__ ConvertIntToDouble(exponent, double_exponent);
// Returning or bailing out.
- if (exponent_type() == ON_STACK) {
- // The arguments are still on the stack.
- __ bind(&call_runtime);
- __ TailCallRuntime(Runtime::kMathPowRT);
-
- // The stub is called from non-optimized code, which expects the result
- // as heap number in exponent.
- __ bind(&done);
- __ AllocateHeapNumber(heapnumber, scratch, scratch2, heapnumbermap,
- &call_runtime);
- __ StoreDouble(double_result,
- FieldMemOperand(heapnumber, HeapNumber::kValueOffset));
- DCHECK(heapnumber.is(r2));
- __ Ret(2);
- } else {
- __ push(r14);
- {
- AllowExternalCallThatCantCauseGC scope(masm);
- __ PrepareCallCFunction(0, 2, scratch);
- __ MovToFloatParameters(double_base, double_exponent);
- __ CallCFunction(
- ExternalReference::power_double_double_function(isolate()), 0, 2);
- }
- __ pop(r14);
- __ MovFromFloatResult(double_result);
-
- __ bind(&done);
- __ Ret();
+ __ push(r14);
+ {
+ AllowExternalCallThatCantCauseGC scope(masm);
+ __ PrepareCallCFunction(0, 2, scratch);
+ __ MovToFloatParameters(double_base, double_exponent);
+ __ CallCFunction(
+ ExternalReference::power_double_double_function(isolate()), 0, 2);
}
+ __ pop(r14);
+ __ MovFromFloatResult(double_result);
+
+ __ bind(&done);
+ __ Ret();
}
bool CEntryStub::NeedsImmovableCode() { return true; }
« no previous file with comments | « src/ppc/code-stubs-ppc.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698