deopt-numberoroddball-binop.js 3.36 KB
Newer Older
1 2 3 4
// Copyright 2016 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.

5
// Flags: --allow-natives-syntax --opt
6 7 8 9

(function() {
  function foo(x, y) { return x << y; }

10
  %PrepareFunctionForOptimization(foo);
11 12
  foo(1.1, 0.1);
  foo(0.1, 1.1);
13
  foo(true, false);
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
  %OptimizeFunctionOnNextCall(foo);
  foo(undefined, 1.1);
  assertOptimized(foo);
  foo(1.1, undefined);
  assertOptimized(foo);
  foo(null, 1.1);
  assertOptimized(foo);
  foo(1.1, null);
  assertOptimized(foo);
  foo(true, 1.1);
  assertOptimized(foo);
  foo(1.1, true);
  assertOptimized(foo);
  foo(false, 1.1);
  assertOptimized(foo);
  foo(1.1, false);
  assertOptimized(foo);
})();

(function() {
  function foo(x, y) { return x >> y; }

36
  %PrepareFunctionForOptimization(foo);
37 38
  foo(1.1, 0.1);
  foo(0.1, 1.1);
39
  foo(true, false);
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
  %OptimizeFunctionOnNextCall(foo);
  foo(undefined, 1.1);
  assertOptimized(foo);
  foo(1.1, undefined);
  assertOptimized(foo);
  foo(null, 1.1);
  assertOptimized(foo);
  foo(1.1, null);
  assertOptimized(foo);
  foo(true, 1.1);
  assertOptimized(foo);
  foo(1.1, true);
  assertOptimized(foo);
  foo(false, 1.1);
  assertOptimized(foo);
  foo(1.1, false);
  assertOptimized(foo);
})();

(function() {
  function foo(x, y) { return x >>> y; }

62
  %PrepareFunctionForOptimization(foo);
63 64
  foo(1.1, 0.1);
  foo(0.1, 1.1);
65
  foo(true, false);
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
  %OptimizeFunctionOnNextCall(foo);
  foo(undefined, 1.1);
  assertOptimized(foo);
  foo(1.1, undefined);
  assertOptimized(foo);
  foo(null, 1.1);
  assertOptimized(foo);
  foo(1.1, null);
  assertOptimized(foo);
  foo(true, 1.1);
  assertOptimized(foo);
  foo(1.1, true);
  assertOptimized(foo);
  foo(false, 1.1);
  assertOptimized(foo);
  foo(1.1, false);
  assertOptimized(foo);
})();

(function() {
  function foo(x, y) { return x ^ y; }

88
  %PrepareFunctionForOptimization(foo);
89 90
  foo(1.1, 0.1);
  foo(0.1, 1.1);
91
  foo(true, false);
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
  %OptimizeFunctionOnNextCall(foo);
  foo(undefined, 1.1);
  assertOptimized(foo);
  foo(1.1, undefined);
  assertOptimized(foo);
  foo(null, 1.1);
  assertOptimized(foo);
  foo(1.1, null);
  assertOptimized(foo);
  foo(true, 1.1);
  assertOptimized(foo);
  foo(1.1, true);
  assertOptimized(foo);
  foo(false, 1.1);
  assertOptimized(foo);
  foo(1.1, false);
  assertOptimized(foo);
})();

(function() {
  function foo(x, y) { return x | y; }

114
  %PrepareFunctionForOptimization(foo);
115 116
  foo(1.1, 0.1);
  foo(0.1, 1.1);
117
  foo(true, false);
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
  %OptimizeFunctionOnNextCall(foo);
  foo(undefined, 1.1);
  assertOptimized(foo);
  foo(1.1, undefined);
  assertOptimized(foo);
  foo(null, 1.1);
  assertOptimized(foo);
  foo(1.1, null);
  assertOptimized(foo);
  foo(true, 1.1);
  assertOptimized(foo);
  foo(1.1, true);
  assertOptimized(foo);
  foo(false, 1.1);
  assertOptimized(foo);
  foo(1.1, false);
  assertOptimized(foo);
})();

(function() {
  function foo(x, y) { return x & y; }

140
  %PrepareFunctionForOptimization(foo);
141 142
  foo(1.1, 0.1);
  foo(0.1, 1.1);
143
  foo(true, false);
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161
  %OptimizeFunctionOnNextCall(foo);
  foo(undefined, 1.1);
  assertOptimized(foo);
  foo(1.1, undefined);
  assertOptimized(foo);
  foo(null, 1.1);
  assertOptimized(foo);
  foo(1.1, null);
  assertOptimized(foo);
  foo(true, 1.1);
  assertOptimized(foo);
  foo(1.1, true);
  assertOptimized(foo);
  foo(false, 1.1);
  assertOptimized(foo);
  foo(1.1, false);
  assertOptimized(foo);
})();