Fixed constant folding for Math.clz32.

LOG=y
BUG=347906
R=yangguo@chromium.org

Review URL: https://codereview.chromium.org/184353002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19609 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent ba981e58
......@@ -3955,7 +3955,7 @@ HInstruction* HUnaryMathOperation::New(
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));
}
......
// 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();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment