OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // TODO(jochen): Remove this after the setting is turned on globally. | 5 // TODO(jochen): Remove this after the setting is turned on globally. |
6 #define V8_IMMINENT_DEPRECATION_WARNINGS | 6 #define V8_IMMINENT_DEPRECATION_WARNINGS |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/ast.h" | 10 #include "src/ast.h" |
11 #include "src/ast-expression-visitor.h" | 11 #include "src/ast-expression-visitor.h" |
12 #include "src/parser.h" | 12 #include "src/parser.h" |
13 #include "src/rewriter.h" | 13 #include "src/rewriter.h" |
14 #include "src/scopes.h" | 14 #include "src/scopes.h" |
15 #include "src/type-cache.h" | 15 #include "src/type-cache.h" |
16 #include "src/typing-asm.h" | 16 #include "src/typing-asm.h" |
17 #include "test/cctest/cctest.h" | 17 #include "test/cctest/cctest.h" |
18 #include "test/cctest/expression-type-collector.h" | 18 #include "test/cctest/expression-type-collector.h" |
19 #include "test/cctest/expression-type-collector-macros.h" | 19 #include "test/cctest/expression-type-collector-macros.h" |
20 | 20 |
21 // Macros for function types. | 21 // Macros for function types. |
22 #define FUNC_V_TYPE Bounds(Type::Function(Type::Undefined(), zone)) | 22 #define FUNC_V_TYPE Bounds(Type::Function(Type::Undefined(), zone)) |
23 #define FUNC_I_TYPE Bounds(Type::Function(cache.kInt32, zone)) | 23 #define FUNC_I_TYPE Bounds(Type::Function(cache.kAsmSigned, zone)) |
24 #define FUNC_F_TYPE Bounds(Type::Function(cache.kFloat32, zone)) | 24 #define FUNC_F_TYPE Bounds(Type::Function(cache.kAsmFloat, zone)) |
25 #define FUNC_D_TYPE Bounds(Type::Function(cache.kFloat64, zone)) | 25 #define FUNC_D_TYPE Bounds(Type::Function(cache.kAsmDouble, zone)) |
26 #define FUNC_D2D_TYPE \ | 26 #define FUNC_D2D_TYPE \ |
27 Bounds(Type::Function(cache.kFloat64, cache.kFloat64, zone)) | 27 Bounds(Type::Function(cache.kAsmDouble, cache.kAsmDouble, zone)) |
28 #define FUNC_N2F_TYPE \ | 28 #define FUNC_N2F_TYPE \ |
29 Bounds(Type::Function(cache.kFloat32, Type::Number(), zone)) | 29 Bounds(Type::Function(cache.kAsmFloat, Type::Number(), zone)) |
30 #define FUNC_I2I_TYPE Bounds(Type::Function(cache.kInt32, cache.kInt32, zone)) | 30 #define FUNC_I2I_TYPE \ |
| 31 Bounds(Type::Function(cache.kAsmSigned, cache.kAsmInt, zone)) |
31 #define FUNC_II2D_TYPE \ | 32 #define FUNC_II2D_TYPE \ |
32 Bounds(Type::Function(cache.kFloat64, cache.kInt32, cache.kInt32, zone)) | 33 Bounds(Type::Function(cache.kAsmDouble, cache.kAsmInt, cache.kAsmInt, zone)) |
33 #define FUNC_II2I_TYPE \ | 34 #define FUNC_II2I_TYPE \ |
34 Bounds(Type::Function(cache.kInt32, cache.kInt32, cache.kInt32, zone)) | 35 Bounds(Type::Function(cache.kAsmSigned, cache.kAsmInt, cache.kAsmInt, zone)) |
35 #define FUNC_DD2D_TYPE \ | 36 #define FUNC_DD2D_TYPE \ |
36 Bounds(Type::Function(cache.kFloat64, cache.kFloat64, cache.kFloat64, zone)) | 37 Bounds(Type::Function(cache.kAsmDouble, cache.kAsmDouble, cache.kAsmDouble, \ |
| 38 zone)) |
37 #define FUNC_N2N_TYPE \ | 39 #define FUNC_N2N_TYPE \ |
38 Bounds(Type::Function(Type::Number(), Type::Number(), zone)) | 40 Bounds(Type::Function(Type::Number(), Type::Number(), zone)) |
39 | 41 |
40 // Macros for array types. | 42 // Macros for array types. |
41 #define FLOAT64_ARRAY_TYPE Bounds(Type::Array(cache.kFloat64, zone)) | 43 #define FLOAT64_ARRAY_TYPE Bounds(Type::Array(cache.kAsmDouble, zone)) |
42 #define FUNC_I2I_ARRAY_TYPE \ | 44 #define FUNC_I2I_ARRAY_TYPE \ |
43 Bounds(Type::Array(Type::Function(cache.kInt32, cache.kInt32, zone), zone)) | 45 Bounds(Type::Array(Type::Function(cache.kAsmSigned, cache.kAsmInt, zone), \ |
| 46 zone)) |
44 | 47 |
45 using namespace v8::internal; | 48 using namespace v8::internal; |
46 | 49 |
47 namespace { | 50 namespace { |
48 | 51 |
49 std::string Validate(Zone* zone, const char* source, | 52 std::string Validate(Zone* zone, const char* source, |
50 ZoneVector<ExpressionTypeEntry>* types) { | 53 ZoneVector<ExpressionTypeEntry>* types) { |
51 i::Isolate* isolate = CcTest::i_isolate(); | 54 i::Isolate* isolate = CcTest::i_isolate(); |
52 i::Factory* factory = isolate->factory(); | 55 i::Factory* factory = isolate->factory(); |
53 | 56 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 Zone* zone = handles.main_zone(); | 122 Zone* zone = handles.main_zone(); |
120 ZoneVector<ExpressionTypeEntry> types(zone); | 123 ZoneVector<ExpressionTypeEntry> types(zone); |
121 CHECK_EQ("", Validate(zone, test_function, &types)); | 124 CHECK_EQ("", Validate(zone, test_function, &types)); |
122 TypeCache cache; | 125 TypeCache cache; |
123 | 126 |
124 CHECK_TYPES_BEGIN { | 127 CHECK_TYPES_BEGIN { |
125 // Module. | 128 // Module. |
126 CHECK_EXPR(FunctionLiteral, Bounds::Unbounded()) { | 129 CHECK_EXPR(FunctionLiteral, Bounds::Unbounded()) { |
127 // function logSum | 130 // function logSum |
128 CHECK_EXPR(FunctionLiteral, FUNC_II2D_TYPE) { | 131 CHECK_EXPR(FunctionLiteral, FUNC_II2D_TYPE) { |
129 CHECK_EXPR(Assignment, Bounds(cache.kInt32)) { | 132 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { |
130 CHECK_VAR(start, Bounds(cache.kInt32)); | 133 CHECK_VAR(start, Bounds(cache.kAsmInt)); |
131 CHECK_EXPR(BinaryOperation, Bounds(cache.kInt32)) { | 134 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { |
132 CHECK_VAR(start, Bounds(cache.kInt32)); | 135 CHECK_VAR(start, Bounds(cache.kAsmInt)); |
133 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 136 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
134 } | 137 } |
135 } | 138 } |
136 CHECK_EXPR(Assignment, Bounds(cache.kInt32)) { | 139 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { |
137 CHECK_VAR(end, Bounds(cache.kInt32)); | 140 CHECK_VAR(end, Bounds(cache.kAsmInt)); |
138 CHECK_EXPR(BinaryOperation, Bounds(cache.kInt32)) { | 141 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { |
139 CHECK_VAR(end, Bounds(cache.kInt32)); | 142 CHECK_VAR(end, Bounds(cache.kAsmInt)); |
140 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 143 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
141 } | 144 } |
142 } | 145 } |
143 CHECK_EXPR(Assignment, Bounds(cache.kFloat64)) { | 146 CHECK_EXPR(Assignment, Bounds(cache.kAsmDouble)) { |
144 CHECK_VAR(sum, Bounds(cache.kFloat64)); | 147 CHECK_VAR(sum, Bounds(cache.kAsmDouble)); |
145 CHECK_EXPR(Literal, Bounds(cache.kFloat64)); | 148 CHECK_EXPR(Literal, Bounds(cache.kAsmDouble)); |
146 } | 149 } |
147 CHECK_EXPR(Assignment, Bounds(cache.kInt32)) { | 150 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { |
148 CHECK_VAR(p, Bounds(cache.kInt32)); | 151 CHECK_VAR(p, Bounds(cache.kAsmInt)); |
149 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 152 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
150 } | 153 } |
151 CHECK_EXPR(Assignment, Bounds(cache.kInt32)) { | 154 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { |
152 CHECK_VAR(q, Bounds(cache.kInt32)); | 155 CHECK_VAR(q, Bounds(cache.kAsmInt)); |
153 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 156 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
154 } | 157 } |
155 // for (p = start << 3, q = end << 3; | 158 // for (p = start << 3, q = end << 3; |
156 CHECK_EXPR(BinaryOperation, Bounds(cache.kInt32)) { | 159 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmInt)) { |
157 CHECK_EXPR(Assignment, Bounds(cache.kInt32)) { | 160 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { |
158 CHECK_VAR(p, Bounds(cache.kInt32)); | 161 CHECK_VAR(p, Bounds(cache.kAsmInt)); |
159 CHECK_EXPR(BinaryOperation, Bounds(cache.kInt32)) { | 162 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { |
160 CHECK_VAR(start, Bounds(cache.kInt32)); | 163 CHECK_VAR(start, Bounds(cache.kAsmInt)); |
161 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 164 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
162 } | 165 } |
163 } | 166 } |
164 CHECK_EXPR(Assignment, Bounds(cache.kInt32)) { | 167 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { |
165 CHECK_VAR(q, Bounds(cache.kInt32)); | 168 CHECK_VAR(q, Bounds(cache.kAsmInt)); |
166 CHECK_EXPR(BinaryOperation, Bounds(cache.kInt32)) { | 169 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { |
167 CHECK_VAR(end, Bounds(cache.kInt32)); | 170 CHECK_VAR(end, Bounds(cache.kAsmInt)); |
168 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 171 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
169 } | 172 } |
170 } | 173 } |
171 } | 174 } |
172 // (p|0) < (q|0); | 175 // (p|0) < (q|0); |
173 CHECK_EXPR(CompareOperation, Bounds(cache.kInt32)) { | 176 CHECK_EXPR(CompareOperation, Bounds(cache.kAsmSigned)) { |
174 CHECK_EXPR(BinaryOperation, Bounds(cache.kInt32)) { | 177 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { |
175 CHECK_VAR(p, Bounds(cache.kInt32)); | 178 CHECK_VAR(p, Bounds(cache.kAsmInt)); |
176 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 179 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
177 } | 180 } |
178 CHECK_EXPR(BinaryOperation, Bounds(cache.kInt32)) { | 181 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { |
179 CHECK_VAR(q, Bounds(cache.kInt32)); | 182 CHECK_VAR(q, Bounds(cache.kAsmInt)); |
180 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 183 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
181 } | 184 } |
182 } | 185 } |
183 // p = (p + 8)|0) {\n" | 186 // p = (p + 8)|0) {\n" |
184 CHECK_EXPR(Assignment, Bounds(cache.kInt32)) { | 187 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { |
185 CHECK_VAR(p, Bounds(cache.kInt32)); | 188 CHECK_VAR(p, Bounds(cache.kAsmInt)); |
186 CHECK_EXPR(BinaryOperation, Bounds(cache.kInt32)) { | 189 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { |
187 CHECK_EXPR(BinaryOperation, Bounds(cache.kInt32)) { | 190 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmInt)) { |
188 CHECK_VAR(p, Bounds(cache.kInt32)); | 191 CHECK_VAR(p, Bounds(cache.kAsmInt)); |
189 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 192 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
190 } | 193 } |
191 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 194 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
192 } | 195 } |
193 } | 196 } |
194 // sum = sum + +log(values[p>>3]); | 197 // sum = sum + +log(values[p>>3]); |
195 CHECK_EXPR(Assignment, Bounds(cache.kFloat64)) { | 198 CHECK_EXPR(Assignment, Bounds(cache.kAsmDouble)) { |
196 CHECK_VAR(sum, Bounds(cache.kFloat64)); | 199 CHECK_VAR(sum, Bounds(cache.kAsmDouble)); |
197 CHECK_EXPR(BinaryOperation, Bounds(cache.kFloat64)) { | 200 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmDouble)) { |
198 CHECK_VAR(sum, Bounds(cache.kFloat64)); | 201 CHECK_VAR(sum, Bounds(cache.kAsmDouble)); |
199 CHECK_EXPR(BinaryOperation, Bounds(cache.kFloat64)) { | 202 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmDouble)) { |
200 CHECK_EXPR(Call, Bounds(cache.kFloat64)) { | 203 CHECK_EXPR(Call, Bounds(cache.kAsmDouble)) { |
201 CHECK_VAR(log, FUNC_D2D_TYPE); | 204 CHECK_VAR(log, FUNC_D2D_TYPE); |
202 CHECK_EXPR(Property, Bounds(cache.kFloat64)) { | 205 CHECK_EXPR(Property, Bounds(cache.kAsmDouble)) { |
203 CHECK_VAR(values, FLOAT64_ARRAY_TYPE); | 206 CHECK_VAR(values, FLOAT64_ARRAY_TYPE); |
204 CHECK_EXPR(BinaryOperation, Bounds(cache.kInt32)) { | 207 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { |
205 CHECK_VAR(p, Bounds(cache.kInt32)); | 208 CHECK_VAR(p, Bounds(cache.kAsmSigned)); |
206 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 209 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
207 } | 210 } |
208 } | 211 } |
209 } | 212 } |
210 CHECK_EXPR(Literal, Bounds(cache.kFloat64)); | 213 CHECK_EXPR(Literal, Bounds(cache.kAsmDouble)); |
211 } | 214 } |
212 } | 215 } |
213 } | 216 } |
214 // return +sum; | 217 // return +sum; |
215 CHECK_EXPR(BinaryOperation, Bounds(cache.kFloat64)) { | 218 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmDouble)) { |
216 CHECK_VAR(sum, Bounds(cache.kFloat64)); | 219 CHECK_VAR(sum, Bounds(cache.kAsmDouble)); |
217 CHECK_EXPR(Literal, Bounds(cache.kFloat64)); | 220 CHECK_EXPR(Literal, Bounds(cache.kAsmDouble)); |
218 } | 221 } |
219 } | 222 } |
220 // function geometricMean | 223 // function geometricMean |
221 CHECK_EXPR(FunctionLiteral, FUNC_II2D_TYPE) { | 224 CHECK_EXPR(FunctionLiteral, FUNC_II2D_TYPE) { |
222 CHECK_EXPR(Assignment, Bounds(cache.kInt32)) { | 225 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { |
223 CHECK_VAR(start, Bounds(cache.kInt32)); | 226 CHECK_VAR(start, Bounds(cache.kAsmInt)); |
224 CHECK_EXPR(BinaryOperation, Bounds(cache.kInt32)) { | 227 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { |
225 CHECK_VAR(start, Bounds(cache.kInt32)); | 228 CHECK_VAR(start, Bounds(cache.kAsmInt)); |
226 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 229 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
227 } | 230 } |
228 } | 231 } |
229 CHECK_EXPR(Assignment, Bounds(cache.kInt32)) { | 232 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { |
230 CHECK_VAR(end, Bounds(cache.kInt32)); | 233 CHECK_VAR(end, Bounds(cache.kAsmInt)); |
231 CHECK_EXPR(BinaryOperation, Bounds(cache.kInt32)) { | 234 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { |
232 CHECK_VAR(end, Bounds(cache.kInt32)); | 235 CHECK_VAR(end, Bounds(cache.kAsmInt)); |
233 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 236 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
234 } | 237 } |
235 } | 238 } |
236 // return +exp(+logSum(start, end) / +((end - start)|0)); | 239 // return +exp(+logSum(start, end) / +((end - start)|0)); |
237 CHECK_EXPR(BinaryOperation, Bounds(cache.kFloat64)) { | 240 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmDouble)) { |
238 CHECK_EXPR(Call, Bounds(cache.kFloat64)) { | 241 CHECK_EXPR(Call, Bounds(cache.kAsmDouble)) { |
239 CHECK_VAR(exp, FUNC_D2D_TYPE); | 242 CHECK_VAR(exp, FUNC_D2D_TYPE); |
240 CHECK_EXPR(BinaryOperation, Bounds(cache.kFloat64)) { | 243 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmDouble)) { |
241 CHECK_EXPR(BinaryOperation, Bounds(cache.kFloat64)) { | 244 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmDouble)) { |
242 CHECK_EXPR(Call, Bounds(cache.kFloat64)) { | 245 CHECK_EXPR(Call, Bounds(cache.kAsmDouble)) { |
243 CHECK_VAR(logSum, FUNC_II2D_TYPE); | 246 CHECK_VAR(logSum, FUNC_II2D_TYPE); |
244 CHECK_VAR(start, Bounds(cache.kInt32)); | 247 CHECK_VAR(start, Bounds(cache.kAsmInt)); |
245 CHECK_VAR(end, Bounds(cache.kInt32)); | 248 CHECK_VAR(end, Bounds(cache.kAsmInt)); |
246 } | 249 } |
247 CHECK_EXPR(Literal, Bounds(cache.kFloat64)); | 250 CHECK_EXPR(Literal, Bounds(cache.kAsmDouble)); |
248 } | 251 } |
249 CHECK_EXPR(BinaryOperation, Bounds(cache.kFloat64)) { | 252 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmDouble)) { |
250 CHECK_EXPR(BinaryOperation, Bounds(cache.kInt32)) { | 253 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { |
251 CHECK_EXPR(BinaryOperation, Bounds(cache.kInt32)) { | 254 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmInt)) { |
252 CHECK_VAR(end, Bounds(cache.kInt32)); | 255 CHECK_VAR(end, Bounds(cache.kAsmInt)); |
253 CHECK_VAR(start, Bounds(cache.kInt32)); | 256 CHECK_VAR(start, Bounds(cache.kAsmInt)); |
254 } | 257 } |
255 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 258 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
256 } | 259 } |
257 CHECK_EXPR(Literal, Bounds(cache.kFloat64)); | 260 CHECK_EXPR(Literal, Bounds(cache.kAsmDouble)); |
258 } | 261 } |
259 } | 262 } |
260 } | 263 } |
261 CHECK_EXPR(Literal, Bounds(cache.kFloat64)); | 264 CHECK_EXPR(Literal, Bounds(cache.kAsmDouble)); |
262 } | 265 } |
263 } | 266 } |
264 // "use asm"; | 267 // "use asm"; |
265 CHECK_EXPR(Literal, Bounds(Type::String())); | 268 CHECK_EXPR(Literal, Bounds(Type::String())); |
266 // var exp = stdlib.Math.exp; | 269 // var exp = stdlib.Math.exp; |
267 CHECK_EXPR(Assignment, FUNC_D2D_TYPE) { | 270 CHECK_EXPR(Assignment, FUNC_D2D_TYPE) { |
268 CHECK_VAR(exp, FUNC_D2D_TYPE); | 271 CHECK_VAR(exp, FUNC_D2D_TYPE); |
269 CHECK_EXPR(Property, FUNC_D2D_TYPE) { | 272 CHECK_EXPR(Property, FUNC_D2D_TYPE) { |
270 CHECK_EXPR(Property, Bounds::Unbounded()) { | 273 CHECK_EXPR(Property, Bounds::Unbounded()) { |
271 CHECK_VAR(stdlib, Bounds::Unbounded()); | 274 CHECK_VAR(stdlib, Bounds::Unbounded()); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 CHECK_VAR(buffer, Bounds::Unbounded()); \ | 396 CHECK_VAR(buffer, Bounds::Unbounded()); \ |
394 } \ | 397 } \ |
395 } | 398 } |
396 | 399 |
397 | 400 |
398 namespace { | 401 namespace { |
399 | 402 |
400 void CheckStdlibShortcuts(Zone* zone, ZoneVector<ExpressionTypeEntry>& types, | 403 void CheckStdlibShortcuts(Zone* zone, ZoneVector<ExpressionTypeEntry>& types, |
401 size_t& index, int& depth, TypeCache& cache) { | 404 size_t& index, int& depth, TypeCache& cache) { |
402 // var exp = stdlib.*; (D * 12) | 405 // var exp = stdlib.*; (D * 12) |
403 CHECK_VAR_SHORTCUT(Infinity, Bounds(cache.kFloat64)); | 406 CHECK_VAR_SHORTCUT(Infinity, Bounds(cache.kAsmDouble)); |
404 CHECK_VAR_SHORTCUT(NaN, Bounds(cache.kFloat64)); | 407 CHECK_VAR_SHORTCUT(NaN, Bounds(cache.kAsmDouble)); |
405 // var x = stdlib.Math.x; D2D | 408 // var x = stdlib.Math.x; D2D |
406 CHECK_VAR_MATH_SHORTCUT(acos, FUNC_D2D_TYPE); | 409 CHECK_VAR_MATH_SHORTCUT(acos, FUNC_D2D_TYPE); |
407 CHECK_VAR_MATH_SHORTCUT(asin, FUNC_D2D_TYPE); | 410 CHECK_VAR_MATH_SHORTCUT(asin, FUNC_D2D_TYPE); |
408 CHECK_VAR_MATH_SHORTCUT(atan, FUNC_D2D_TYPE); | 411 CHECK_VAR_MATH_SHORTCUT(atan, FUNC_D2D_TYPE); |
409 CHECK_VAR_MATH_SHORTCUT(cos, FUNC_D2D_TYPE); | 412 CHECK_VAR_MATH_SHORTCUT(cos, FUNC_D2D_TYPE); |
410 CHECK_VAR_MATH_SHORTCUT(sin, FUNC_D2D_TYPE); | 413 CHECK_VAR_MATH_SHORTCUT(sin, FUNC_D2D_TYPE); |
411 CHECK_VAR_MATH_SHORTCUT(tan, FUNC_D2D_TYPE); | 414 CHECK_VAR_MATH_SHORTCUT(tan, FUNC_D2D_TYPE); |
412 CHECK_VAR_MATH_SHORTCUT(exp, FUNC_D2D_TYPE); | 415 CHECK_VAR_MATH_SHORTCUT(exp, FUNC_D2D_TYPE); |
413 CHECK_VAR_MATH_SHORTCUT(log, FUNC_D2D_TYPE); | 416 CHECK_VAR_MATH_SHORTCUT(log, FUNC_D2D_TYPE); |
414 CHECK_VAR_MATH_SHORTCUT(ceil, FUNC_D2D_TYPE); | 417 CHECK_VAR_MATH_SHORTCUT(ceil, FUNC_D2D_TYPE); |
415 CHECK_VAR_MATH_SHORTCUT(floor, FUNC_D2D_TYPE); | 418 CHECK_VAR_MATH_SHORTCUT(floor, FUNC_D2D_TYPE); |
416 CHECK_VAR_MATH_SHORTCUT(sqrt, FUNC_D2D_TYPE); | 419 CHECK_VAR_MATH_SHORTCUT(sqrt, FUNC_D2D_TYPE); |
417 // var exp = stdlib.Math.*; (DD2D * 12) | 420 // var exp = stdlib.Math.*; (DD2D * 12) |
418 CHECK_VAR_MATH_SHORTCUT(min, FUNC_DD2D_TYPE); | 421 CHECK_VAR_MATH_SHORTCUT(min, FUNC_DD2D_TYPE); |
419 CHECK_VAR_MATH_SHORTCUT(max, FUNC_DD2D_TYPE); | 422 CHECK_VAR_MATH_SHORTCUT(max, FUNC_DD2D_TYPE); |
420 CHECK_VAR_MATH_SHORTCUT(atan2, FUNC_DD2D_TYPE); | 423 CHECK_VAR_MATH_SHORTCUT(atan2, FUNC_DD2D_TYPE); |
421 CHECK_VAR_MATH_SHORTCUT(pow, FUNC_DD2D_TYPE); | 424 CHECK_VAR_MATH_SHORTCUT(pow, FUNC_DD2D_TYPE); |
422 // Special ones. | 425 // Special ones. |
423 CHECK_VAR_MATH_SHORTCUT(abs, FUNC_N2N_TYPE); | 426 CHECK_VAR_MATH_SHORTCUT(abs, FUNC_N2N_TYPE); |
424 CHECK_VAR_MATH_SHORTCUT(imul, FUNC_II2I_TYPE); | 427 CHECK_VAR_MATH_SHORTCUT(imul, FUNC_II2I_TYPE); |
425 CHECK_VAR_MATH_SHORTCUT(fround, FUNC_N2F_TYPE); | 428 CHECK_VAR_MATH_SHORTCUT(fround, FUNC_N2F_TYPE); |
426 // var exp = stdlib.Math.*; (D * 12) | 429 // var exp = stdlib.Math.*; (D * 12) |
427 CHECK_VAR_MATH_SHORTCUT(E, Bounds(cache.kFloat64)); | 430 CHECK_VAR_MATH_SHORTCUT(E, Bounds(cache.kAsmDouble)); |
428 CHECK_VAR_MATH_SHORTCUT(LN10, Bounds(cache.kFloat64)); | 431 CHECK_VAR_MATH_SHORTCUT(LN10, Bounds(cache.kAsmDouble)); |
429 CHECK_VAR_MATH_SHORTCUT(LN2, Bounds(cache.kFloat64)); | 432 CHECK_VAR_MATH_SHORTCUT(LN2, Bounds(cache.kAsmDouble)); |
430 CHECK_VAR_MATH_SHORTCUT(LOG2E, Bounds(cache.kFloat64)); | 433 CHECK_VAR_MATH_SHORTCUT(LOG2E, Bounds(cache.kAsmDouble)); |
431 CHECK_VAR_MATH_SHORTCUT(LOG10E, Bounds(cache.kFloat64)); | 434 CHECK_VAR_MATH_SHORTCUT(LOG10E, Bounds(cache.kAsmDouble)); |
432 CHECK_VAR_MATH_SHORTCUT(PI, Bounds(cache.kFloat64)); | 435 CHECK_VAR_MATH_SHORTCUT(PI, Bounds(cache.kAsmDouble)); |
433 CHECK_VAR_MATH_SHORTCUT(SQRT1_2, Bounds(cache.kFloat64)); | 436 CHECK_VAR_MATH_SHORTCUT(SQRT1_2, Bounds(cache.kAsmDouble)); |
434 CHECK_VAR_MATH_SHORTCUT(SQRT2, Bounds(cache.kFloat64)); | 437 CHECK_VAR_MATH_SHORTCUT(SQRT2, Bounds(cache.kAsmDouble)); |
435 // var values = new stdlib.*Array(buffer); | 438 // var values = new stdlib.*Array(buffer); |
436 CHECK_VAR_NEW_SHORTCUT(u8, Bounds(cache.kUint8Array)); | 439 CHECK_VAR_NEW_SHORTCUT(u8, Bounds(cache.kUint8Array)); |
437 CHECK_VAR_NEW_SHORTCUT(i8, Bounds(cache.kInt8Array)); | 440 CHECK_VAR_NEW_SHORTCUT(i8, Bounds(cache.kInt8Array)); |
438 CHECK_VAR_NEW_SHORTCUT(u16, Bounds(cache.kUint16Array)); | 441 CHECK_VAR_NEW_SHORTCUT(u16, Bounds(cache.kUint16Array)); |
439 CHECK_VAR_NEW_SHORTCUT(i16, Bounds(cache.kInt16Array)); | 442 CHECK_VAR_NEW_SHORTCUT(i16, Bounds(cache.kInt16Array)); |
440 CHECK_VAR_NEW_SHORTCUT(u32, Bounds(cache.kUint32Array)); | 443 CHECK_VAR_NEW_SHORTCUT(u32, Bounds(cache.kUint32Array)); |
441 CHECK_VAR_NEW_SHORTCUT(i32, Bounds(cache.kInt32Array)); | 444 CHECK_VAR_NEW_SHORTCUT(i32, Bounds(cache.kInt32Array)); |
442 CHECK_VAR_NEW_SHORTCUT(f32, Bounds(cache.kFloat32Array)); | 445 CHECK_VAR_NEW_SHORTCUT(f32, Bounds(cache.kFloat32Array)); |
443 CHECK_VAR_NEW_SHORTCUT(f64, Bounds(cache.kFloat64Array)); | 446 CHECK_VAR_NEW_SHORTCUT(f64, Bounds(cache.kFloat64Array)); |
444 } | 447 } |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 } | 535 } |
533 CHECK_FUNC_TYPES_END | 536 CHECK_FUNC_TYPES_END |
534 } | 537 } |
535 | 538 |
536 | 539 |
537 TEST(DoesNothing) { | 540 TEST(DoesNothing) { |
538 CHECK_FUNC_TYPES_BEGIN( | 541 CHECK_FUNC_TYPES_BEGIN( |
539 "function bar() { var x = 1.0; }\n" | 542 "function bar() { var x = 1.0; }\n" |
540 "function foo() { bar(); }") { | 543 "function foo() { bar(); }") { |
541 CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { | 544 CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { |
542 CHECK_EXPR(Assignment, Bounds(cache.kFloat64)) { | 545 CHECK_EXPR(Assignment, Bounds(cache.kAsmDouble)) { |
543 CHECK_VAR(x, Bounds(cache.kFloat64)); | 546 CHECK_VAR(x, Bounds(cache.kAsmDouble)); |
544 CHECK_EXPR(Literal, Bounds(cache.kFloat64)); | 547 CHECK_EXPR(Literal, Bounds(cache.kAsmDouble)); |
545 } | 548 } |
546 } | 549 } |
547 CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { | 550 CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { |
548 CHECK_EXPR(Call, Bounds(Type::Undefined())) { | 551 CHECK_EXPR(Call, Bounds(Type::Undefined())) { |
549 CHECK_VAR(bar, FUNC_V_TYPE); | 552 CHECK_VAR(bar, FUNC_V_TYPE); |
550 } | 553 } |
551 } | 554 } |
552 } | 555 } |
553 CHECK_FUNC_TYPES_END | 556 CHECK_FUNC_TYPES_END |
554 } | 557 } |
555 | 558 |
556 | 559 |
557 TEST(ReturnInt32Literal) { | 560 TEST(ReturnInt32Literal) { |
558 CHECK_FUNC_TYPES_BEGIN( | 561 CHECK_FUNC_TYPES_BEGIN( |
559 "function bar() { return 1; }\n" | 562 "function bar() { return 1; }\n" |
560 "function foo() { bar(); }") { | 563 "function foo() { bar(); }") { |
561 CHECK_EXPR(FunctionLiteral, FUNC_I_TYPE) { | 564 CHECK_EXPR(FunctionLiteral, FUNC_I_TYPE) { |
562 // return 1; | 565 // return 1; |
563 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 566 CHECK_EXPR(Literal, Bounds(cache.kAsmSigned)); |
564 } | 567 } |
565 CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { | 568 CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { |
566 CHECK_EXPR(Call, Bounds(cache.kInt32)) { CHECK_VAR(bar, FUNC_I_TYPE); } | 569 CHECK_EXPR(Call, Bounds(cache.kAsmSigned)) { |
| 570 CHECK_VAR(bar, FUNC_I_TYPE); |
| 571 } |
567 } | 572 } |
568 } | 573 } |
569 CHECK_FUNC_TYPES_END | 574 CHECK_FUNC_TYPES_END |
570 } | 575 } |
571 | 576 |
572 | 577 |
573 TEST(ReturnFloat64Literal) { | 578 TEST(ReturnFloat64Literal) { |
574 CHECK_FUNC_TYPES_BEGIN( | 579 CHECK_FUNC_TYPES_BEGIN( |
575 "function bar() { return 1.0; }\n" | 580 "function bar() { return 1.0; }\n" |
576 "function foo() { bar(); }") { | 581 "function foo() { bar(); }") { |
577 CHECK_EXPR(FunctionLiteral, FUNC_D_TYPE) { | 582 CHECK_EXPR(FunctionLiteral, FUNC_D_TYPE) { |
578 // return 1.0; | 583 // return 1.0; |
579 CHECK_EXPR(Literal, Bounds(cache.kFloat64)); | 584 CHECK_EXPR(Literal, Bounds(cache.kAsmDouble)); |
580 } | 585 } |
581 CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { | 586 CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { |
582 CHECK_EXPR(Call, Bounds(cache.kFloat64)) { CHECK_VAR(bar, FUNC_D_TYPE); } | 587 CHECK_EXPR(Call, Bounds(cache.kAsmDouble)) { |
| 588 CHECK_VAR(bar, FUNC_D_TYPE); |
| 589 } |
583 } | 590 } |
584 } | 591 } |
585 CHECK_FUNC_TYPES_END | 592 CHECK_FUNC_TYPES_END |
586 } | 593 } |
587 | 594 |
588 | 595 |
589 TEST(ReturnFloat32Literal) { | 596 TEST(ReturnFloat32Literal) { |
590 CHECK_FUNC_TYPES_BEGIN( | 597 CHECK_FUNC_TYPES_BEGIN( |
591 "function bar() { return fround(1.0); }\n" | 598 "function bar() { return fround(1.0); }\n" |
592 "function foo() { bar(); }") { | 599 "function foo() { bar(); }") { |
593 CHECK_EXPR(FunctionLiteral, FUNC_F_TYPE) { | 600 CHECK_EXPR(FunctionLiteral, FUNC_F_TYPE) { |
594 // return fround(1.0); | 601 // return fround(1.0); |
595 CHECK_EXPR(Call, Bounds(cache.kFloat32)) { | 602 CHECK_EXPR(Call, Bounds(cache.kAsmFloat)) { |
596 CHECK_VAR(fround, FUNC_N2F_TYPE); | 603 CHECK_VAR(fround, FUNC_N2F_TYPE); |
597 CHECK_EXPR(Literal, Bounds(cache.kFloat64)); | 604 CHECK_EXPR(Literal, Bounds(cache.kAsmDouble)); |
598 } | 605 } |
599 } | 606 } |
600 CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { | 607 CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { |
601 CHECK_EXPR(Call, Bounds(cache.kFloat32)) { CHECK_VAR(bar, FUNC_F_TYPE); } | 608 CHECK_EXPR(Call, Bounds(cache.kAsmFloat)) { CHECK_VAR(bar, FUNC_F_TYPE); } |
602 } | 609 } |
603 } | 610 } |
604 CHECK_FUNC_TYPES_END | 611 CHECK_FUNC_TYPES_END |
605 } | 612 } |
606 | 613 |
607 | 614 |
608 TEST(ReturnFloat64Var) { | 615 TEST(ReturnFloat64Var) { |
609 CHECK_FUNC_TYPES_BEGIN( | 616 CHECK_FUNC_TYPES_BEGIN( |
610 "function bar() { var x = 1.0; return +x; }\n" | 617 "function bar() { var x = 1.0; return +x; }\n" |
611 "function foo() { bar(); }") { | 618 "function foo() { bar(); }") { |
612 CHECK_EXPR(FunctionLiteral, FUNC_D_TYPE) { | 619 CHECK_EXPR(FunctionLiteral, FUNC_D_TYPE) { |
613 // return 1.0; | 620 // return 1.0; |
614 CHECK_EXPR(Assignment, Bounds(cache.kFloat64)) { | 621 CHECK_EXPR(Assignment, Bounds(cache.kAsmDouble)) { |
615 CHECK_VAR(x, Bounds(cache.kFloat64)); | 622 CHECK_VAR(x, Bounds(cache.kAsmDouble)); |
616 CHECK_EXPR(Literal, Bounds(cache.kFloat64)); | 623 CHECK_EXPR(Literal, Bounds(cache.kAsmDouble)); |
617 } | 624 } |
618 // return 1.0; | 625 // return 1.0; |
619 CHECK_EXPR(BinaryOperation, Bounds(cache.kFloat64)) { | 626 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmDouble)) { |
620 CHECK_VAR(x, Bounds(cache.kFloat64)); | 627 CHECK_VAR(x, Bounds(cache.kAsmDouble)); |
621 CHECK_EXPR(Literal, Bounds(cache.kFloat64)); | 628 CHECK_EXPR(Literal, Bounds(cache.kAsmDouble)); |
622 } | 629 } |
623 } | 630 } |
624 CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { | 631 CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { |
625 CHECK_EXPR(Call, Bounds(cache.kFloat64)) { CHECK_VAR(bar, FUNC_D_TYPE); } | 632 CHECK_EXPR(Call, Bounds(cache.kAsmDouble)) { |
| 633 CHECK_VAR(bar, FUNC_D_TYPE); |
| 634 } |
626 } | 635 } |
627 } | 636 } |
628 CHECK_FUNC_TYPES_END | 637 CHECK_FUNC_TYPES_END |
629 } | 638 } |
630 | 639 |
631 | 640 |
632 TEST(Addition2) { | 641 TEST(Addition2) { |
633 CHECK_FUNC_TYPES_BEGIN( | 642 CHECK_FUNC_TYPES_BEGIN( |
634 "function bar() { var x = 1; var y = 2; return (x+y)|0; }\n" | 643 "function bar() { var x = 1; var y = 2; return (x+y)|0; }\n" |
635 "function foo() { bar(); }") { | 644 "function foo() { bar(); }") { |
636 CHECK_EXPR(FunctionLiteral, FUNC_I_TYPE) { | 645 CHECK_EXPR(FunctionLiteral, FUNC_I_TYPE) { |
637 CHECK_EXPR(Assignment, Bounds(cache.kInt32)) { | 646 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { |
638 CHECK_VAR(x, Bounds(cache.kInt32)); | 647 CHECK_VAR(x, Bounds(cache.kAsmInt)); |
639 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 648 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
640 } | 649 } |
641 CHECK_EXPR(Assignment, Bounds(cache.kInt32)) { | 650 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { |
642 CHECK_VAR(y, Bounds(cache.kInt32)); | 651 CHECK_VAR(y, Bounds(cache.kAsmInt)); |
643 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 652 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
644 } | 653 } |
645 CHECK_EXPR(BinaryOperation, Bounds(cache.kInt32)) { | 654 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { |
646 CHECK_EXPR(BinaryOperation, Bounds(cache.kInt32)) { | 655 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmInt)) { |
647 CHECK_VAR(x, Bounds(cache.kInt32)); | 656 CHECK_VAR(x, Bounds(cache.kAsmInt)); |
648 CHECK_VAR(y, Bounds(cache.kInt32)); | 657 CHECK_VAR(y, Bounds(cache.kAsmInt)); |
649 } | 658 } |
650 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 659 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
651 } | 660 } |
652 } | 661 } |
653 CHECK_SKIP(); | 662 CHECK_SKIP(); |
654 } | 663 } |
655 CHECK_FUNC_TYPES_END | 664 CHECK_FUNC_TYPES_END |
656 } | 665 } |
657 | 666 |
658 | 667 |
659 #define TEST_COMPARE_OP(name, op) \ | 668 #define TEST_COMPARE_OP(name, op) \ |
660 TEST(name) { \ | 669 TEST(name) { \ |
661 CHECK_FUNC_TYPES_BEGIN("function bar() { return (0 " op \ | 670 CHECK_FUNC_TYPES_BEGIN("function bar() { return (0 " op \ |
662 " 0)|0; }\n" \ | 671 " 0)|0; }\n" \ |
663 "function foo() { bar(); }") { \ | 672 "function foo() { bar(); }") { \ |
664 CHECK_EXPR(FunctionLiteral, FUNC_I_TYPE) { \ | 673 CHECK_EXPR(FunctionLiteral, FUNC_I_TYPE) { \ |
665 CHECK_EXPR(BinaryOperation, Bounds(cache.kInt32)) { \ | 674 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { \ |
666 CHECK_EXPR(CompareOperation, Bounds(cache.kInt32)) { \ | 675 CHECK_EXPR(CompareOperation, Bounds(cache.kAsmSigned)) { \ |
667 CHECK_EXPR(Literal, Bounds(cache.kInt32)); \ | 676 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); \ |
668 CHECK_EXPR(Literal, Bounds(cache.kInt32)); \ | 677 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); \ |
669 } \ | 678 } \ |
670 CHECK_EXPR(Literal, Bounds(cache.kInt32)); \ | 679 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); \ |
671 } \ | 680 } \ |
672 } \ | 681 } \ |
673 CHECK_SKIP(); \ | 682 CHECK_SKIP(); \ |
674 } \ | 683 } \ |
675 CHECK_FUNC_TYPES_END \ | 684 CHECK_FUNC_TYPES_END \ |
676 } | 685 } |
677 | 686 |
678 | 687 |
679 TEST_COMPARE_OP(EqOperator, "==") | 688 TEST_COMPARE_OP(EqOperator, "==") |
680 TEST_COMPARE_OP(LtOperator, "<") | 689 TEST_COMPARE_OP(LtOperator, "<") |
681 TEST_COMPARE_OP(LteOperator, "<=") | 690 TEST_COMPARE_OP(LteOperator, "<=") |
682 TEST_COMPARE_OP(GtOperator, ">") | 691 TEST_COMPARE_OP(GtOperator, ">") |
683 TEST_COMPARE_OP(GteOperator, ">=") | 692 TEST_COMPARE_OP(GteOperator, ">=") |
684 | 693 |
685 | 694 |
686 TEST(NeqOperator) { | 695 TEST(NeqOperator) { |
687 CHECK_FUNC_TYPES_BEGIN( | 696 CHECK_FUNC_TYPES_BEGIN( |
688 "function bar() { return (0 != 0)|0; }\n" | 697 "function bar() { return (0 != 0)|0; }\n" |
689 "function foo() { bar(); }") { | 698 "function foo() { bar(); }") { |
690 CHECK_EXPR(FunctionLiteral, FUNC_I_TYPE) { | 699 CHECK_EXPR(FunctionLiteral, FUNC_I_TYPE) { |
691 CHECK_EXPR(BinaryOperation, Bounds(cache.kInt32)) { | 700 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { |
692 CHECK_EXPR(UnaryOperation, Bounds(cache.kInt32)) { | 701 CHECK_EXPR(UnaryOperation, Bounds(cache.kAsmSigned)) { |
693 CHECK_EXPR(CompareOperation, Bounds(cache.kInt32)) { | 702 CHECK_EXPR(CompareOperation, Bounds(cache.kAsmSigned)) { |
694 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 703 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
695 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 704 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
696 } | 705 } |
697 } | 706 } |
698 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 707 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
699 } | 708 } |
700 } | 709 } |
701 CHECK_SKIP(); | 710 CHECK_SKIP(); |
702 } | 711 } |
703 CHECK_FUNC_TYPES_END | 712 CHECK_FUNC_TYPES_END |
704 } | 713 } |
705 | 714 |
706 | 715 |
707 TEST(NotOperator) { | 716 TEST(NotOperator) { |
708 CHECK_FUNC_TYPES_BEGIN( | 717 CHECK_FUNC_TYPES_BEGIN( |
709 "function bar() { var x = 0; return (!x)|0; }\n" | 718 "function bar() { var x = 0; return (!x)|0; }\n" |
710 "function foo() { bar(); }") { | 719 "function foo() { bar(); }") { |
711 CHECK_EXPR(FunctionLiteral, FUNC_I_TYPE) { | 720 CHECK_EXPR(FunctionLiteral, FUNC_I_TYPE) { |
712 CHECK_EXPR(Assignment, Bounds(cache.kInt32)) { | 721 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { |
713 CHECK_VAR(x, Bounds(cache.kInt32)); | 722 CHECK_VAR(x, Bounds(cache.kAsmInt)); |
714 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 723 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
715 } | 724 } |
716 CHECK_EXPR(BinaryOperation, Bounds(cache.kInt32)) { | 725 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { |
717 CHECK_EXPR(UnaryOperation, Bounds(cache.kInt32)) { | 726 CHECK_EXPR(UnaryOperation, Bounds(cache.kAsmSigned)) { |
718 CHECK_VAR(x, Bounds(cache.kInt32)); | 727 CHECK_VAR(x, Bounds(cache.kAsmInt)); |
719 } | 728 } |
720 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 729 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
721 } | 730 } |
722 } | 731 } |
723 CHECK_SKIP(); | 732 CHECK_SKIP(); |
724 } | 733 } |
725 CHECK_FUNC_TYPES_END | 734 CHECK_FUNC_TYPES_END |
726 } | 735 } |
727 | 736 |
728 | 737 |
729 TEST(InvertOperator) { | 738 TEST(InvertOperator) { |
730 CHECK_FUNC_TYPES_BEGIN( | 739 CHECK_FUNC_TYPES_BEGIN( |
731 "function bar() { var x = 0; return (~x)|0; }\n" | 740 "function bar() { var x = 0; return (~x)|0; }\n" |
732 "function foo() { bar(); }") { | 741 "function foo() { bar(); }") { |
733 CHECK_EXPR(FunctionLiteral, FUNC_I_TYPE) { | 742 CHECK_EXPR(FunctionLiteral, FUNC_I_TYPE) { |
734 CHECK_EXPR(Assignment, Bounds(cache.kInt32)) { | 743 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { |
735 CHECK_VAR(x, Bounds(cache.kInt32)); | 744 CHECK_VAR(x, Bounds(cache.kAsmInt)); |
736 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 745 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
737 } | 746 } |
738 CHECK_EXPR(BinaryOperation, Bounds(cache.kInt32)) { | 747 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { |
739 CHECK_EXPR(BinaryOperation, Bounds(cache.kInt32)) { | 748 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { |
740 CHECK_VAR(x, Bounds(cache.kInt32)); | 749 CHECK_VAR(x, Bounds(cache.kAsmInt)); |
741 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 750 CHECK_EXPR(Literal, Bounds(cache.kAsmSigned)); |
742 } | 751 } |
743 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 752 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
744 } | 753 } |
745 } | 754 } |
746 CHECK_SKIP(); | 755 CHECK_SKIP(); |
747 } | 756 } |
748 CHECK_FUNC_TYPES_END | 757 CHECK_FUNC_TYPES_END |
749 } | 758 } |
750 | 759 |
751 | 760 |
752 TEST(InvertConversion) { | 761 TEST(InvertConversion) { |
753 CHECK_FUNC_TYPES_BEGIN( | 762 CHECK_FUNC_TYPES_BEGIN( |
754 "function bar() { var x = 0.0; return (~~x)|0; }\n" | 763 "function bar() { var x = 0.0; return (~~x)|0; }\n" |
755 "function foo() { bar(); }") { | 764 "function foo() { bar(); }") { |
756 CHECK_EXPR(FunctionLiteral, FUNC_I_TYPE) { | 765 CHECK_EXPR(FunctionLiteral, FUNC_I_TYPE) { |
757 CHECK_EXPR(Assignment, Bounds(cache.kFloat64)) { | 766 CHECK_EXPR(Assignment, Bounds(cache.kAsmDouble)) { |
758 CHECK_VAR(x, Bounds(cache.kFloat64)); | 767 CHECK_VAR(x, Bounds(cache.kAsmDouble)); |
759 CHECK_EXPR(Literal, Bounds(cache.kFloat64)); | 768 CHECK_EXPR(Literal, Bounds(cache.kAsmDouble)); |
760 } | 769 } |
761 CHECK_EXPR(BinaryOperation, Bounds(cache.kInt32)) { | 770 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { |
762 CHECK_EXPR(BinaryOperation, Bounds(cache.kInt32)) { | 771 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { |
763 CHECK_EXPR(BinaryOperation, Bounds(cache.kInt32)) { | 772 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { |
764 CHECK_VAR(x, Bounds(cache.kFloat64)); | 773 CHECK_VAR(x, Bounds(cache.kAsmDouble)); |
765 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 774 CHECK_EXPR(Literal, Bounds(cache.kAsmSigned)); |
766 } | 775 } |
767 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 776 CHECK_EXPR(Literal, Bounds(cache.kAsmSigned)); |
768 } | 777 } |
769 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 778 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
770 } | 779 } |
771 } | 780 } |
772 CHECK_SKIP(); | 781 CHECK_SKIP(); |
773 } | 782 } |
774 CHECK_FUNC_TYPES_END | 783 CHECK_FUNC_TYPES_END |
775 } | 784 } |
776 | 785 |
777 | 786 |
778 #define TEST_INT_BIN_OP(name, op) \ | 787 #define TEST_INT_BIN_OP(name, op) \ |
779 TEST(name) { \ | 788 TEST(name) { \ |
780 CHECK_FUNC_TYPES_BEGIN("function bar() { var x = 0; return (x " op \ | 789 CHECK_FUNC_TYPES_BEGIN("function bar() { var x = 0; return (x " op \ |
781 " 123)|0; }\n" \ | 790 " 123)|0; }\n" \ |
782 "function foo() { bar(); }") { \ | 791 "function foo() { bar(); }") { \ |
783 CHECK_EXPR(FunctionLiteral, FUNC_I_TYPE) { \ | 792 CHECK_EXPR(FunctionLiteral, FUNC_I_TYPE) { \ |
784 CHECK_EXPR(Assignment, Bounds(cache.kInt32)) { \ | 793 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { \ |
785 CHECK_VAR(x, Bounds(cache.kInt32)); \ | 794 CHECK_VAR(x, Bounds(cache.kAsmInt)); \ |
786 CHECK_EXPR(Literal, Bounds(cache.kInt32)); \ | 795 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); \ |
787 } \ | 796 } \ |
788 CHECK_EXPR(BinaryOperation, Bounds(cache.kInt32)) { \ | 797 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { \ |
789 CHECK_EXPR(BinaryOperation, Bounds(cache.kInt32)) { \ | 798 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { \ |
790 CHECK_VAR(x, Bounds(cache.kInt32)); \ | 799 CHECK_VAR(x, Bounds(cache.kAsmInt)); \ |
791 CHECK_EXPR(Literal, Bounds(cache.kInt32)); \ | 800 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); \ |
792 } \ | 801 } \ |
793 CHECK_EXPR(Literal, Bounds(cache.kInt32)); \ | 802 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); \ |
794 } \ | 803 } \ |
795 } \ | 804 } \ |
796 CHECK_SKIP(); \ | 805 CHECK_SKIP(); \ |
797 } \ | 806 } \ |
798 CHECK_FUNC_TYPES_END \ | 807 CHECK_FUNC_TYPES_END \ |
799 } | 808 } |
800 | 809 |
801 | 810 |
802 TEST_INT_BIN_OP(AndOperator, "&") | 811 TEST_INT_BIN_OP(AndOperator, "&") |
803 TEST_INT_BIN_OP(OrOperator, "|") | 812 TEST_INT_BIN_OP(OrOperator, "|") |
804 TEST_INT_BIN_OP(XorOperator, "^") | 813 TEST_INT_BIN_OP(XorOperator, "^") |
805 | 814 |
806 | 815 |
807 TEST(UnsignedCompare) { | 816 TEST(UnsignedCompare) { |
808 CHECK_FUNC_TYPES_BEGIN( | 817 CHECK_FUNC_TYPES_BEGIN( |
809 "function bar() { var x = 1; var y = 1; return ((x>>>0) < (y>>>0))|0; }\n" | 818 "function bar() { var x = 1; var y = 1; return ((x>>>0) < (y>>>0))|0; }\n" |
810 "function foo() { bar(); }") { | 819 "function foo() { bar(); }") { |
811 CHECK_EXPR(FunctionLiteral, FUNC_I_TYPE) { | 820 CHECK_EXPR(FunctionLiteral, FUNC_I_TYPE) { |
812 CHECK_EXPR(Assignment, Bounds(cache.kInt32)) { | 821 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { |
813 CHECK_VAR(x, Bounds(cache.kInt32)); | 822 CHECK_VAR(x, Bounds(cache.kAsmInt)); |
814 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 823 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
815 } | 824 } |
816 CHECK_EXPR(Assignment, Bounds(cache.kInt32)) { | 825 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { |
817 CHECK_VAR(y, Bounds(cache.kInt32)); | 826 CHECK_VAR(y, Bounds(cache.kAsmInt)); |
818 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 827 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
819 } | 828 } |
820 CHECK_EXPR(BinaryOperation, Bounds(cache.kInt32)) { | 829 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { |
821 CHECK_EXPR(CompareOperation, Bounds(cache.kInt32)) { | 830 CHECK_EXPR(CompareOperation, Bounds(cache.kAsmSigned)) { |
822 CHECK_EXPR(BinaryOperation, Bounds(cache.kUint32)) { | 831 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmUnsigned)) { |
823 CHECK_VAR(x, Bounds(cache.kInt32)); | 832 CHECK_VAR(x, Bounds(cache.kAsmInt)); |
824 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 833 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
825 } | 834 } |
826 CHECK_EXPR(BinaryOperation, Bounds(cache.kUint32)) { | 835 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmUnsigned)) { |
827 CHECK_VAR(y, Bounds(cache.kInt32)); | 836 CHECK_VAR(y, Bounds(cache.kAsmInt)); |
828 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 837 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
829 } | 838 } |
830 } | 839 } |
831 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 840 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
832 } | 841 } |
833 } | 842 } |
834 CHECK_SKIP(); | 843 CHECK_SKIP(); |
835 } | 844 } |
836 CHECK_FUNC_TYPES_END | 845 CHECK_FUNC_TYPES_END |
837 } | 846 } |
838 | 847 |
839 | 848 |
840 TEST(UnsignedDivide) { | 849 TEST(UnsignedDivide) { |
841 CHECK_FUNC_TYPES_BEGIN( | 850 CHECK_FUNC_TYPES_BEGIN( |
842 "function bar() { var x = 1; var y = 1; return ((x>>>0) / (y>>>0))|0; }\n" | 851 "function bar() { var x = 1; var y = 1; return ((x>>>0) / (y>>>0))|0; }\n" |
843 "function foo() { bar(); }") { | 852 "function foo() { bar(); }") { |
844 CHECK_EXPR(FunctionLiteral, FUNC_I_TYPE) { | 853 CHECK_EXPR(FunctionLiteral, FUNC_I_TYPE) { |
845 CHECK_EXPR(Assignment, Bounds(cache.kInt32)) { | 854 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { |
846 CHECK_VAR(x, Bounds(cache.kInt32)); | 855 CHECK_VAR(x, Bounds(cache.kAsmInt)); |
847 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 856 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
848 } | 857 } |
849 CHECK_EXPR(Assignment, Bounds(cache.kInt32)) { | 858 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { |
850 CHECK_VAR(y, Bounds(cache.kInt32)); | 859 CHECK_VAR(y, Bounds(cache.kAsmInt)); |
851 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 860 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
852 } | 861 } |
853 CHECK_EXPR(BinaryOperation, Bounds(cache.kInt32)) { | 862 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { |
854 CHECK_EXPR(BinaryOperation, Bounds(Type::None(), Type::Any())) { | 863 CHECK_EXPR(BinaryOperation, Bounds(Type::None(), Type::Any())) { |
855 CHECK_EXPR(BinaryOperation, Bounds(cache.kUint32)) { | 864 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmUnsigned)) { |
856 CHECK_VAR(x, Bounds(cache.kInt32)); | 865 CHECK_VAR(x, Bounds(cache.kAsmInt)); |
857 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 866 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
858 } | 867 } |
859 CHECK_EXPR(BinaryOperation, Bounds(cache.kUint32)) { | 868 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmUnsigned)) { |
860 CHECK_VAR(y, Bounds(cache.kInt32)); | 869 CHECK_VAR(y, Bounds(cache.kAsmInt)); |
861 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 870 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
862 } | 871 } |
863 } | 872 } |
864 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 873 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
865 } | 874 } |
866 } | 875 } |
867 CHECK_SKIP(); | 876 CHECK_SKIP(); |
868 } | 877 } |
869 CHECK_FUNC_TYPES_END | 878 CHECK_FUNC_TYPES_END |
870 } | 879 } |
871 | 880 |
872 | 881 |
873 TEST(UnsignedFromFloat64) { | 882 TEST(UnsignedFromFloat64) { |
874 CHECK_FUNC_ERROR( | 883 CHECK_FUNC_ERROR( |
875 "function bar() { var x = 1.0; return (x>>>0)|0; }\n" | 884 "function bar() { var x = 1.0; return (x>>>0)|0; }\n" |
876 "function foo() { bar(); }", | 885 "function foo() { bar(); }", |
877 "asm: line 39: ill typed bitwise operation\n"); | 886 "asm: line 39: left bitwise operand expected to be an integer\n"); |
878 } | 887 } |
879 | 888 |
880 | 889 |
| 890 TEST(AndFloat64) { |
| 891 CHECK_FUNC_ERROR( |
| 892 "function bar() { var x = 1.0; return (x&0)|0; }\n" |
| 893 "function foo() { bar(); }", |
| 894 "asm: line 39: left bitwise operand expected to be an integer\n"); |
| 895 } |
| 896 |
| 897 |
881 TEST(TypeMismatchAddInt32Float64) { | 898 TEST(TypeMismatchAddInt32Float64) { |
882 CHECK_FUNC_ERROR( | 899 CHECK_FUNC_ERROR( |
883 "function bar() { var x = 1.0; var y = 0; return (x + y)|0; }\n" | 900 "function bar() { var x = 1.0; var y = 0; return (x + y)|0; }\n" |
884 "function foo() { bar(); }", | 901 "function foo() { bar(); }", |
885 "asm: line 39: ill-typed arithmetic operation\n"); | 902 "asm: line 39: ill-typed arithmetic operation\n"); |
886 } | 903 } |
887 | 904 |
888 | 905 |
889 TEST(TypeMismatchSubInt32Float64) { | 906 TEST(TypeMismatchSubInt32Float64) { |
890 CHECK_FUNC_ERROR( | 907 CHECK_FUNC_ERROR( |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
924 "function foo() { bar(); }", | 941 "function foo() { bar(); }", |
925 "asm: line 39: ill-typed conditional\n"); | 942 "asm: line 39: ill-typed conditional\n"); |
926 } | 943 } |
927 | 944 |
928 | 945 |
929 TEST(FroundFloat32) { | 946 TEST(FroundFloat32) { |
930 CHECK_FUNC_TYPES_BEGIN( | 947 CHECK_FUNC_TYPES_BEGIN( |
931 "function bar() { var x = 1; return fround(x); }\n" | 948 "function bar() { var x = 1; return fround(x); }\n" |
932 "function foo() { bar(); }") { | 949 "function foo() { bar(); }") { |
933 CHECK_EXPR(FunctionLiteral, FUNC_F_TYPE) { | 950 CHECK_EXPR(FunctionLiteral, FUNC_F_TYPE) { |
934 CHECK_EXPR(Assignment, Bounds(cache.kInt32)) { | 951 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { |
935 CHECK_VAR(x, Bounds(cache.kInt32)); | 952 CHECK_VAR(x, Bounds(cache.kAsmInt)); |
936 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 953 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
937 } | 954 } |
938 CHECK_EXPR(Call, Bounds(cache.kFloat32)) { | 955 CHECK_EXPR(Call, Bounds(cache.kAsmFloat)) { |
939 CHECK_VAR(fround, FUNC_N2F_TYPE); | 956 CHECK_VAR(fround, FUNC_N2F_TYPE); |
940 CHECK_VAR(x, Bounds(cache.kInt32)); | 957 CHECK_VAR(x, Bounds(cache.kAsmInt)); |
941 } | 958 } |
942 } | 959 } |
943 CHECK_SKIP(); | 960 CHECK_SKIP(); |
944 } | 961 } |
945 CHECK_FUNC_TYPES_END | 962 CHECK_FUNC_TYPES_END |
946 } | 963 } |
947 | 964 |
948 | 965 |
949 TEST(Addition4) { | 966 TEST(Addition4) { |
950 CHECK_FUNC_TYPES_BEGIN( | 967 CHECK_FUNC_TYPES_BEGIN( |
951 "function bar() { var x = 1; var y = 2; return (x+y+x+y)|0; }\n" | 968 "function bar() { var x = 1; var y = 2; return (x+y+x+y)|0; }\n" |
952 "function foo() { bar(); }") { | 969 "function foo() { bar(); }") { |
953 CHECK_EXPR(FunctionLiteral, FUNC_I_TYPE) { | 970 CHECK_EXPR(FunctionLiteral, FUNC_I_TYPE) { |
954 CHECK_EXPR(Assignment, Bounds(cache.kInt32)) { | 971 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { |
955 CHECK_VAR(x, Bounds(cache.kInt32)); | 972 CHECK_VAR(x, Bounds(cache.kAsmInt)); |
956 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 973 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
957 } | 974 } |
958 CHECK_EXPR(Assignment, Bounds(cache.kInt32)) { | 975 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { |
959 CHECK_VAR(y, Bounds(cache.kInt32)); | 976 CHECK_VAR(y, Bounds(cache.kAsmInt)); |
960 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 977 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
961 } | 978 } |
962 CHECK_EXPR(BinaryOperation, Bounds(cache.kInt32)) { | 979 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { |
963 CHECK_EXPR(BinaryOperation, Bounds(cache.kInt32)) { | 980 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmInt)) { |
964 CHECK_EXPR(BinaryOperation, Bounds(cache.kInt32)) { | 981 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmInt)) { |
965 CHECK_EXPR(BinaryOperation, Bounds(cache.kInt32)) { | 982 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmInt)) { |
966 CHECK_VAR(x, Bounds(cache.kInt32)); | 983 CHECK_VAR(x, Bounds(cache.kAsmInt)); |
967 CHECK_VAR(y, Bounds(cache.kInt32)); | 984 CHECK_VAR(y, Bounds(cache.kAsmInt)); |
968 } | 985 } |
969 CHECK_VAR(x, Bounds(cache.kInt32)); | 986 CHECK_VAR(x, Bounds(cache.kAsmInt)); |
970 } | 987 } |
971 CHECK_VAR(y, Bounds(cache.kInt32)); | 988 CHECK_VAR(y, Bounds(cache.kAsmInt)); |
972 } | 989 } |
973 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 990 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
974 } | 991 } |
975 } | 992 } |
976 CHECK_SKIP(); | 993 CHECK_SKIP(); |
977 } | 994 } |
978 CHECK_FUNC_TYPES_END | 995 CHECK_FUNC_TYPES_END |
979 } | 996 } |
980 | 997 |
981 | 998 |
982 TEST(Multiplication2) { | 999 TEST(Multiplication2) { |
983 CHECK_FUNC_ERROR( | 1000 CHECK_FUNC_ERROR( |
(...skipping 14 matching lines...) Expand all Loading... |
998 TEST(CompareMismatchInt32Float64) { | 1015 TEST(CompareMismatchInt32Float64) { |
999 CHECK_FUNC_ERROR( | 1016 CHECK_FUNC_ERROR( |
1000 "function bar() { var x = 1; var y = 2.0; return (x < y)|0; }\n" | 1017 "function bar() { var x = 1; var y = 2.0; return (x < y)|0; }\n" |
1001 "function foo() { bar(); }", | 1018 "function foo() { bar(); }", |
1002 "asm: line 39: ill-typed comparison operation\n"); | 1019 "asm: line 39: ill-typed comparison operation\n"); |
1003 } | 1020 } |
1004 | 1021 |
1005 | 1022 |
1006 TEST(CompareMismatchInt32Uint32) { | 1023 TEST(CompareMismatchInt32Uint32) { |
1007 CHECK_FUNC_ERROR( | 1024 CHECK_FUNC_ERROR( |
1008 "function bar() { var x = 1; var y = 2; return (x < (y>>>0))|0; }\n" | 1025 "function bar() { var x = 1; var y = 2; return ((x|0) < (y>>>0))|0; }\n" |
1009 "function foo() { bar(); }", | 1026 "function foo() { bar(); }", |
1010 "asm: line 39: ill-typed comparison operation\n"); | 1027 "asm: line 39: ill-typed comparison operation\n"); |
1011 } | 1028 } |
1012 | 1029 |
1013 | 1030 |
1014 TEST(CompareMismatchInt32Float32) { | 1031 TEST(CompareMismatchInt32Float32) { |
1015 CHECK_FUNC_ERROR( | 1032 CHECK_FUNC_ERROR( |
1016 "function bar() { var x = 1; var y = 2; return (x < fround(y))|0; }\n" | 1033 "function bar() { var x = 1; var y = 2; return (x < fround(y))|0; }\n" |
1017 "function foo() { bar(); }", | 1034 "function foo() { bar(); }", |
1018 "asm: line 39: ill-typed comparison operation\n"); | 1035 "asm: line 39: ill-typed comparison operation\n"); |
1019 } | 1036 } |
1020 | 1037 |
1021 | 1038 |
1022 TEST(Float64ToInt32) { | 1039 TEST(Float64ToInt32) { |
1023 CHECK_FUNC_TYPES_BEGIN( | 1040 CHECK_FUNC_TYPES_BEGIN( |
1024 "function bar() { var x = 1; var y = 0.0; x = ~~y; }\n" | 1041 "function bar() { var x = 1; var y = 0.0; x = ~~y; }\n" |
1025 "function foo() { bar(); }") { | 1042 "function foo() { bar(); }") { |
1026 CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { | 1043 CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { |
1027 CHECK_EXPR(Assignment, Bounds(cache.kInt32)) { | 1044 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { |
1028 CHECK_VAR(x, Bounds(cache.kInt32)); | 1045 CHECK_VAR(x, Bounds(cache.kAsmInt)); |
1029 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 1046 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
1030 } | 1047 } |
1031 CHECK_EXPR(Assignment, Bounds(cache.kFloat64)) { | 1048 CHECK_EXPR(Assignment, Bounds(cache.kAsmDouble)) { |
1032 CHECK_VAR(y, Bounds(cache.kFloat64)); | 1049 CHECK_VAR(y, Bounds(cache.kAsmDouble)); |
1033 CHECK_EXPR(Literal, Bounds(cache.kFloat64)); | 1050 CHECK_EXPR(Literal, Bounds(cache.kAsmDouble)); |
1034 } | 1051 } |
1035 CHECK_EXPR(Assignment, Bounds(cache.kInt32)) { | 1052 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { |
1036 CHECK_VAR(x, Bounds(cache.kInt32)); | 1053 CHECK_VAR(x, Bounds(cache.kAsmInt)); |
1037 CHECK_EXPR(BinaryOperation, Bounds(cache.kInt32)) { | 1054 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { |
1038 CHECK_EXPR(BinaryOperation, Bounds(cache.kInt32)) { | 1055 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { |
1039 CHECK_VAR(y, Bounds(cache.kFloat64)); | 1056 CHECK_VAR(y, Bounds(cache.kAsmDouble)); |
1040 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 1057 CHECK_EXPR(Literal, Bounds(cache.kAsmSigned)); |
1041 } | 1058 } |
1042 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 1059 CHECK_EXPR(Literal, Bounds(cache.kAsmSigned)); |
1043 } | 1060 } |
1044 } | 1061 } |
1045 } | 1062 } |
1046 CHECK_SKIP(); | 1063 CHECK_SKIP(); |
1047 } | 1064 } |
1048 CHECK_FUNC_TYPES_END | 1065 CHECK_FUNC_TYPES_END |
1049 } | 1066 } |
1050 | 1067 |
1051 | 1068 |
1052 TEST(Load1) { | 1069 TEST(Load1) { |
1053 CHECK_FUNC_TYPES_BEGIN( | 1070 CHECK_FUNC_TYPES_BEGIN( |
1054 "function bar() { var x = 1; var y = i8[x>>0]|0; }\n" | 1071 "function bar() { var x = 1; var y = i8[x>>0]|0; }\n" |
1055 "function foo() { bar(); }") { | 1072 "function foo() { bar(); }") { |
1056 CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { | 1073 CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { |
1057 CHECK_EXPR(Assignment, Bounds(cache.kInt32)) { | 1074 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { |
1058 CHECK_VAR(x, Bounds(cache.kInt32)); | 1075 CHECK_VAR(x, Bounds(cache.kAsmInt)); |
1059 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 1076 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
1060 } | 1077 } |
1061 CHECK_EXPR(Assignment, Bounds(cache.kInt32)) { | 1078 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { |
1062 CHECK_VAR(y, Bounds(cache.kInt32)); | 1079 CHECK_VAR(y, Bounds(cache.kAsmInt)); |
1063 CHECK_EXPR(BinaryOperation, Bounds(cache.kInt32)) { | 1080 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { |
1064 CHECK_EXPR(Property, Bounds(cache.kInt8)) { | 1081 CHECK_EXPR(Property, Bounds(cache.kInt8)) { |
1065 CHECK_VAR(i8, Bounds(cache.kInt8Array)); | 1082 CHECK_VAR(i8, Bounds(cache.kInt8Array)); |
1066 CHECK_EXPR(BinaryOperation, Bounds(cache.kInt32)) { | 1083 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { |
1067 CHECK_VAR(x, Bounds(cache.kInt32)); | 1084 CHECK_VAR(x, Bounds(cache.kAsmSigned)); |
1068 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 1085 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
1069 } | 1086 } |
1070 } | 1087 } |
1071 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 1088 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
1072 } | 1089 } |
1073 } | 1090 } |
1074 } | 1091 } |
1075 CHECK_SKIP(); | 1092 CHECK_SKIP(); |
1076 } | 1093 } |
1077 CHECK_FUNC_TYPES_END | 1094 CHECK_FUNC_TYPES_END |
1078 } | 1095 } |
1079 | 1096 |
1080 | 1097 |
1081 TEST(Load1Constant) { | 1098 TEST(Load1Constant) { |
1082 CHECK_FUNC_TYPES_BEGIN( | 1099 CHECK_FUNC_TYPES_BEGIN( |
1083 "function bar() { var x = 1; var y = i8[5]|0; }\n" | 1100 "function bar() { var x = 1; var y = i8[5]|0; }\n" |
1084 "function foo() { bar(); }") { | 1101 "function foo() { bar(); }") { |
1085 CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { | 1102 CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { |
1086 CHECK_EXPR(Assignment, Bounds(cache.kInt32)) { | 1103 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { |
1087 CHECK_VAR(x, Bounds(cache.kInt32)); | 1104 CHECK_VAR(x, Bounds(cache.kAsmInt)); |
1088 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 1105 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
1089 } | 1106 } |
1090 CHECK_EXPR(Assignment, Bounds(cache.kInt32)) { | 1107 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { |
1091 CHECK_VAR(y, Bounds(cache.kInt32)); | 1108 CHECK_VAR(y, Bounds(cache.kAsmInt)); |
1092 CHECK_EXPR(BinaryOperation, Bounds(cache.kInt32)) { | 1109 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { |
1093 CHECK_EXPR(Property, Bounds(cache.kInt8)) { | 1110 CHECK_EXPR(Property, Bounds(cache.kInt8)) { |
1094 CHECK_VAR(i8, Bounds(cache.kInt8Array)); | 1111 CHECK_VAR(i8, Bounds(cache.kInt8Array)); |
1095 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 1112 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
1096 } | 1113 } |
1097 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 1114 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
1098 } | 1115 } |
1099 } | 1116 } |
1100 } | 1117 } |
1101 CHECK_SKIP(); | 1118 CHECK_SKIP(); |
1102 } | 1119 } |
1103 CHECK_FUNC_TYPES_END | 1120 CHECK_FUNC_TYPES_END |
1104 } | 1121 } |
1105 | 1122 |
1106 | 1123 |
1107 TEST(FunctionTables) { | 1124 TEST(FunctionTables) { |
1108 CHECK_FUNC_TYPES_BEGIN( | 1125 CHECK_FUNC_TYPES_BEGIN( |
1109 "function func1(x) { x = x | 0; return (x * 5) | 0; }\n" | 1126 "function func1(x) { x = x | 0; return (x * 5) | 0; }\n" |
1110 "function func2(x) { x = x | 0; return (x * 25) | 0; }\n" | 1127 "function func2(x) { x = x | 0; return (x * 25) | 0; }\n" |
1111 "var table1 = [func1, func2];\n" | 1128 "var table1 = [func1, func2];\n" |
1112 "function bar(x, y) { x = x | 0; y = y | 0;\n" | 1129 "function bar(x, y) { x = x | 0; y = y | 0;\n" |
1113 " return table1[x & 1](y)|0; }\n" | 1130 " return table1[x & 1](y)|0; }\n" |
1114 "function foo() { bar(1, 2); }") { | 1131 "function foo() { bar(1, 2); }") { |
1115 CHECK_EXPR(FunctionLiteral, FUNC_I2I_TYPE) { | 1132 CHECK_EXPR(FunctionLiteral, FUNC_I2I_TYPE) { |
1116 CHECK_EXPR(Assignment, Bounds(cache.kInt32)) { | 1133 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { |
1117 CHECK_VAR(x, Bounds(cache.kInt32)); | 1134 CHECK_VAR(x, Bounds(cache.kAsmInt)); |
1118 CHECK_EXPR(BinaryOperation, Bounds(cache.kInt32)) { | 1135 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { |
1119 CHECK_VAR(x, Bounds(cache.kInt32)); | 1136 CHECK_VAR(x, Bounds(cache.kAsmInt)); |
1120 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 1137 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
1121 } | 1138 } |
1122 } | 1139 } |
1123 CHECK_EXPR(BinaryOperation, Bounds(cache.kInt32)) { | 1140 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { |
1124 CHECK_EXPR(BinaryOperation, Bounds(cache.kInt32)) { | 1141 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmInt)) { |
1125 CHECK_VAR(x, Bounds(cache.kInt32)); | 1142 CHECK_VAR(x, Bounds(cache.kAsmInt)); |
1126 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 1143 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
1127 } | 1144 } |
1128 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 1145 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
1129 } | 1146 } |
1130 } | 1147 } |
1131 CHECK_EXPR(FunctionLiteral, FUNC_I2I_TYPE) { | 1148 CHECK_EXPR(FunctionLiteral, FUNC_I2I_TYPE) { |
1132 CHECK_EXPR(Assignment, Bounds(cache.kInt32)) { | 1149 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { |
1133 CHECK_VAR(x, Bounds(cache.kInt32)); | 1150 CHECK_VAR(x, Bounds(cache.kAsmInt)); |
1134 CHECK_EXPR(BinaryOperation, Bounds(cache.kInt32)) { | 1151 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { |
1135 CHECK_VAR(x, Bounds(cache.kInt32)); | 1152 CHECK_VAR(x, Bounds(cache.kAsmInt)); |
1136 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 1153 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
1137 } | 1154 } |
1138 } | 1155 } |
1139 CHECK_EXPR(BinaryOperation, Bounds(cache.kInt32)) { | 1156 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { |
1140 CHECK_EXPR(BinaryOperation, Bounds(cache.kInt32)) { | 1157 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmInt)) { |
1141 CHECK_VAR(x, Bounds(cache.kInt32)); | 1158 CHECK_VAR(x, Bounds(cache.kAsmInt)); |
1142 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 1159 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
1143 } | 1160 } |
1144 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 1161 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
1145 } | 1162 } |
1146 } | 1163 } |
1147 CHECK_EXPR(FunctionLiteral, FUNC_II2I_TYPE) { | 1164 CHECK_EXPR(FunctionLiteral, FUNC_II2I_TYPE) { |
1148 CHECK_EXPR(Assignment, Bounds(cache.kInt32)) { | 1165 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { |
1149 CHECK_VAR(x, Bounds(cache.kInt32)); | 1166 CHECK_VAR(x, Bounds(cache.kAsmInt)); |
1150 CHECK_EXPR(BinaryOperation, Bounds(cache.kInt32)) { | 1167 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { |
1151 CHECK_VAR(x, Bounds(cache.kInt32)); | 1168 CHECK_VAR(x, Bounds(cache.kAsmInt)); |
1152 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 1169 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
1153 } | 1170 } |
1154 } | 1171 } |
1155 CHECK_EXPR(Assignment, Bounds(cache.kInt32)) { | 1172 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { |
1156 CHECK_VAR(y, Bounds(cache.kInt32)); | 1173 CHECK_VAR(y, Bounds(cache.kAsmInt)); |
1157 CHECK_EXPR(BinaryOperation, Bounds(cache.kInt32)) { | 1174 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { |
1158 CHECK_VAR(y, Bounds(cache.kInt32)); | 1175 CHECK_VAR(y, Bounds(cache.kAsmInt)); |
1159 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 1176 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
1160 } | 1177 } |
1161 } | 1178 } |
1162 CHECK_EXPR(BinaryOperation, Bounds(cache.kInt32)) { | 1179 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { |
1163 CHECK_EXPR(Call, Bounds(cache.kInt32)) { | 1180 CHECK_EXPR(Call, Bounds(cache.kAsmSigned)) { |
1164 CHECK_EXPR(Property, FUNC_I2I_TYPE) { | 1181 CHECK_EXPR(Property, FUNC_I2I_TYPE) { |
1165 CHECK_VAR(table1, FUNC_I2I_ARRAY_TYPE); | 1182 CHECK_VAR(table1, FUNC_I2I_ARRAY_TYPE); |
1166 CHECK_EXPR(BinaryOperation, Bounds(cache.kInt32)) { | 1183 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { |
1167 CHECK_VAR(x, Bounds(cache.kInt32)); | 1184 CHECK_VAR(x, Bounds(cache.kAsmSigned)); |
1168 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 1185 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
1169 } | 1186 } |
1170 } | 1187 } |
1171 CHECK_VAR(y, Bounds(cache.kInt32)); | 1188 CHECK_VAR(y, Bounds(cache.kAsmInt)); |
1172 } | 1189 } |
1173 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 1190 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
1174 } | 1191 } |
1175 } | 1192 } |
1176 CHECK_SKIP(); | 1193 CHECK_SKIP(); |
1177 } | 1194 } |
1178 CHECK_FUNC_TYPES_END_1(); | 1195 CHECK_FUNC_TYPES_END_1(); |
1179 CHECK_EXPR(Assignment, FUNC_I2I_ARRAY_TYPE) { | 1196 CHECK_EXPR(Assignment, FUNC_I2I_ARRAY_TYPE) { |
1180 CHECK_VAR(table1, FUNC_I2I_ARRAY_TYPE); | 1197 CHECK_VAR(table1, FUNC_I2I_ARRAY_TYPE); |
1181 CHECK_EXPR(ArrayLiteral, FUNC_I2I_ARRAY_TYPE) { | 1198 CHECK_EXPR(ArrayLiteral, FUNC_I2I_ARRAY_TYPE) { |
1182 CHECK_VAR(func1, FUNC_I2I_TYPE); | 1199 CHECK_VAR(func1, FUNC_I2I_TYPE); |
1183 CHECK_VAR(func2, FUNC_I2I_TYPE); | 1200 CHECK_VAR(func2, FUNC_I2I_TYPE); |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1333 "asm: line 39: illegal literal\n"); | 1350 "asm: line 39: illegal literal\n"); |
1334 } | 1351 } |
1335 | 1352 |
1336 | 1353 |
1337 TEST(ForeignFunction) { | 1354 TEST(ForeignFunction) { |
1338 CHECK_FUNC_TYPES_BEGIN( | 1355 CHECK_FUNC_TYPES_BEGIN( |
1339 "var baz = foreign.baz;\n" | 1356 "var baz = foreign.baz;\n" |
1340 "function bar() { return baz(1, 2)|0; }\n" | 1357 "function bar() { return baz(1, 2)|0; }\n" |
1341 "function foo() { bar(); }") { | 1358 "function foo() { bar(); }") { |
1342 CHECK_EXPR(FunctionLiteral, FUNC_I_TYPE) { | 1359 CHECK_EXPR(FunctionLiteral, FUNC_I_TYPE) { |
1343 CHECK_EXPR(BinaryOperation, Bounds(cache.kInt32)) { | 1360 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { |
1344 CHECK_EXPR(Call, Bounds(Type::Number(zone))) { | 1361 CHECK_EXPR(Call, Bounds(Type::Number(zone))) { |
1345 CHECK_VAR(baz, Bounds(Type::Any())); | 1362 CHECK_VAR(baz, Bounds(Type::Any())); |
1346 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 1363 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
1347 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 1364 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
1348 } | 1365 } |
1349 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 1366 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
1350 } | 1367 } |
1351 } | 1368 } |
1352 CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { | 1369 CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { |
1353 CHECK_EXPR(Call, Bounds(cache.kInt32)) { CHECK_VAR(bar, FUNC_I_TYPE); } | 1370 CHECK_EXPR(Call, Bounds(cache.kAsmSigned)) { |
| 1371 CHECK_VAR(bar, FUNC_I_TYPE); |
| 1372 } |
1354 } | 1373 } |
1355 } | 1374 } |
1356 CHECK_FUNC_TYPES_END_1() | 1375 CHECK_FUNC_TYPES_END_1() |
1357 CHECK_EXPR(Assignment, Bounds(Type::Any())) { | 1376 CHECK_EXPR(Assignment, Bounds(Type::Any())) { |
1358 CHECK_VAR(baz, Bounds(Type::Any())); | 1377 CHECK_VAR(baz, Bounds(Type::Any())); |
1359 CHECK_EXPR(Property, Bounds(Type::Any())) { | 1378 CHECK_EXPR(Property, Bounds(Type::Any())) { |
1360 CHECK_VAR(foreign, Bounds::Unbounded()); | 1379 CHECK_VAR(foreign, Bounds::Unbounded()); |
1361 CHECK_EXPR(Literal, Bounds::Unbounded()); | 1380 CHECK_EXPR(Literal, Bounds::Unbounded()); |
1362 } | 1381 } |
1363 } | 1382 } |
1364 CHECK_FUNC_TYPES_END_2() | 1383 CHECK_FUNC_TYPES_END_2() |
1365 } | 1384 } |
1366 | 1385 |
1367 | 1386 |
1368 TEST(BadExports) { | 1387 TEST(BadExports) { |
1369 HARNESS_PREAMBLE() | 1388 HARNESS_PREAMBLE() |
1370 "function foo() {};\n" | 1389 "function foo() {};\n" |
1371 "return {foo: foo, bar: 1};" | 1390 "return {foo: foo, bar: 1};" |
1372 "}\n"; | 1391 "}\n"; |
1373 | 1392 |
1374 v8::V8::Initialize(); | 1393 v8::V8::Initialize(); |
1375 HandleAndZoneScope handles; | 1394 HandleAndZoneScope handles; |
1376 Zone* zone = handles.main_zone(); | 1395 Zone* zone = handles.main_zone(); |
1377 ZoneVector<ExpressionTypeEntry> types(zone); | 1396 ZoneVector<ExpressionTypeEntry> types(zone); |
1378 CHECK_EQ("asm: line 40: non-function in function table\n", | 1397 CHECK_EQ("asm: line 40: non-function in function table\n", |
1379 Validate(zone, test_function, &types)); | 1398 Validate(zone, test_function, &types)); |
1380 } | 1399 } |
OLD | NEW |