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

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

Issue 9195009: MIPS: Inlining Math.min and Math.max in crankshaft. (Closed)
Patch Set: Created 8 years, 11 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/mips/lithium-codegen-mips.h ('k') | no next file » | 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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 3798 matching lines...) Expand 10 before | Expand all | Expand 10 after
3809 DeoptimizeIf(ne, instr->environment(), scratch, Operand(zero_reg)); 3809 DeoptimizeIf(ne, instr->environment(), scratch, Operand(zero_reg));
3810 } else { 3810 } else {
3811 __ SmiUntag(ToRegister(input)); 3811 __ SmiUntag(ToRegister(input));
3812 } 3812 }
3813 } 3813 }
3814 3814
3815 3815
3816 void LCodeGen::EmitNumberUntagD(Register input_reg, 3816 void LCodeGen::EmitNumberUntagD(Register input_reg,
3817 DoubleRegister result_reg, 3817 DoubleRegister result_reg,
3818 bool deoptimize_on_undefined, 3818 bool deoptimize_on_undefined,
3819 bool deoptimize_on_minus_zero,
3819 LEnvironment* env) { 3820 LEnvironment* env) {
3820 Register scratch = scratch0(); 3821 Register scratch = scratch0();
3821 3822
3822 Label load_smi, heap_number, done; 3823 Label load_smi, heap_number, done;
3823 3824
3824 // Smi check. 3825 // Smi check.
3825 __ JumpIfSmi(input_reg, &load_smi); 3826 __ JumpIfSmi(input_reg, &load_smi);
3826 3827
3827 // Heap number map check. 3828 // Heap number map check.
3828 __ lw(scratch, FieldMemOperand(input_reg, HeapObject::kMapOffset)); 3829 __ lw(scratch, FieldMemOperand(input_reg, HeapObject::kMapOffset));
3829 __ LoadRoot(at, Heap::kHeapNumberMapRootIndex); 3830 __ LoadRoot(at, Heap::kHeapNumberMapRootIndex);
3830 if (deoptimize_on_undefined) { 3831 if (deoptimize_on_undefined) {
3831 DeoptimizeIf(ne, env, scratch, Operand(at)); 3832 DeoptimizeIf(ne, env, scratch, Operand(at));
3832 } else { 3833 } else {
3833 Label heap_number; 3834 Label heap_number;
3834 __ Branch(&heap_number, eq, scratch, Operand(at)); 3835 __ Branch(&heap_number, eq, scratch, Operand(at));
3835 3836
3836 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); 3837 __ LoadRoot(at, Heap::kUndefinedValueRootIndex);
3837 DeoptimizeIf(ne, env, input_reg, Operand(at)); 3838 DeoptimizeIf(ne, env, input_reg, Operand(at));
3838 3839
3839 // Convert undefined to NaN. 3840 // Convert undefined to NaN.
3840 __ LoadRoot(at, Heap::kNanValueRootIndex); 3841 __ LoadRoot(at, Heap::kNanValueRootIndex);
3841 __ ldc1(result_reg, FieldMemOperand(at, HeapNumber::kValueOffset)); 3842 __ ldc1(result_reg, FieldMemOperand(at, HeapNumber::kValueOffset));
3842 __ Branch(&done); 3843 __ Branch(&done);
3843 3844
3844 __ bind(&heap_number); 3845 __ bind(&heap_number);
3845 } 3846 }
3846 // Heap number to double register conversion. 3847 // Heap number to double register conversion.
3847 __ ldc1(result_reg, FieldMemOperand(input_reg, HeapNumber::kValueOffset)); 3848 __ ldc1(result_reg, FieldMemOperand(input_reg, HeapNumber::kValueOffset));
3849 if (deoptimize_on_minus_zero) {
3850 __ mfc1(at, result_reg.low());
3851 __ Branch(&done, ne, at, Operand(zero_reg));
3852 __ mfc1(scratch, result_reg.high());
3853 DeoptimizeIf(eq, env, scratch, Operand(HeapNumber::kSignMask));
3854 }
3848 __ Branch(&done); 3855 __ Branch(&done);
3849 3856
3850 // Smi to double register conversion 3857 // Smi to double register conversion
3851 __ bind(&load_smi); 3858 __ bind(&load_smi);
3852 __ SmiUntag(input_reg); // Untag smi before converting to float. 3859 __ SmiUntag(input_reg); // Untag smi before converting to float.
3853 __ mtc1(input_reg, result_reg); 3860 __ mtc1(input_reg, result_reg);
3854 __ cvt_d_w(result_reg, result_reg); 3861 __ cvt_d_w(result_reg, result_reg);
3855 __ SmiTag(input_reg); // Retag smi. 3862 __ SmiTag(input_reg); // Retag smi.
3856 __ bind(&done); 3863 __ bind(&done);
3857 } 3864 }
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
3969 LOperand* input = instr->InputAt(0); 3976 LOperand* input = instr->InputAt(0);
3970 ASSERT(input->IsRegister()); 3977 ASSERT(input->IsRegister());
3971 LOperand* result = instr->result(); 3978 LOperand* result = instr->result();
3972 ASSERT(result->IsDoubleRegister()); 3979 ASSERT(result->IsDoubleRegister());
3973 3980
3974 Register input_reg = ToRegister(input); 3981 Register input_reg = ToRegister(input);
3975 DoubleRegister result_reg = ToDoubleRegister(result); 3982 DoubleRegister result_reg = ToDoubleRegister(result);
3976 3983
3977 EmitNumberUntagD(input_reg, result_reg, 3984 EmitNumberUntagD(input_reg, result_reg,
3978 instr->hydrogen()->deoptimize_on_undefined(), 3985 instr->hydrogen()->deoptimize_on_undefined(),
3986 instr->hydrogen()->deoptimize_on_minus_zero(),
3979 instr->environment()); 3987 instr->environment());
3980 } 3988 }
3981 3989
3982 3990
3983 void LCodeGen::DoDoubleToI(LDoubleToI* instr) { 3991 void LCodeGen::DoDoubleToI(LDoubleToI* instr) {
3984 Register result_reg = ToRegister(instr->result()); 3992 Register result_reg = ToRegister(instr->result());
3985 Register scratch1 = scratch0(); 3993 Register scratch1 = scratch0();
3986 Register scratch2 = ToRegister(instr->TempAt(0)); 3994 Register scratch2 = ToRegister(instr->TempAt(0));
3987 DoubleRegister double_input = ToDoubleRegister(instr->InputAt(0)); 3995 DoubleRegister double_input = ToDoubleRegister(instr->InputAt(0));
3988 DoubleRegister double_scratch = double_scratch0(); 3996 DoubleRegister double_scratch = double_scratch0();
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after
4706 ASSERT(!environment->HasBeenRegistered()); 4714 ASSERT(!environment->HasBeenRegistered());
4707 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); 4715 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt);
4708 ASSERT(osr_pc_offset_ == -1); 4716 ASSERT(osr_pc_offset_ == -1);
4709 osr_pc_offset_ = masm()->pc_offset(); 4717 osr_pc_offset_ = masm()->pc_offset();
4710 } 4718 }
4711 4719
4712 4720
4713 #undef __ 4721 #undef __
4714 4722
4715 } } // namespace v8::internal 4723 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mips/lithium-codegen-mips.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698