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 <stdlib.h> | 8 #include <stdlib.h> |
9 | 9 |
10 #include "src/v8.h" | 10 #include "src/v8.h" |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 // return { geometricMean: geometricMean }; | 266 // return { geometricMean: geometricMean }; |
267 CHECK_EXPR(ObjectLiteral, Bounds::Unbounded()) { | 267 CHECK_EXPR(ObjectLiteral, Bounds::Unbounded()) { |
268 CHECK_VAR(geometricMean, Bounds::Unbounded()); | 268 CHECK_VAR(geometricMean, Bounds::Unbounded()); |
269 } | 269 } |
270 } | 270 } |
271 } | 271 } |
272 CHECK_TYPES_END | 272 CHECK_TYPES_END |
273 } | 273 } |
274 | 274 |
275 | 275 |
| 276 TEST(VisitConditional) { |
| 277 v8::V8::Initialize(); |
| 278 HandleAndZoneScope handles; |
| 279 ZoneVector<ExpressionTypeEntry> types(handles.main_zone()); |
| 280 // Check that traversing the ternary operator works. |
| 281 const char test_function[] = |
| 282 "function foo() {\n" |
| 283 " var a, b, c;\n" |
| 284 " var x = a ? b : c;\n" |
| 285 "}\n"; |
| 286 CollectTypes(&handles, test_function, &types); |
| 287 CHECK_TYPES_BEGIN { |
| 288 CHECK_EXPR(FunctionLiteral, Bounds::Unbounded()) { |
| 289 CHECK_EXPR(Assignment, Bounds::Unbounded()) { |
| 290 CHECK_VAR(x, Bounds::Unbounded()); |
| 291 CHECK_EXPR(Conditional, Bounds::Unbounded()) { |
| 292 CHECK_VAR(a, Bounds::Unbounded()); |
| 293 CHECK_VAR(b, Bounds::Unbounded()); |
| 294 CHECK_VAR(c, Bounds::Unbounded()); |
| 295 } |
| 296 } |
| 297 } |
| 298 } |
| 299 CHECK_TYPES_END |
| 300 } |
| 301 |
| 302 |
276 TEST(VisitEmptyForStatment) { | 303 TEST(VisitEmptyForStatment) { |
277 v8::V8::Initialize(); | 304 v8::V8::Initialize(); |
278 HandleAndZoneScope handles; | 305 HandleAndZoneScope handles; |
279 ZoneVector<ExpressionTypeEntry> types(handles.main_zone()); | 306 ZoneVector<ExpressionTypeEntry> types(handles.main_zone()); |
280 // Check that traversing an empty for statement works. | 307 // Check that traversing an empty for statement works. |
281 const char test_function[] = | 308 const char test_function[] = |
282 "function foo() {\n" | 309 "function foo() {\n" |
283 " for (;;) {}\n" | 310 " for (;;) {}\n" |
284 "}\n"; | 311 "}\n"; |
285 CollectTypes(&handles, test_function, &types); | 312 CollectTypes(&handles, test_function, &types); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 CHECK_EXPR(FunctionLiteral, Bounds::Unbounded()) { | 413 CHECK_EXPR(FunctionLiteral, Bounds::Unbounded()) { |
387 CHECK_EXPR(BinaryOperation, Bounds::Unbounded()) { | 414 CHECK_EXPR(BinaryOperation, Bounds::Unbounded()) { |
388 // Skip x + x | 415 // Skip x + x |
389 CHECK_SKIP(); | 416 CHECK_SKIP(); |
390 CHECK_EXPR(Literal, Bounds::Unbounded()); | 417 CHECK_EXPR(Literal, Bounds::Unbounded()); |
391 } | 418 } |
392 } | 419 } |
393 } | 420 } |
394 CHECK_TYPES_END | 421 CHECK_TYPES_END |
395 } | 422 } |
OLD | NEW |