• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// 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 --harmony-tostring
6
7function le(a, b) {
8  return a <= b;
9}
10
11function lt(a, b) {
12  return a < b;
13}
14
15function ge(a, b) {
16  return a >= b;
17}
18
19function gt(a, b) {
20  return a > b;
21}
22
23function test(a, b) {
24  // Check CompareIC for less than or equal of known objects.
25  assertThrows(function() {le(a, a)});
26  assertThrows(function() {le(a, b)});
27  assertThrows(function() {le(b, a)});
28  // Check CompareIC for less than of known objects.
29  assertThrows(function() {lt(a, a)});
30  assertThrows(function() {lt(a, b)});
31  assertThrows(function() {lt(b, a)});
32  // Check CompareIC for greater than or equal of known objects.
33  assertThrows(function() {ge(a, a)});
34  assertThrows(function() {ge(a, b)});
35  assertThrows(function() {ge(b, a)});
36  // Check CompareIC for greater than of known objects.
37  assertThrows(function() {gt(a, a)});
38  assertThrows(function() {gt(a, b)});
39  assertThrows(function() {gt(b, a)});
40}
41
42function O() { }
43Object.defineProperty(O.prototype, Symbol.toStringTag, {
44  get: function() { throw "@@toStringTag called!" }
45});
46
47var obj1 = new O;
48var obj2 = new O;
49
50assertTrue(%HaveSameMap(obj1, obj2));
51test(obj1, obj2);
52test(obj1, obj2);
53%OptimizeFunctionOnNextCall(le);
54%OptimizeFunctionOnNextCall(lt);
55%OptimizeFunctionOnNextCall(ge);
56%OptimizeFunctionOnNextCall(gt);
57test(obj1, obj2);
58