blob: 52cd370e427161d1bce33431647245c12300ad25 [file] [log] [blame]
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001// Copyright 2014 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
Emily Bernierd0a1eb72015-03-24 16:35:39 -04005// Flags: --allow-natives-syntax
Ben Murdochb8a8cc12014-11-26 15:28:44 +00006
7// Check the results of `left >>> right`. The result is always unsigned (and
8// therefore positive).
9function test_shr(left) {
10 var errors = 0;
11
12 for (var i = 1; i < 1024; i++) {
13 var temp = left >>> i;
14 if (temp < 0) {
15 errors++;
16 }
17 }
18
19 return errors;
20}
21
22assertEquals(0, test_shr(1));
23%OptimizeFunctionOnNextCall(test_shr);
24for (var i = 5; i >= -5; i--) {
25 assertEquals(0, test_shr(i));
26}