v8/test/mjsunit/compiler/regress-shift-right.js
bmeurer 5f288c201c [turbofan] Right hand side of shifts needs ToUint32.
Currently we lower shifts directly to machine operators, and add an
appropriate Word32And to implement the & 0x1F operation on the right
hand side required by the specification. However for Word32And we assume
Int32 in simplified lowering, which is basically changes the right hand
side bit interpretation for the shifts from Uint32 to Int32, which is
obviously wrong. So now we represent that explicitly by proper
simplified operators for the shifts, which are lowered to machine in
simplified lowering.

R=jarin@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#29465}
2015-07-03 11:42:00 +00:00

42 lines
881 B
JavaScript

// Copyright 2015 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
(function ShiftRightWithDeoptUsage() {
function g() {}
function f() {
var tmp = 1264475713;
var tmp1 = tmp - (-913041544);
g();
return 1 >> tmp1;
}
%OptimizeFunctionOnNextCall(f);
assertEquals(0, f());
})();
(function ShiftRightWithCallUsage() {
var f = (function() {
"use asm"
// This is not a valid asm.js, we use the "use asm" here to
// trigger Turbofan without deoptimization support.
function g(x) { return x; }
function f() {
var tmp = 1264475713;
var tmp1 = tmp - (-913041544);
return g(1 >> tmp1, tmp1);
}
return f;
})();
%OptimizeFunctionOnNextCall(f);
assertEquals(0, f());
})();