blob: 3419722cd018d9c5757165a74b4109f0a7d97418 [file] [log] [blame]
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00001// Copyright 2015 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
5// Flags: --allow-natives-syntax
6
7// This is used to force binary operations below to have tagged representation.
8var z = {valueOf: function() { return 3; }};
9
10
11function f() {
12 var y = -2;
13 return (1 & z) - y++;
14}
15
16assertEquals(3, f());
17assertEquals(3, f());
18%OptimizeFunctionOnNextCall(f);
19assertEquals(3, f());
20
21
22function g() {
23 var y = 2;
24 return (1 & z) | y++;
25}
26
27assertEquals(3, g());
28assertEquals(3, g());
29%OptimizeFunctionOnNextCall(g);
30assertEquals(3, g());
31
32
33function h() {
34 var y = 3;
35 return (3 & z) & y++;
36}
37
38assertEquals(3, h());
39assertEquals(3, h());
40%OptimizeFunctionOnNextCall(h);
41assertEquals(3, h());
42
43
44function i() {
45 var y = 2;
46 return (1 & z) ^ y++;
47}
48
49assertEquals(3, i());
50assertEquals(3, i());
51%OptimizeFunctionOnNextCall(i);
52assertEquals(3, i());