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
This commit is contained in:
parent
ba981e58d5
commit
e9273332ef
@ -3955,7 +3955,7 @@ HInstruction* HUnaryMathOperation::New(
|
|||||||
case kMathFloor:
|
case kMathFloor:
|
||||||
return H_CONSTANT_DOUBLE(std::floor(d));
|
return H_CONSTANT_DOUBLE(std::floor(d));
|
||||||
case kMathClz32: {
|
case kMathClz32: {
|
||||||
uint32_t i = static_cast<uint32_t>(constant->Integer32Value());
|
uint32_t i = DoubleToUint32(d);
|
||||||
return H_CONSTANT_INT(
|
return H_CONSTANT_INT(
|
||||||
(i == 0) ? 32 : CompilerIntrinsics::CountLeadingZeros(i));
|
(i == 0) ? 32 : CompilerIntrinsics::CountLeadingZeros(i));
|
||||||
}
|
}
|
||||||
|
14
test/mjsunit/regress/regress-347906.js
Normal file
14
test/mjsunit/regress/regress-347906.js
Normal file
@ -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();
|
Loading…
Reference in New Issue
Block a user