Reviewers: danno,
Description:
Merge r10190 to 3.7 branch: Fix a bug with register use in optimized
Math.round.
Original CL: http://codereview.chromium.org/8833007/
Please review this at http://codereview.chromium.org/8832005/
SVN Base: http://v8.googlecode.com/svn/branches/3.7/
Affected files:
M src/arm/lithium-codegen-arm.cc
M src/ia32/lithium-codegen-ia32.cc
M src/mips/lithium-codegen-mips.cc
M src/version.cc
M src/x64/lithium-codegen-x64.cc
A + test/mjsunit/compiler/regress-106351.js
### BEGIN SVN COPY METADATA
#$ cp branches/bleeding_edge/test/mjsunit/compiler/regress-106351.js
test/mjsunit/compiler/regress-106351.js
### END SVN COPY METADATA
Index: src/arm/lithium-codegen-arm.cc
===================================================================
--- src/arm/lithium-codegen-arm.cc (revision 10190)
+++ src/arm/lithium-codegen-arm.cc (working copy)
@@ -3053,11 +3053,11 @@
__ and_(scratch, result, Operand(HeapNumber::kSignMask));
__ Vmov(double_scratch0(), 0.5);
- __ vadd(input, input, double_scratch0());
+ __ vadd(double_scratch0(), input, double_scratch0());
// Check sign of the result: if the sign changed, the input
// value was in ]0.5, 0[ and the result should be -0.
- __ vmov(result, input.high());
+ __ vmov(result, double_scratch0().high());
__ eor(result, result, Operand(scratch), SetCC);
if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
DeoptimizeIf(mi, instr->environment());
@@ -3068,7 +3068,7 @@
__ EmitVFPTruncate(kRoundToMinusInf,
double_scratch0().low(),
- input,
+ double_scratch0(),
result,
scratch);
DeoptimizeIf(ne, instr->environment());
Index: src/ia32/lithium-codegen-ia32.cc
===================================================================
--- src/ia32/lithium-codegen-ia32.cc (revision 10190)
+++ src/ia32/lithium-codegen-ia32.cc (working copy)
@@ -2893,12 +2893,12 @@
__ movdbl(xmm_scratch, Operand::StaticVariable(one_half));
__ ucomisd(xmm_scratch, input_reg);
__ j(above, &below_half);
- // input = input + 0.5
- __ addsd(input_reg, xmm_scratch);
+ // xmm_scratch = input + 0.5
+ __ addsd(xmm_scratch, input_reg);
// Compute Math.floor(value + 0.5).
// Use truncating instruction (OK because input is positive).
- __ cvttsd2si(output_reg, Operand(input_reg));
+ __ cvttsd2si(output_reg, Operand(xmm_scratch));
// Overflow is signalled with minint.
__ cmp(output_reg, 0x80000000u);
Index: src/mips/lithium-codegen-mips.cc
===================================================================
--- src/mips/lithium-codegen-mips.cc (revision 10190)
+++ src/mips/lithium-codegen-mips.cc (working copy)
@@ -2942,11 +2942,11 @@
__ And(scratch, result, Operand(HeapNumber::kSignMask));
__ Move(double_scratch0(), 0.5);
- __ add_d(input, input, double_scratch0());
+ __ add_d(double_scratch0(), input, double_scratch0());
// Check sign of the result: if the sign changed, the input
// value was in ]0.5, 0[ and the result should be -0.
- __ mfc1(result, input.high());
+ __ mfc1(result, double_scratch0().high());
__ Xor(result, result, Operand(scratch));
if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
// ARM uses 'mi' here, which is 'lt'
@@ -2966,7 +2966,7 @@
__ EmitFPUTruncate(kRoundToMinusInf,
double_scratch0().low(),
- input,
+ double_scratch0(),
result,
except_flag);
Index: src/version.cc
===================================================================
--- src/version.cc (revision 10190)
+++ src/version.cc (working copy)
@@ -35,7 +35,7 @@
#define MAJOR_VERSION 3
#define MINOR_VERSION 7
#define BUILD_NUMBER 12
-#define PATCH_LEVEL 6
+#define PATCH_LEVEL 7
// Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.)
#define IS_CANDIDATE_VERSION 0
Index: src/x64/lithium-codegen-x64.cc
===================================================================
--- src/x64/lithium-codegen-x64.cc (revision 10190)
+++ src/x64/lithium-codegen-x64.cc (working copy)
@@ -2811,10 +2811,10 @@
// This addition might give a result that isn't the correct for
// rounding, due to loss of precision, but only for a number that's
// so big that the conversion below will overflow anyway.
- __ addsd(input_reg, xmm_scratch);
+ __ addsd(xmm_scratch, input_reg);
// Compute Math.floor(input).
// Use truncating instruction (OK because input is positive).
- __ cvttsd2si(output_reg, input_reg);
+ __ cvttsd2si(output_reg, xmm_scratch);
// Overflow is signalled with minint.
__ cmpl(output_reg, Immediate(0x80000000));
DeoptimizeIf(equal, instr->environment());
Index: test/mjsunit/compiler/regress-106351.js
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev