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

Side by Side Diff: src/crankshaft/ppc/lithium-codegen-ppc.cc

Issue 1839643007: PPC: [crankshaft] Address the deoptimization loops of Math.floor, Math.round and Math.ceil. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix DEBUG Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « src/crankshaft/hydrogen-instructions.h ('k') | src/crankshaft/ppc/lithium-ppc.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "src/crankshaft/ppc/lithium-codegen-ppc.h" 5 #include "src/crankshaft/ppc/lithium-codegen-ppc.h"
6 6
7 #include "src/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/code-factory.h" 8 #include "src/code-factory.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/crankshaft/hydrogen-osr.h" 10 #include "src/crankshaft/hydrogen-osr.h"
(...skipping 3595 matching lines...) Expand 10 before | Expand all | Expand 10 after
3606 new (zone()) DeferredMathAbsTaggedHeapNumber(this, instr); 3606 new (zone()) DeferredMathAbsTaggedHeapNumber(this, instr);
3607 Register input = ToRegister(instr->value()); 3607 Register input = ToRegister(instr->value());
3608 // Smi check. 3608 // Smi check.
3609 __ JumpIfNotSmi(input, deferred->entry()); 3609 __ JumpIfNotSmi(input, deferred->entry());
3610 // If smi, handle it directly. 3610 // If smi, handle it directly.
3611 EmitMathAbs(instr); 3611 EmitMathAbs(instr);
3612 __ bind(deferred->exit()); 3612 __ bind(deferred->exit());
3613 } 3613 }
3614 } 3614 }
3615 3615
3616 void LCodeGen::DoMathFloorD(LMathFloorD* instr) {
3617 DoubleRegister input_reg = ToDoubleRegister(instr->value());
3618 DoubleRegister output_reg = ToDoubleRegister(instr->result());
3619 __ frim(output_reg, input_reg);
3620 }
3616 3621
3617 void LCodeGen::DoMathFloor(LMathFloor* instr) { 3622 void LCodeGen::DoMathFloorI(LMathFloorI* instr) {
3618 DoubleRegister input = ToDoubleRegister(instr->value()); 3623 DoubleRegister input = ToDoubleRegister(instr->value());
3619 Register result = ToRegister(instr->result()); 3624 Register result = ToRegister(instr->result());
3620 Register input_high = scratch0(); 3625 Register input_high = scratch0();
3621 Register scratch = ip; 3626 Register scratch = ip;
3622 Label done, exact; 3627 Label done, exact;
3623 3628
3624 __ TryInt32Floor(result, input, input_high, scratch, double_scratch0(), &done, 3629 __ TryInt32Floor(result, input, input_high, scratch, double_scratch0(), &done,
3625 &exact); 3630 &exact);
3626 DeoptimizeIf(al, instr, Deoptimizer::kLostPrecisionOrNaN); 3631 DeoptimizeIf(al, instr, Deoptimizer::kLostPrecisionOrNaN);
3627 3632
3628 __ bind(&exact); 3633 __ bind(&exact);
3629 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { 3634 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
3630 // Test for -0. 3635 // Test for -0.
3631 __ cmpi(result, Operand::Zero()); 3636 __ cmpi(result, Operand::Zero());
3632 __ bne(&done); 3637 __ bne(&done);
3633 __ cmpwi(input_high, Operand::Zero()); 3638 __ cmpwi(input_high, Operand::Zero());
3634 DeoptimizeIf(lt, instr, Deoptimizer::kMinusZero); 3639 DeoptimizeIf(lt, instr, Deoptimizer::kMinusZero);
3635 } 3640 }
3636 __ bind(&done); 3641 __ bind(&done);
3637 } 3642 }
3638 3643
3644 void LCodeGen::DoMathRoundD(LMathRoundD* instr) {
3645 DoubleRegister input_reg = ToDoubleRegister(instr->value());
3646 DoubleRegister output_reg = ToDoubleRegister(instr->result());
3647 DoubleRegister dot_five = double_scratch0();
3648 Label done;
3639 3649
3640 void LCodeGen::DoMathRound(LMathRound* instr) { 3650 __ frin(output_reg, input_reg);
3651 __ fcmpu(input_reg, kDoubleRegZero);
3652 __ bge(&done);
3653 __ fcmpu(output_reg, input_reg);
3654 __ beq(&done);
3655
3656 // Negative, non-integer case
3657 __ LoadDoubleLiteral(dot_five, 0.5, r0);
3658 __ fadd(output_reg, input_reg, dot_five);
3659 __ frim(output_reg, output_reg);
3660 // The range [-0.5, -0.0[ yielded +0.0. Force the sign to negative.
3661 __ fabs(output_reg, output_reg);
3662 __ fneg(output_reg, output_reg);
3663
3664 __ bind(&done);
3665 }
3666
3667 void LCodeGen::DoMathRoundI(LMathRoundI* instr) {
3641 DoubleRegister input = ToDoubleRegister(instr->value()); 3668 DoubleRegister input = ToDoubleRegister(instr->value());
3642 Register result = ToRegister(instr->result()); 3669 Register result = ToRegister(instr->result());
3643 DoubleRegister double_scratch1 = ToDoubleRegister(instr->temp()); 3670 DoubleRegister double_scratch1 = ToDoubleRegister(instr->temp());
3644 DoubleRegister input_plus_dot_five = double_scratch1; 3671 DoubleRegister input_plus_dot_five = double_scratch1;
3645 Register scratch1 = scratch0(); 3672 Register scratch1 = scratch0();
3646 Register scratch2 = ip; 3673 Register scratch2 = ip;
3647 DoubleRegister dot_five = double_scratch0(); 3674 DoubleRegister dot_five = double_scratch0();
3648 Label convert, done; 3675 Label convert, done;
3649 3676
3650 __ LoadDoubleLiteral(dot_five, 0.5, r0); 3677 __ LoadDoubleLiteral(dot_five, 0.5, r0);
(...skipping 2099 matching lines...) Expand 10 before | Expand all | Expand 10 after
5750 __ LoadP(result, 5777 __ LoadP(result,
5751 FieldMemOperand(scratch, FixedArray::kHeaderSize - kPointerSize)); 5778 FieldMemOperand(scratch, FixedArray::kHeaderSize - kPointerSize));
5752 __ bind(deferred->exit()); 5779 __ bind(deferred->exit());
5753 __ bind(&done); 5780 __ bind(&done);
5754 } 5781 }
5755 5782
5756 #undef __ 5783 #undef __
5757 5784
5758 } // namespace internal 5785 } // namespace internal
5759 } // namespace v8 5786 } // namespace v8
OLDNEW
« no previous file with comments | « src/crankshaft/hydrogen-instructions.h ('k') | src/crankshaft/ppc/lithium-ppc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698