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

Side by Side Diff: src/mips64/lithium-codegen-mips64.cc

Issue 1192413002: MIPS64: Fix random failures of fannkuch.js. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comments 2. Created 5 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 unified diff | Download patch
« no previous file with comments | « src/mips64/lithium-codegen-mips64.h ('k') | test/mjsunit/math-abs.js » ('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 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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/cpu-profiler.h" 9 #include "src/cpu-profiler.h"
10 #include "src/hydrogen-osr.h" 10 #include "src/hydrogen-osr.h"
(...skipping 3755 matching lines...) Expand 10 before | Expand all | Expand 10 after
3766 } 3766 }
3767 3767
3768 3768
3769 void LCodeGen::EmitIntegerMathAbs(LMathAbs* instr) { 3769 void LCodeGen::EmitIntegerMathAbs(LMathAbs* instr) {
3770 Register input = ToRegister(instr->value()); 3770 Register input = ToRegister(instr->value());
3771 Register result = ToRegister(instr->result()); 3771 Register result = ToRegister(instr->result());
3772 Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm_); 3772 Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm_);
3773 Label done; 3773 Label done;
3774 __ Branch(USE_DELAY_SLOT, &done, ge, input, Operand(zero_reg)); 3774 __ Branch(USE_DELAY_SLOT, &done, ge, input, Operand(zero_reg));
3775 __ mov(result, input); 3775 __ mov(result, input);
3776 __ subu(result, zero_reg, input);
3777 // Overflow if result is still negative, i.e. 0x80000000.
3778 DeoptimizeIf(lt, instr, Deoptimizer::kOverflow, result, Operand(zero_reg));
3779 __ bind(&done);
3780 }
3781
3782
3783 void LCodeGen::EmitSmiMathAbs(LMathAbs* instr) {
3784 Register input = ToRegister(instr->value());
3785 Register result = ToRegister(instr->result());
3786 Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm_);
3787 Label done;
3788 __ Branch(USE_DELAY_SLOT, &done, ge, input, Operand(zero_reg));
3789 __ mov(result, input);
3776 __ dsubu(result, zero_reg, input); 3790 __ dsubu(result, zero_reg, input);
3777 // Overflow if result is still negative, i.e. 0x80000000. 3791 // Overflow if result is still negative, i.e. 0x80000000 00000000.
3778 DeoptimizeIf(lt, instr, Deoptimizer::kOverflow, result, Operand(zero_reg)); 3792 DeoptimizeIf(lt, instr, Deoptimizer::kOverflow, result, Operand(zero_reg));
3779 __ bind(&done); 3793 __ bind(&done);
3780 } 3794 }
3781 3795
3782 3796
3783 void LCodeGen::DoMathAbs(LMathAbs* instr) { 3797 void LCodeGen::DoMathAbs(LMathAbs* instr) {
3784 // Class for deferred case. 3798 // Class for deferred case.
3785 class DeferredMathAbsTaggedHeapNumber final : public LDeferredCode { 3799 class DeferredMathAbsTaggedHeapNumber final : public LDeferredCode {
3786 public: 3800 public:
3787 DeferredMathAbsTaggedHeapNumber(LCodeGen* codegen, LMathAbs* instr) 3801 DeferredMathAbsTaggedHeapNumber(LCodeGen* codegen, LMathAbs* instr)
3788 : LDeferredCode(codegen), instr_(instr) { } 3802 : LDeferredCode(codegen), instr_(instr) { }
3789 void Generate() override { 3803 void Generate() override {
3790 codegen()->DoDeferredMathAbsTaggedHeapNumber(instr_); 3804 codegen()->DoDeferredMathAbsTaggedHeapNumber(instr_);
3791 } 3805 }
3792 LInstruction* instr() override { return instr_; } 3806 LInstruction* instr() override { return instr_; }
3793 3807
3794 private: 3808 private:
3795 LMathAbs* instr_; 3809 LMathAbs* instr_;
3796 }; 3810 };
3797 3811
3798 Representation r = instr->hydrogen()->value()->representation(); 3812 Representation r = instr->hydrogen()->value()->representation();
3799 if (r.IsDouble()) { 3813 if (r.IsDouble()) {
3800 FPURegister input = ToDoubleRegister(instr->value()); 3814 FPURegister input = ToDoubleRegister(instr->value());
3801 FPURegister result = ToDoubleRegister(instr->result()); 3815 FPURegister result = ToDoubleRegister(instr->result());
3802 __ abs_d(result, input); 3816 __ abs_d(result, input);
3803 } else if (r.IsSmiOrInteger32()) { 3817 } else if (r.IsInteger32()) {
3804 EmitIntegerMathAbs(instr); 3818 EmitIntegerMathAbs(instr);
3819 } else if (r.IsSmi()) {
3820 EmitSmiMathAbs(instr);
3805 } else { 3821 } else {
3806 // Representation is tagged. 3822 // Representation is tagged.
3807 DeferredMathAbsTaggedHeapNumber* deferred = 3823 DeferredMathAbsTaggedHeapNumber* deferred =
3808 new(zone()) DeferredMathAbsTaggedHeapNumber(this, instr); 3824 new(zone()) DeferredMathAbsTaggedHeapNumber(this, instr);
3809 Register input = ToRegister(instr->value()); 3825 Register input = ToRegister(instr->value());
3810 // Smi check. 3826 // Smi check.
3811 __ JumpIfNotSmi(input, deferred->entry()); 3827 __ JumpIfNotSmi(input, deferred->entry());
3812 // If smi, handle it directly. 3828 // If smi, handle it directly.
3813 EmitIntegerMathAbs(instr); 3829 EmitSmiMathAbs(instr);
3814 __ bind(deferred->exit()); 3830 __ bind(deferred->exit());
3815 } 3831 }
3816 } 3832 }
3817 3833
3818 3834
3819 void LCodeGen::DoMathFloor(LMathFloor* instr) { 3835 void LCodeGen::DoMathFloor(LMathFloor* instr) {
3820 DoubleRegister input = ToDoubleRegister(instr->value()); 3836 DoubleRegister input = ToDoubleRegister(instr->value());
3821 Register result = ToRegister(instr->result()); 3837 Register result = ToRegister(instr->result());
3822 Register scratch1 = scratch0(); 3838 Register scratch1 = scratch0();
3823 Register except_flag = ToRegister(instr->temp()); 3839 Register except_flag = ToRegister(instr->temp());
(...skipping 2345 matching lines...) Expand 10 before | Expand all | Expand 10 after
6169 __ Push(at, ToRegister(instr->function())); 6185 __ Push(at, ToRegister(instr->function()));
6170 CallRuntime(Runtime::kPushBlockContext, 2, instr); 6186 CallRuntime(Runtime::kPushBlockContext, 2, instr);
6171 RecordSafepoint(Safepoint::kNoLazyDeopt); 6187 RecordSafepoint(Safepoint::kNoLazyDeopt);
6172 } 6188 }
6173 6189
6174 6190
6175 #undef __ 6191 #undef __
6176 6192
6177 } // namespace internal 6193 } // namespace internal
6178 } // namespace v8 6194 } // namespace v8
OLDNEW
« no previous file with comments | « src/mips64/lithium-codegen-mips64.h ('k') | test/mjsunit/math-abs.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698