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

Side by Side Diff: test/mjsunit/string-add.js

Issue 57052: * String type inference using compiler framework. (Closed)
Patch Set: Changes relative to head of bleeding edge (don't do diff with earlier versions) Created 11 years, 8 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/virtual-frame-ia32.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 2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are
4 // met:
5 //
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28 assertEquals("ab", "a" + "b", "ll");
29
30 assertEquals("12", "1" + "2", "dd");
31 assertEquals("123", "1" + "2" + "3", "ddd");
32 assertEquals("123", 1 + "2" + "3", "ndd");
33 assertEquals("123", "1" + 2 + "3", "dnd");
34 assertEquals("123", "1" + "2" + 3, "ddn");
35
36 assertEquals("123", "1" + 2 + 3, "dnn");
37 assertEquals("123", 1 + "2" + 3, "ndn");
38 assertEquals("33", 1 + 2 + "3", "nnd");
39
40 var x = "1";
41 assertEquals("12", x + 2, "vn");
42 assertEquals("12", x + "2", "vd");
43 assertEquals("21", 2 + x, "nv");
44 assertEquals("21", "2" + x, "dv");
45
46 var y = "2";
47 assertEquals("12", x + y, "vdvd");
48
49 x = 1;
50 assertEquals("12", x + y, "vnvd");
51
52 y = 2;
53 assertEquals(3, x + y, "vnvn");
54
55 x = "1";
56 assertEquals("12", x + y, "vdvn");
57
58 y = "2";
59 assertEquals("12", x + y, "vdvd2");
60
61 (function(x, y) {
62 var z = "3";
63 var w = "4";
64
65 assertEquals("11", x + x, "xx");
66 assertEquals("12", x + y, "xy");
67 assertEquals("13", x + z, "xz");
68 assertEquals("14", x + w, "xw");
69
70 assertEquals("21", y + x, "yx");
71 assertEquals("22", y + y, "yy");
72 assertEquals("23", y + z, "yz");
73 assertEquals("24", y + w, "yw");
74
75 assertEquals("31", z + x, "zx");
76 assertEquals("32", z + y, "zy");
77 assertEquals("33", z + z, "zz");
78 assertEquals("34", z + w, "zw");
79
80 assertEquals("41", w + x, "wx");
81 assertEquals("42", w + y, "wy");
82 assertEquals("43", w + z, "wz");
83 assertEquals("44", w + w, "ww");
84
85 (function(){x = 1; z = 3;})();
86
87 assertEquals(2, x + x, "x'x");
88 assertEquals("12", x + y, "x'y");
89 assertEquals(4, x + z, "x'z'");
90 assertEquals("14", x + w, "x'w");
91
92 assertEquals("21", y + x, "yx'");
93 assertEquals("22", y + y, "yy");
94 assertEquals("23", y + z, "yz'");
95 assertEquals("24", y + w, "yw");
96
97 assertEquals(4, z + x, "z'x'");
98 assertEquals("32", z + y, "z'y");
99 assertEquals(6, z + z, "z'z'");
100 assertEquals("34", z + w, "z'w");
101
102 assertEquals("41", w + x, "wx'");
103 assertEquals("42", w + y, "wy");
104 assertEquals("43", w + z, "wz'");
105 assertEquals("44", w + w, "ww");
106 })("1", "2");
107
108 assertEquals("142", "1" + new Number(42), "sN");
109 assertEquals("421", new Number(42) + "1", "Ns");
110 assertEquals(84, new Number(42) + new Number(42), "NN");
111
112 assertEquals("142", "1" + new String("42"), "sS");
113 assertEquals("421", new String("42") + "1", "Ss");
114 assertEquals("142", "1" + new String("42"), "sS");
115 assertEquals("4242", new String("42") + new String("42"), "SS");
116
117 assertEquals("1true", "1" + true, "sb");
118 assertEquals("true1", true + "1", "bs");
119 assertEquals(2, true + true, "bs");
120
121 assertEquals("1true", "1" + new Boolean(true), "sB");
122 assertEquals("true1", new Boolean(true) + "1", "Bs");
123 assertEquals(2, new Boolean(true) + new Boolean(true), "Bs");
124
125 assertEquals("1undefined", "1" + void 0, "sv");
126 assertEquals("undefined1", (void 0) + "1", "vs");
127 assertTrue(isNaN(void 0 + void 0), "vv");
128
129 assertEquals("1null", "1" + null, "su");
130 assertEquals("null1", null + "1", "us");
131 assertEquals(0, null + null, "uu");
132
133 (function (i) {
134 // Check that incoming frames are merged correctly.
135 var x;
136 var y;
137 var z;
138 var w;
139 switch (i) {
140 case 1: x = 42; y = "stry"; z = "strz"; w = 42; break;
141 default: x = "strx", y = 42; z = "strz"; w = 42; break;
142 }
143 var resxx = x + x;
144 var resxy = x + y;
145 var resxz = x + z;
146 var resxw = x + w;
147 var resyx = y + x;
148 var resyy = y + y;
149 var resyz = y + z;
150 var resyw = y + w;
151 var reszx = z + x;
152 var reszy = z + y;
153 var reszz = z + z;
154 var reszw = z + w;
155 var reswx = w + x;
156 var reswy = w + y;
157 var reswz = w + z;
158 var resww = w + w;
159 assertEquals(84, resxx, "swxx");
160 assertEquals("42stry", resxy, "swxy");
161 assertEquals("42strz", resxz, "swxz");
162 assertEquals(84, resxw, "swxw");
163 assertEquals("stry42", resyx, "swyx");
164 assertEquals("strystry", resyy, "swyy");
165 assertEquals("strystrz", resyz, "swyz");
166 assertEquals("stry42", resyw, "swyw");
167 assertEquals("strz42", reszx, "swzx");
168 assertEquals("strzstry", reszy, "swzy");
169 assertEquals("strzstrz", reszz, "swzz");
170 assertEquals("strz42", reszw, "swzw");
171 assertEquals(84, reswx, "swwx");
172 assertEquals("42stry", reswy, "swwy");
173 assertEquals("42strz", reswz, "swwz");
174 assertEquals(84, resww, "swww");
175 })(1);
OLDNEW
« no previous file with comments | « src/virtual-frame-ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698