Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: test/mjsunit/compare-known-objects-tostringtag.js

Issue 1360723002: [crankshaft] Handle @@toStringTag accessor correctly for BuildCompareInstruction. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/hydrogen.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
7 function le(a, b) {
8 return a <= b;
9 }
10
11 function lt(a, b) {
12 return a < b;
13 }
14
15 function ge(a, b) {
16 return a >= b;
17 }
18
19 function gt(a, b) {
20 return a > b;
21 }
22
23 function 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
42 function O() { }
43 Object.defineProperty(O.prototype, Symbol.toStringTag, {
44 get: function() { throw "@@toStringTag called!" }
45 });
46
47 var obj1 = new O;
48 var obj2 = new O;
49
50 assertTrue(%HaveSameMap(obj1, obj2));
51 test(obj1, obj2);
52 test(obj1, obj2);
53 %OptimizeFunctionOnNextCall(le);
54 %OptimizeFunctionOnNextCall(lt);
55 %OptimizeFunctionOnNextCall(ge);
56 %OptimizeFunctionOnNextCall(gt);
57 test(obj1, obj2);
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698