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

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

Issue 8833007: Fix a bug with register use in optimized Math.round. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years 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 | Annotate | Revision Log
« no previous file with comments | « src/ia32/lithium-codegen-ia32.cc ('k') | src/x64/lithium-codegen-x64.cc » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 2910 matching lines...) Expand 10 before | Expand all | Expand 10 after
2921 2921
2922 // The following conversion will not work with numbers 2922 // The following conversion will not work with numbers
2923 // outside of ]-2^32, 2^32[. 2923 // outside of ]-2^32, 2^32[.
2924 DeoptimizeIf(ge, instr->environment(), scratch, 2924 DeoptimizeIf(ge, instr->environment(), scratch,
2925 Operand(HeapNumber::kExponentBias + 32)); 2925 Operand(HeapNumber::kExponentBias + 32));
2926 2926
2927 // Save the original sign for later comparison. 2927 // Save the original sign for later comparison.
2928 __ And(scratch, result, Operand(HeapNumber::kSignMask)); 2928 __ And(scratch, result, Operand(HeapNumber::kSignMask));
2929 2929
2930 __ Move(double_scratch0(), 0.5); 2930 __ Move(double_scratch0(), 0.5);
2931 __ add_d(input, input, double_scratch0()); 2931 __ add_d(double_scratch0(), input, double_scratch0());
2932 2932
2933 // Check sign of the result: if the sign changed, the input 2933 // Check sign of the result: if the sign changed, the input
2934 // value was in ]0.5, 0[ and the result should be -0. 2934 // value was in ]0.5, 0[ and the result should be -0.
2935 __ mfc1(result, input.high()); 2935 __ mfc1(result, double_scratch0().high());
2936 __ Xor(result, result, Operand(scratch)); 2936 __ Xor(result, result, Operand(scratch));
2937 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { 2937 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
2938 // ARM uses 'mi' here, which is 'lt' 2938 // ARM uses 'mi' here, which is 'lt'
2939 DeoptimizeIf(lt, instr->environment(), result, 2939 DeoptimizeIf(lt, instr->environment(), result,
2940 Operand(zero_reg)); 2940 Operand(zero_reg));
2941 } else { 2941 } else {
2942 Label skip2; 2942 Label skip2;
2943 // ARM uses 'mi' here, which is 'lt' 2943 // ARM uses 'mi' here, which is 'lt'
2944 // Negating it results in 'ge' 2944 // Negating it results in 'ge'
2945 __ Branch(&skip2, ge, result, Operand(zero_reg)); 2945 __ Branch(&skip2, ge, result, Operand(zero_reg));
2946 __ mov(result, zero_reg); 2946 __ mov(result, zero_reg);
2947 __ Branch(&done); 2947 __ Branch(&done);
2948 __ bind(&skip2); 2948 __ bind(&skip2);
2949 } 2949 }
2950 2950
2951 Register except_flag = scratch; 2951 Register except_flag = scratch;
2952 2952
2953 __ EmitFPUTruncate(kRoundToMinusInf, 2953 __ EmitFPUTruncate(kRoundToMinusInf,
2954 double_scratch0().low(), 2954 double_scratch0().low(),
2955 input, 2955 double_scratch0(),
2956 result, 2956 result,
2957 except_flag); 2957 except_flag);
2958 2958
2959 DeoptimizeIf(ne, instr->environment(), except_flag, Operand(zero_reg)); 2959 DeoptimizeIf(ne, instr->environment(), except_flag, Operand(zero_reg));
2960 2960
2961 __ mfc1(result, double_scratch0().low()); 2961 __ mfc1(result, double_scratch0().low());
2962 2962
2963 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { 2963 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
2964 // Test for -0. 2964 // Test for -0.
2965 __ Branch(&done, ne, result, Operand(zero_reg)); 2965 __ Branch(&done, ne, result, Operand(zero_reg));
(...skipping 1665 matching lines...) Expand 10 before | Expand all | Expand 10 after
4631 ASSERT(!environment->HasBeenRegistered()); 4631 ASSERT(!environment->HasBeenRegistered());
4632 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); 4632 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt);
4633 ASSERT(osr_pc_offset_ == -1); 4633 ASSERT(osr_pc_offset_ == -1);
4634 osr_pc_offset_ = masm()->pc_offset(); 4634 osr_pc_offset_ = masm()->pc_offset();
4635 } 4635 }
4636 4636
4637 4637
4638 #undef __ 4638 #undef __
4639 4639
4640 } } // namespace v8::internal 4640 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ia32/lithium-codegen-ia32.cc ('k') | src/x64/lithium-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698