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/ast.h" | 10 #include "src/ast/ast.h" |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 CHECK_VAR(stdlib, Bounds::Unbounded()); \ | 393 CHECK_VAR(stdlib, Bounds::Unbounded()); \ |
394 CHECK_EXPR(Literal, Bounds::Unbounded()); \ | 394 CHECK_EXPR(Literal, Bounds::Unbounded()); \ |
395 } \ | 395 } \ |
396 CHECK_VAR(buffer, Bounds::Unbounded()); \ | 396 CHECK_VAR(buffer, Bounds::Unbounded()); \ |
397 } \ | 397 } \ |
398 } | 398 } |
399 | 399 |
400 | 400 |
401 namespace { | 401 namespace { |
402 | 402 |
403 void CheckStdlibShortcuts(Zone* zone, ZoneVector<ExpressionTypeEntry>& types, | 403 void CheckStdlibShortcuts1(Zone* zone, ZoneVector<ExpressionTypeEntry>& types, |
404 size_t& index, int& depth, TypeCache& cache) { | 404 size_t& index, int& depth, TypeCache& cache) { |
405 // var exp = stdlib.*; (D * 12) | 405 // var exp = stdlib.*; (D * 12) |
406 CHECK_VAR_SHORTCUT(Infinity, Bounds(cache.kAsmDouble)); | 406 CHECK_VAR_SHORTCUT(Infinity, Bounds(cache.kAsmDouble)); |
407 CHECK_VAR_SHORTCUT(NaN, Bounds(cache.kAsmDouble)); | 407 CHECK_VAR_SHORTCUT(NaN, Bounds(cache.kAsmDouble)); |
408 // var x = stdlib.Math.x; D2D | 408 // var x = stdlib.Math.x; D2D |
409 CHECK_VAR_MATH_SHORTCUT(acos, FUNC_D2D_TYPE); | 409 CHECK_VAR_MATH_SHORTCUT(acos, FUNC_D2D_TYPE); |
410 CHECK_VAR_MATH_SHORTCUT(asin, FUNC_D2D_TYPE); | 410 CHECK_VAR_MATH_SHORTCUT(asin, FUNC_D2D_TYPE); |
411 CHECK_VAR_MATH_SHORTCUT(atan, FUNC_D2D_TYPE); | 411 CHECK_VAR_MATH_SHORTCUT(atan, FUNC_D2D_TYPE); |
412 CHECK_VAR_MATH_SHORTCUT(cos, FUNC_D2D_TYPE); | 412 CHECK_VAR_MATH_SHORTCUT(cos, FUNC_D2D_TYPE); |
413 CHECK_VAR_MATH_SHORTCUT(sin, FUNC_D2D_TYPE); | 413 CHECK_VAR_MATH_SHORTCUT(sin, FUNC_D2D_TYPE); |
414 CHECK_VAR_MATH_SHORTCUT(tan, FUNC_D2D_TYPE); | 414 CHECK_VAR_MATH_SHORTCUT(tan, FUNC_D2D_TYPE); |
415 CHECK_VAR_MATH_SHORTCUT(exp, FUNC_D2D_TYPE); | 415 CHECK_VAR_MATH_SHORTCUT(exp, FUNC_D2D_TYPE); |
416 CHECK_VAR_MATH_SHORTCUT(log, FUNC_D2D_TYPE); | 416 CHECK_VAR_MATH_SHORTCUT(log, FUNC_D2D_TYPE); |
417 CHECK_VAR_MATH_SHORTCUT(ceil, FUNC_D2D_TYPE); | 417 CHECK_VAR_MATH_SHORTCUT(ceil, FUNC_D2D_TYPE); |
418 CHECK_VAR_MATH_SHORTCUT(floor, FUNC_D2D_TYPE); | 418 CHECK_VAR_MATH_SHORTCUT(floor, FUNC_D2D_TYPE); |
419 CHECK_VAR_MATH_SHORTCUT(sqrt, FUNC_D2D_TYPE); | 419 CHECK_VAR_MATH_SHORTCUT(sqrt, FUNC_D2D_TYPE); |
420 // var exp = stdlib.Math.*; (DD2D * 12) | 420 // var exp = stdlib.Math.*; (DD2D * 12) |
421 CHECK_VAR_MATH_SHORTCUT(min, FUNC_DD2D_TYPE); | 421 CHECK_VAR_MATH_SHORTCUT(min, FUNC_DD2D_TYPE); |
422 CHECK_VAR_MATH_SHORTCUT(max, FUNC_DD2D_TYPE); | 422 CHECK_VAR_MATH_SHORTCUT(max, FUNC_DD2D_TYPE); |
423 CHECK_VAR_MATH_SHORTCUT(atan2, FUNC_DD2D_TYPE); | 423 CHECK_VAR_MATH_SHORTCUT(atan2, FUNC_DD2D_TYPE); |
424 CHECK_VAR_MATH_SHORTCUT(pow, FUNC_DD2D_TYPE); | 424 CHECK_VAR_MATH_SHORTCUT(pow, FUNC_DD2D_TYPE); |
425 // Special ones. | 425 // Special ones. |
426 CHECK_VAR_MATH_SHORTCUT(abs, FUNC_N2N_TYPE); | 426 CHECK_VAR_MATH_SHORTCUT(abs, FUNC_N2N_TYPE); |
427 CHECK_VAR_MATH_SHORTCUT(imul, FUNC_II2I_TYPE); | 427 CHECK_VAR_MATH_SHORTCUT(imul, FUNC_II2I_TYPE); |
428 CHECK_VAR_MATH_SHORTCUT(fround, FUNC_N2F_TYPE); | 428 CHECK_VAR_MATH_SHORTCUT(fround, FUNC_N2F_TYPE); |
| 429 } |
| 430 |
| 431 |
| 432 void CheckStdlibShortcuts2(Zone* zone, ZoneVector<ExpressionTypeEntry>& types, |
| 433 size_t& index, int& depth, TypeCache& cache) { |
429 // var exp = stdlib.Math.*; (D * 12) | 434 // var exp = stdlib.Math.*; (D * 12) |
430 CHECK_VAR_MATH_SHORTCUT(E, Bounds(cache.kAsmDouble)); | 435 CHECK_VAR_MATH_SHORTCUT(E, Bounds(cache.kAsmDouble)); |
431 CHECK_VAR_MATH_SHORTCUT(LN10, Bounds(cache.kAsmDouble)); | 436 CHECK_VAR_MATH_SHORTCUT(LN10, Bounds(cache.kAsmDouble)); |
432 CHECK_VAR_MATH_SHORTCUT(LN2, Bounds(cache.kAsmDouble)); | 437 CHECK_VAR_MATH_SHORTCUT(LN2, Bounds(cache.kAsmDouble)); |
433 CHECK_VAR_MATH_SHORTCUT(LOG2E, Bounds(cache.kAsmDouble)); | 438 CHECK_VAR_MATH_SHORTCUT(LOG2E, Bounds(cache.kAsmDouble)); |
434 CHECK_VAR_MATH_SHORTCUT(LOG10E, Bounds(cache.kAsmDouble)); | 439 CHECK_VAR_MATH_SHORTCUT(LOG10E, Bounds(cache.kAsmDouble)); |
435 CHECK_VAR_MATH_SHORTCUT(PI, Bounds(cache.kAsmDouble)); | 440 CHECK_VAR_MATH_SHORTCUT(PI, Bounds(cache.kAsmDouble)); |
436 CHECK_VAR_MATH_SHORTCUT(SQRT1_2, Bounds(cache.kAsmDouble)); | 441 CHECK_VAR_MATH_SHORTCUT(SQRT1_2, Bounds(cache.kAsmDouble)); |
437 CHECK_VAR_MATH_SHORTCUT(SQRT2, Bounds(cache.kAsmDouble)); | 442 CHECK_VAR_MATH_SHORTCUT(SQRT2, Bounds(cache.kAsmDouble)); |
438 // var values = new stdlib.*Array(buffer); | 443 // var values = new stdlib.*Array(buffer); |
(...skipping 17 matching lines...) Expand all Loading... |
456 v8::V8::Initialize(); \ | 461 v8::V8::Initialize(); \ |
457 HandleAndZoneScope handles; \ | 462 HandleAndZoneScope handles; \ |
458 Zone* zone = handles.main_zone(); \ | 463 Zone* zone = handles.main_zone(); \ |
459 ZoneVector<ExpressionTypeEntry> types(zone); \ | 464 ZoneVector<ExpressionTypeEntry> types(zone); \ |
460 CHECK_EQ("", Validate(zone, test_function, &types)); \ | 465 CHECK_EQ("", Validate(zone, test_function, &types)); \ |
461 TypeCache cache; \ | 466 TypeCache cache; \ |
462 \ | 467 \ |
463 CHECK_TYPES_BEGIN { \ | 468 CHECK_TYPES_BEGIN { \ |
464 /* Module. */ \ | 469 /* Module. */ \ |
465 CHECK_EXPR(FunctionLiteral, Bounds::Unbounded()) { | 470 CHECK_EXPR(FunctionLiteral, Bounds::Unbounded()) { |
466 #define CHECK_FUNC_TYPES_END_1() \ | 471 #define CHECK_FUNC_TYPES_END_1() \ |
467 /* "use asm"; */ \ | 472 /* "use asm"; */ \ |
468 CHECK_EXPR(Literal, Bounds(Type::String(zone))); \ | 473 CHECK_EXPR(Literal, Bounds(Type::String(zone))); \ |
469 /* stdlib shortcuts. */ \ | 474 /* stdlib shortcuts. */ \ |
470 CheckStdlibShortcuts(zone, types, index, depth, cache); | 475 CheckStdlibShortcuts1(zone, types, index, depth, cache); \ |
| 476 CheckStdlibShortcuts2(zone, types, index, depth, cache); |
471 | 477 |
472 | 478 |
473 #define CHECK_FUNC_TYPES_END_2() \ | 479 #define CHECK_FUNC_TYPES_END_2() \ |
474 /* return { foo: foo }; */ \ | 480 /* return { foo: foo }; */ \ |
475 CHECK_EXPR(ObjectLiteral, Bounds::Unbounded()) { \ | 481 CHECK_EXPR(ObjectLiteral, Bounds::Unbounded()) { \ |
476 CHECK_VAR(foo, FUNC_V_TYPE); \ | 482 CHECK_VAR(foo, FUNC_V_TYPE); \ |
477 } \ | 483 } \ |
478 } \ | 484 } \ |
479 } \ | 485 } \ |
480 CHECK_TYPES_END | 486 CHECK_TYPES_END |
(...skipping 1337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1818 CHECK(!cache.kAsmFloat->Is(cache.kAsmFixnum)); | 1824 CHECK(!cache.kAsmFloat->Is(cache.kAsmFixnum)); |
1819 CHECK(!cache.kAsmFloat->Is(cache.kAsmDouble)); | 1825 CHECK(!cache.kAsmFloat->Is(cache.kAsmDouble)); |
1820 | 1826 |
1821 CHECK(cache.kAsmDouble->Is(cache.kAsmDouble)); | 1827 CHECK(cache.kAsmDouble->Is(cache.kAsmDouble)); |
1822 CHECK(!cache.kAsmDouble->Is(cache.kAsmInt)); | 1828 CHECK(!cache.kAsmDouble->Is(cache.kAsmInt)); |
1823 CHECK(!cache.kAsmDouble->Is(cache.kAsmUnsigned)); | 1829 CHECK(!cache.kAsmDouble->Is(cache.kAsmUnsigned)); |
1824 CHECK(!cache.kAsmDouble->Is(cache.kAsmSigned)); | 1830 CHECK(!cache.kAsmDouble->Is(cache.kAsmSigned)); |
1825 CHECK(!cache.kAsmDouble->Is(cache.kAsmFixnum)); | 1831 CHECK(!cache.kAsmDouble->Is(cache.kAsmFixnum)); |
1826 CHECK(!cache.kAsmDouble->Is(cache.kAsmFloat)); | 1832 CHECK(!cache.kAsmDouble->Is(cache.kAsmFloat)); |
1827 } | 1833 } |
OLD | NEW |