Reviewers: danno,

Description:
Merge r10190 to 3.5 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/8834009/

SVN Base: http://v8.googlecode.com/svn/branches/3.5/

Affected files:
  M     src/arm/lithium-codegen-arm.cc
  M     src/ia32/lithium-codegen-ia32.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)
@@ -2991,11 +2991,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());
@@ -3006,7 +3006,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)
@@ -2769,12 +2769,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/version.cc
===================================================================
--- src/version.cc      (revision 10190)
+++ src/version.cc      (working copy)
@@ -35,7 +35,7 @@
 #define MAJOR_VERSION     3
 #define MINOR_VERSION     5
 #define BUILD_NUMBER      10
-#define PATCH_LEVEL       25
+#define PATCH_LEVEL       26
 // 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)
@@ -2772,10 +2772,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

Reply via email to