Revision: 19609
Author:   [email protected]
Date:     Fri Feb 28 13:07:10 2014 UTC
Log:      Fixed constant folding for Math.clz32.

LOG=y
BUG=347906
[email protected]

Review URL: https://codereview.chromium.org/184353002
http://code.google.com/p/v8/source/detail?r=19609

Added:
 /branches/bleeding_edge/test/mjsunit/regress/regress-347906.js
Modified:
 /branches/bleeding_edge/src/hydrogen-instructions.cc

=======================================
--- /dev/null
+++ /branches/bleeding_edge/test/mjsunit/regress/regress-347906.js Fri Feb 28 13:07:10 2014 UTC
@@ -0,0 +1,14 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax --harmony
+
+function foo() {
+  return Math.clz32(12.34);
+}
+
+foo();
+foo();
+%OptimizeFunctionOnNextCall(foo);
+foo();
=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.cc Tue Feb 25 16:11:58 2014 UTC +++ /branches/bleeding_edge/src/hydrogen-instructions.cc Fri Feb 28 13:07:10 2014 UTC
@@ -3955,7 +3955,7 @@
       case kMathFloor:
         return H_CONSTANT_DOUBLE(std::floor(d));
       case kMathClz32: {
-        uint32_t i = static_cast<uint32_t>(constant->Integer32Value());
+        uint32_t i = DoubleToUint32(d);
         return H_CONSTANT_INT(
             (i == 0) ? 32 : CompilerIntrinsics::CountLeadingZeros(i));
       }

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to