OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
11 // with the distribution. | 11 // with the distribution. |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 int FunctionLiteral::end_position() const { | 167 int FunctionLiteral::end_position() const { |
168 return scope()->end_position(); | 168 return scope()->end_position(); |
169 } | 169 } |
170 | 170 |
171 | 171 |
172 LanguageMode FunctionLiteral::language_mode() const { | 172 LanguageMode FunctionLiteral::language_mode() const { |
173 return scope()->language_mode(); | 173 return scope()->language_mode(); |
174 } | 174 } |
175 | 175 |
176 | 176 |
| 177 bool FunctionLiteral::ShouldSelfOptimize() { |
| 178 AstNodeType::Flag types = 0; |
| 179 int node_count = 0; |
| 180 CollectInfo(&types, &node_count); |
| 181 return (types & (AstNodeType::kContainsBackEdgesMask | |
| 182 AstNodeType::kContainsCallsMask | |
| 183 AstNodeType::kPreventsOptimizationMask)) == 0; |
| 184 } |
| 185 |
| 186 |
| 187 int FunctionLiteral::AstNodeCount() { |
| 188 AstNodeType::Flag types = 0; |
| 189 int node_count = 0; |
| 190 CollectInfo(&types, &node_count); |
| 191 return node_count; |
| 192 } |
| 193 |
| 194 |
177 ObjectLiteral::Property::Property(Literal* key, Expression* value) { | 195 ObjectLiteral::Property::Property(Literal* key, Expression* value) { |
178 emit_store_ = true; | 196 emit_store_ = true; |
179 key_ = key; | 197 key_ = key; |
180 value_ = value; | 198 value_ = value; |
181 Object* k = *key->handle(); | 199 Object* k = *key->handle(); |
182 if (k->IsSymbol() && HEAP->Proto_symbol()->Equals(String::cast(k))) { | 200 if (k->IsSymbol() && HEAP->Proto_symbol()->Equals(String::cast(k))) { |
183 kind_ = PROTOTYPE; | 201 kind_ = PROTOTYPE; |
184 } else if (value_->AsMaterializedLiteral() != NULL) { | 202 } else if (value_->AsMaterializedLiteral() != NULL) { |
185 kind_ = MATERIALIZED_LITERAL; | 203 kind_ = MATERIALIZED_LITERAL; |
186 } else if (value_->AsLiteral() != NULL) { | 204 } else if (value_->AsLiteral() != NULL) { |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 | 437 |
420 | 438 |
421 // ---------------------------------------------------------------------------- | 439 // ---------------------------------------------------------------------------- |
422 // Inlining support | 440 // Inlining support |
423 | 441 |
424 bool Declaration::IsInlineable() const { | 442 bool Declaration::IsInlineable() const { |
425 return proxy()->var()->IsStackAllocated() && fun() == NULL; | 443 return proxy()->var()->IsStackAllocated() && fun() == NULL; |
426 } | 444 } |
427 | 445 |
428 | 446 |
| 447 void Declaration::CollectInfo(AstNodeType::Flag* flags, |
| 448 int* node_count) const { |
| 449 proxy()->CollectInfo(flags, node_count); |
| 450 *node_count += 1; |
| 451 } |
| 452 |
| 453 |
429 bool TargetCollector::IsInlineable() const { | 454 bool TargetCollector::IsInlineable() const { |
430 UNREACHABLE(); | 455 UNREACHABLE(); |
431 return false; | 456 return false; |
432 } | 457 } |
433 | 458 |
434 | 459 |
435 bool ForInStatement::IsInlineable() const { | 460 bool ForInStatement::IsInlineable() const { |
436 return false; | 461 return false; |
437 } | 462 } |
438 | 463 |
439 | 464 |
| 465 void ForInStatement::CollectInfo(AstNodeType::Flag* flags, |
| 466 int* node_count) const { |
| 467 *flags |= AstNodeType::kForInStatementMask; |
| 468 each()->CollectInfo(flags, node_count); |
| 469 enumerable()->CollectInfo(flags, node_count); |
| 470 body()->CollectInfo(flags, node_count); |
| 471 *node_count += 1; |
| 472 } |
| 473 |
| 474 |
440 bool WithStatement::IsInlineable() const { | 475 bool WithStatement::IsInlineable() const { |
441 return false; | 476 return false; |
442 } | 477 } |
443 | 478 |
444 | 479 |
| 480 void WithStatement::CollectInfo(AstNodeType::Flag* flags, |
| 481 int* node_count) const { |
| 482 *flags |= AstNodeType::kWithStatementMask; |
| 483 expression()->CollectInfo(flags, node_count); |
| 484 statement()->CollectInfo(flags, node_count); |
| 485 *node_count += 1; |
| 486 } |
| 487 |
| 488 |
445 bool SwitchStatement::IsInlineable() const { | 489 bool SwitchStatement::IsInlineable() const { |
446 return false; | 490 return false; |
447 } | 491 } |
448 | 492 |
449 | 493 |
| 494 void SwitchStatement::CollectInfo(AstNodeType::Flag* flags, |
| 495 int* node_count) const { |
| 496 *flags |= AstNodeType::kSwitchStatementMask; |
| 497 tag()->CollectInfo(flags, node_count); |
| 498 for (int i = 0; i < cases()->length(); ++i) { |
| 499 CaseClause* clause(cases()->at(i)); |
| 500 if (!clause->is_default()) { |
| 501 clause->label()->CollectInfo(flags, node_count); |
| 502 } |
| 503 for (int j = 0; j < clause->statements()->length(); ++j) { |
| 504 clause->statements()->at(j)->CollectInfo(flags, node_count); |
| 505 } |
| 506 } |
| 507 *node_count += 1; |
| 508 } |
| 509 |
| 510 |
450 bool TryStatement::IsInlineable() const { | 511 bool TryStatement::IsInlineable() const { |
451 return false; | 512 return false; |
452 } | 513 } |
453 | 514 |
454 | 515 |
455 bool TryCatchStatement::IsInlineable() const { | 516 void TryCatchStatement::CollectInfo(AstNodeType::Flag* flags, |
456 return false; | 517 int* node_count) const { |
| 518 *flags |= AstNodeType::kTryCatchStatementMask; |
| 519 try_block()->CollectInfo(flags, node_count); |
| 520 catch_block()->CollectInfo(flags, node_count); |
| 521 *node_count += 1; |
457 } | 522 } |
458 | 523 |
459 | 524 |
460 bool TryFinallyStatement::IsInlineable() const { | 525 void TryFinallyStatement::CollectInfo(AstNodeType::Flag* flags, |
461 return false; | 526 int* node_count) const { |
| 527 *flags |= AstNodeType::kTryFinallyStatementMask; |
| 528 try_block()->CollectInfo(flags, node_count); |
| 529 finally_block()->CollectInfo(flags, node_count); |
| 530 *node_count += 1; |
462 } | 531 } |
463 | 532 |
464 | 533 |
465 bool DebuggerStatement::IsInlineable() const { | 534 bool DebuggerStatement::IsInlineable() const { |
466 return false; | 535 return false; |
467 } | 536 } |
468 | 537 |
469 | 538 |
| 539 void DebuggerStatement::CollectInfo(AstNodeType::Flag* flags, |
| 540 int* node_count) const { |
| 541 *flags |= AstNodeType::kDebuggerStatementMask; |
| 542 *node_count += 1; |
| 543 } |
| 544 |
| 545 |
470 bool Throw::IsInlineable() const { | 546 bool Throw::IsInlineable() const { |
471 return exception()->IsInlineable(); | 547 return exception()->IsInlineable(); |
472 } | 548 } |
473 | 549 |
474 | 550 |
| 551 void Throw::CollectInfo(AstNodeType::Flag* flags, int* node_count) const { |
| 552 *flags |= AstNodeType::kThrowMask; |
| 553 exception()->CollectInfo(flags, node_count); |
| 554 *node_count += 1; |
| 555 } |
| 556 |
| 557 |
475 bool MaterializedLiteral::IsInlineable() const { | 558 bool MaterializedLiteral::IsInlineable() const { |
476 // TODO(1322): Allow materialized literals. | 559 // TODO(1322): Allow materialized literals. |
477 return false; | 560 return false; |
478 } | 561 } |
479 | 562 |
480 | 563 |
| 564 void ObjectLiteral::CollectInfo(AstNodeType::Flag* flags, |
| 565 int* node_count) const { |
| 566 *flags |= AstNodeType::kObjectLiteralMask; |
| 567 for (int i = 0; i < properties()->length(); ++i) { |
| 568 properties()->at(i)->key()->CollectInfo(flags, node_count); |
| 569 properties()->at(i)->value()->CollectInfo(flags, node_count); |
| 570 } |
| 571 *node_count += 1; |
| 572 } |
| 573 |
| 574 |
| 575 void RegExpLiteral::CollectInfo(AstNodeType::Flag* flags, |
| 576 int* node_count) const { |
| 577 *flags |= AstNodeType::kRegExpLiteralMask; |
| 578 *node_count += 1; |
| 579 } |
| 580 |
| 581 |
| 582 void ArrayLiteral::CollectInfo(AstNodeType::Flag* flags, |
| 583 int* node_count) const { |
| 584 *flags |= AstNodeType::kArrayLiteralMask; |
| 585 for (int i = 0; i < values()->length(); ++i) { |
| 586 values()->at(i)->CollectInfo(flags, node_count); |
| 587 } |
| 588 *node_count += 1; |
| 589 } |
| 590 |
| 591 |
481 bool FunctionLiteral::IsInlineable() const { | 592 bool FunctionLiteral::IsInlineable() const { |
482 // TODO(1322): Allow materialized literals. | 593 // TODO(1322): Allow materialized literals. |
483 return false; | 594 return false; |
484 } | 595 } |
485 | 596 |
486 | 597 |
| 598 void FunctionLiteral::CollectInfo(AstNodeType::Flag* flags, |
| 599 int* node_count) const { |
| 600 *flags |= AstNodeType::kFunctionLiteralMask; |
| 601 if (scope()->declarations() != NULL) { |
| 602 for (int i = 0; i < scope()->declarations()->length(); ++i) { |
| 603 scope()->declarations()->at(i)->CollectInfo(flags, node_count); |
| 604 } |
| 605 } |
| 606 if (body() != NULL) { |
| 607 for (int i = 0; i < body()->length(); ++i) { |
| 608 body()->at(i)->CollectInfo(flags, node_count); |
| 609 } |
| 610 } |
| 611 *node_count += 1; |
| 612 } |
| 613 |
| 614 |
487 bool ThisFunction::IsInlineable() const { | 615 bool ThisFunction::IsInlineable() const { |
488 return true; | 616 return true; |
489 } | 617 } |
490 | 618 |
491 | 619 |
| 620 void ThisFunction::CollectInfo(AstNodeType::Flag* flags, |
| 621 int* node_count) const { |
| 622 *flags |= AstNodeType::kThisFunctionMask; |
| 623 *node_count += 1; |
| 624 } |
| 625 |
| 626 |
492 bool SharedFunctionInfoLiteral::IsInlineable() const { | 627 bool SharedFunctionInfoLiteral::IsInlineable() const { |
493 return false; | 628 return false; |
494 } | 629 } |
495 | 630 |
496 | 631 |
| 632 void SharedFunctionInfoLiteral::CollectInfo(AstNodeType::Flag* flags, |
| 633 int* node_count) const { |
| 634 *flags |= AstNodeType::kSharedFunctionInfoLiteralMask; |
| 635 *node_count += 1; |
| 636 } |
| 637 |
| 638 |
497 bool ForStatement::IsInlineable() const { | 639 bool ForStatement::IsInlineable() const { |
498 return (init() == NULL || init()->IsInlineable()) | 640 return (init() == NULL || init()->IsInlineable()) |
499 && (cond() == NULL || cond()->IsInlineable()) | 641 && (cond() == NULL || cond()->IsInlineable()) |
500 && (next() == NULL || next()->IsInlineable()) | 642 && (next() == NULL || next()->IsInlineable()) |
501 && body()->IsInlineable(); | 643 && body()->IsInlineable(); |
502 } | 644 } |
503 | 645 |
504 | 646 |
| 647 void ForStatement::CollectInfo(AstNodeType::Flag* flags, |
| 648 int* node_count) const { |
| 649 *flags |= AstNodeType::kForStatementMask; |
| 650 if (init() != NULL) init()->CollectInfo(flags, node_count); |
| 651 if (cond() != NULL) cond()->CollectInfo(flags, node_count); |
| 652 if (next() != NULL) next()->CollectInfo(flags, node_count); |
| 653 body()->CollectInfo(flags, node_count); |
| 654 *node_count += 1; |
| 655 } |
| 656 |
| 657 |
505 bool WhileStatement::IsInlineable() const { | 658 bool WhileStatement::IsInlineable() const { |
506 return cond()->IsInlineable() | 659 return cond()->IsInlineable() |
507 && body()->IsInlineable(); | 660 && body()->IsInlineable(); |
508 } | 661 } |
509 | 662 |
510 | 663 |
| 664 void WhileStatement::CollectInfo(AstNodeType::Flag* flags, |
| 665 int* node_count) const { |
| 666 *flags |= AstNodeType::kWhileStatementMask; |
| 667 cond()->CollectInfo(flags, node_count); |
| 668 body()->CollectInfo(flags, node_count); |
| 669 *node_count += 1; |
| 670 } |
| 671 |
| 672 |
511 bool DoWhileStatement::IsInlineable() const { | 673 bool DoWhileStatement::IsInlineable() const { |
512 return cond()->IsInlineable() | 674 return cond()->IsInlineable() |
513 && body()->IsInlineable(); | 675 && body()->IsInlineable(); |
514 } | 676 } |
515 | 677 |
516 | 678 |
| 679 void DoWhileStatement::CollectInfo(AstNodeType::Flag* flags, |
| 680 int* node_count) const { |
| 681 *flags |= AstNodeType::kDoWhileStatementMask; |
| 682 cond()->CollectInfo(flags, node_count); |
| 683 body()->CollectInfo(flags, node_count); |
| 684 *node_count += 1; |
| 685 } |
| 686 |
| 687 |
517 bool ContinueStatement::IsInlineable() const { | 688 bool ContinueStatement::IsInlineable() const { |
518 return true; | 689 return true; |
519 } | 690 } |
520 | 691 |
521 | 692 |
| 693 void ContinueStatement::CollectInfo(AstNodeType::Flag* flags, |
| 694 int* node_count) const { |
| 695 *flags |= AstNodeType::kContinueStatementMask; |
| 696 *node_count += 1; |
| 697 } |
| 698 |
| 699 |
522 bool BreakStatement::IsInlineable() const { | 700 bool BreakStatement::IsInlineable() const { |
523 return true; | 701 return true; |
524 } | 702 } |
525 | 703 |
526 | 704 |
| 705 void BreakStatement::CollectInfo(AstNodeType::Flag* flags, |
| 706 int* node_count) const { |
| 707 *flags |= AstNodeType::kBreakStatementMask; |
| 708 *node_count += 1; |
| 709 } |
| 710 |
| 711 |
527 bool EmptyStatement::IsInlineable() const { | 712 bool EmptyStatement::IsInlineable() const { |
528 return true; | 713 return true; |
529 } | 714 } |
530 | 715 |
531 | 716 |
| 717 void EmptyStatement::CollectInfo(AstNodeType::Flag* flags, |
| 718 int* node_count) const { |
| 719 // Nothing to see here, move on. |
| 720 } |
| 721 |
| 722 |
532 bool Literal::IsInlineable() const { | 723 bool Literal::IsInlineable() const { |
533 return true; | 724 return true; |
534 } | 725 } |
535 | 726 |
536 | 727 |
537 bool Block::IsInlineable() const { | 728 bool Block::IsInlineable() const { |
538 const int count = statements_.length(); | 729 const int count = statements_.length(); |
539 for (int i = 0; i < count; ++i) { | 730 for (int i = 0; i < count; ++i) { |
540 if (!statements_[i]->IsInlineable()) return false; | 731 if (!statements_[i]->IsInlineable()) return false; |
541 } | 732 } |
542 return true; | 733 return true; |
543 } | 734 } |
544 | 735 |
545 | 736 |
| 737 void Block::CollectInfo(AstNodeType::Flag* flags, int* node_count) const { |
| 738 for (int i = 0; i < statements_.length(); ++i) { |
| 739 statements_[i]->CollectInfo(flags, node_count); |
| 740 } |
| 741 *node_count += 1; |
| 742 } |
| 743 |
| 744 |
546 bool ExpressionStatement::IsInlineable() const { | 745 bool ExpressionStatement::IsInlineable() const { |
547 return expression()->IsInlineable(); | 746 return expression()->IsInlineable(); |
548 } | 747 } |
549 | 748 |
550 | 749 |
| 750 void ExpressionStatement::CollectInfo(AstNodeType::Flag* flags, |
| 751 int* node_count) const { |
| 752 expression()->CollectInfo(flags, node_count); |
| 753 } |
| 754 |
| 755 |
551 bool IfStatement::IsInlineable() const { | 756 bool IfStatement::IsInlineable() const { |
552 return condition()->IsInlineable() | 757 return condition()->IsInlineable() |
553 && then_statement()->IsInlineable() | 758 && then_statement()->IsInlineable() |
554 && else_statement()->IsInlineable(); | 759 && else_statement()->IsInlineable(); |
555 } | 760 } |
556 | 761 |
557 | 762 |
| 763 void IfStatement::CollectInfo(AstNodeType::Flag* flags, |
| 764 int* node_count) const { |
| 765 *flags |= AstNodeType::kIfStatementMask; |
| 766 condition()->CollectInfo(flags, node_count); |
| 767 then_statement()->CollectInfo(flags, node_count); |
| 768 else_statement()->CollectInfo(flags, node_count); |
| 769 *node_count += 1; |
| 770 } |
| 771 |
| 772 |
| 773 |
558 bool ReturnStatement::IsInlineable() const { | 774 bool ReturnStatement::IsInlineable() const { |
559 return expression()->IsInlineable(); | 775 return expression()->IsInlineable(); |
560 } | 776 } |
561 | 777 |
562 | 778 |
| 779 void ReturnStatement::CollectInfo(AstNodeType::Flag* flags, |
| 780 int* node_count) const { |
| 781 *flags |= AstNodeType::kReturnStatementMask; |
| 782 expression()->CollectInfo(flags, node_count); |
| 783 *node_count += 1; |
| 784 } |
| 785 |
| 786 |
563 bool Conditional::IsInlineable() const { | 787 bool Conditional::IsInlineable() const { |
564 return condition()->IsInlineable() && then_expression()->IsInlineable() && | 788 return condition()->IsInlineable() && then_expression()->IsInlineable() && |
565 else_expression()->IsInlineable(); | 789 else_expression()->IsInlineable(); |
566 } | 790 } |
567 | 791 |
568 | 792 |
| 793 void Conditional::CollectInfo(AstNodeType::Flag* flags, |
| 794 int* node_count) const { |
| 795 *flags |= AstNodeType::kConditionalMask; |
| 796 condition()->CollectInfo(flags, node_count); |
| 797 then_expression()->CollectInfo(flags, node_count); |
| 798 else_expression()->CollectInfo(flags, node_count); |
| 799 *node_count += 1; |
| 800 } |
| 801 |
| 802 |
569 bool VariableProxy::IsInlineable() const { | 803 bool VariableProxy::IsInlineable() const { |
570 return var()->IsUnallocated() | 804 return var()->IsUnallocated() |
571 || var()->IsStackAllocated() | 805 || var()->IsStackAllocated() |
572 || var()->IsContextSlot(); | 806 || var()->IsContextSlot(); |
573 } | 807 } |
574 | 808 |
575 | 809 |
576 bool Assignment::IsInlineable() const { | 810 bool Assignment::IsInlineable() const { |
577 return target()->IsInlineable() && value()->IsInlineable(); | 811 return target()->IsInlineable() && value()->IsInlineable(); |
578 } | 812 } |
579 | 813 |
580 | 814 |
| 815 void Assignment::CollectInfo(AstNodeType::Flag* flags, |
| 816 int* node_count) const { |
| 817 target()->CollectInfo(flags, node_count); |
| 818 value()->CollectInfo(flags, node_count); |
| 819 *node_count += 1; |
| 820 } |
| 821 |
| 822 |
581 bool Property::IsInlineable() const { | 823 bool Property::IsInlineable() const { |
582 return obj()->IsInlineable() && key()->IsInlineable(); | 824 return obj()->IsInlineable() && key()->IsInlineable(); |
583 } | 825 } |
584 | 826 |
585 | 827 |
| 828 void Property::CollectInfo(AstNodeType::Flag* flags, |
| 829 int* node_count) const { |
| 830 *flags |= AstNodeType::kPropertyMask; |
| 831 obj()->CollectInfo(flags, node_count); |
| 832 key()->CollectInfo(flags, node_count); |
| 833 *node_count += 1; |
| 834 } |
| 835 |
| 836 |
586 bool Call::IsInlineable() const { | 837 bool Call::IsInlineable() const { |
587 if (!expression()->IsInlineable()) return false; | 838 if (!expression()->IsInlineable()) return false; |
588 const int count = arguments()->length(); | 839 const int count = arguments()->length(); |
589 for (int i = 0; i < count; ++i) { | 840 for (int i = 0; i < count; ++i) { |
590 if (!arguments()->at(i)->IsInlineable()) return false; | 841 if (!arguments()->at(i)->IsInlineable()) return false; |
591 } | 842 } |
592 return true; | 843 return true; |
593 } | 844 } |
594 | 845 |
595 | 846 |
| 847 void Call::CollectInfo(AstNodeType::Flag* flags, int* node_count) const { |
| 848 *flags |= AstNodeType::kCallMask; |
| 849 expression()->CollectInfo(flags, node_count); |
| 850 for (int i = 0; i < arguments()->length(); ++i) { |
| 851 arguments()->at(i)->CollectInfo(flags, node_count); |
| 852 } |
| 853 *node_count += 1; |
| 854 } |
| 855 |
| 856 |
596 bool CallNew::IsInlineable() const { | 857 bool CallNew::IsInlineable() const { |
597 if (!expression()->IsInlineable()) return false; | 858 if (!expression()->IsInlineable()) return false; |
598 const int count = arguments()->length(); | 859 const int count = arguments()->length(); |
599 for (int i = 0; i < count; ++i) { | 860 for (int i = 0; i < count; ++i) { |
600 if (!arguments()->at(i)->IsInlineable()) return false; | 861 if (!arguments()->at(i)->IsInlineable()) return false; |
601 } | 862 } |
602 return true; | 863 return true; |
603 } | 864 } |
604 | 865 |
605 | 866 |
| 867 void CallNew::CollectInfo(AstNodeType::Flag* flags, int* node_count) const { |
| 868 *flags |= AstNodeType::kCallNewMask; |
| 869 expression()->CollectInfo(flags, node_count); |
| 870 for (int i = 0; i < arguments()->length(); ++i) { |
| 871 arguments()->at(i)->CollectInfo(flags, node_count); |
| 872 } |
| 873 *node_count += 1; |
| 874 } |
| 875 |
| 876 |
606 bool CallRuntime::IsInlineable() const { | 877 bool CallRuntime::IsInlineable() const { |
607 // Don't try to inline JS runtime calls because we don't (currently) even | 878 // Don't try to inline JS runtime calls because we don't (currently) even |
608 // optimize them. | 879 // optimize them. |
609 if (is_jsruntime()) return false; | 880 if (is_jsruntime()) return false; |
610 // Don't inline the %_ArgumentsLength or %_Arguments because their | 881 // Don't inline the %_ArgumentsLength or %_Arguments because their |
611 // implementation will not work. There is no stack frame to get them | 882 // implementation will not work. There is no stack frame to get them |
612 // from. | 883 // from. |
613 if (function()->intrinsic_type == Runtime::INLINE && | 884 if (function()->intrinsic_type == Runtime::INLINE && |
614 (name()->IsEqualTo(CStrVector("_ArgumentsLength")) || | 885 (name()->IsEqualTo(CStrVector("_ArgumentsLength")) || |
615 name()->IsEqualTo(CStrVector("_Arguments")))) { | 886 name()->IsEqualTo(CStrVector("_Arguments")))) { |
616 return false; | 887 return false; |
617 } | 888 } |
618 const int count = arguments()->length(); | 889 const int count = arguments()->length(); |
619 for (int i = 0; i < count; ++i) { | 890 for (int i = 0; i < count; ++i) { |
620 if (!arguments()->at(i)->IsInlineable()) return false; | 891 if (!arguments()->at(i)->IsInlineable()) return false; |
621 } | 892 } |
622 return true; | 893 return true; |
623 } | 894 } |
624 | 895 |
625 | 896 |
| 897 void CallRuntime::CollectInfo(AstNodeType::Flag* flags, int* node_count) const { |
| 898 *flags |= AstNodeType::kCallRuntimeMask; |
| 899 for (int i = 0; i < arguments()->length(); ++i) { |
| 900 arguments()->at(i)->CollectInfo(flags, node_count); |
| 901 } |
| 902 *node_count += 1; |
| 903 } |
| 904 |
| 905 |
626 bool UnaryOperation::IsInlineable() const { | 906 bool UnaryOperation::IsInlineable() const { |
627 return expression()->IsInlineable(); | 907 return expression()->IsInlineable(); |
628 } | 908 } |
629 | 909 |
630 | 910 |
| 911 void UnaryOperation::CollectInfo(AstNodeType::Flag* flags, |
| 912 int* node_count) const { |
| 913 expression()->CollectInfo(flags, node_count); |
| 914 *node_count += 1; |
| 915 } |
| 916 |
| 917 |
631 bool BinaryOperation::IsInlineable() const { | 918 bool BinaryOperation::IsInlineable() const { |
632 return left()->IsInlineable() && right()->IsInlineable(); | 919 return left()->IsInlineable() && right()->IsInlineable(); |
633 } | 920 } |
634 | 921 |
635 | 922 |
| 923 void BinaryOperation::CollectInfo(AstNodeType::Flag* flags, |
| 924 int* node_count) const { |
| 925 left()->CollectInfo(flags, node_count); |
| 926 right()->CollectInfo(flags, node_count); |
| 927 *node_count += 1; |
| 928 } |
| 929 |
| 930 |
636 bool CompareOperation::IsInlineable() const { | 931 bool CompareOperation::IsInlineable() const { |
637 return left()->IsInlineable() && right()->IsInlineable(); | 932 return left()->IsInlineable() && right()->IsInlineable(); |
638 } | 933 } |
639 | 934 |
640 | 935 |
| 936 void CompareOperation::CollectInfo(AstNodeType::Flag* flags, |
| 937 int* node_count) const { |
| 938 left()->CollectInfo(flags, node_count); |
| 939 right()->CollectInfo(flags, node_count); |
| 940 *node_count += 1; |
| 941 } |
| 942 |
| 943 |
641 bool CountOperation::IsInlineable() const { | 944 bool CountOperation::IsInlineable() const { |
642 return expression()->IsInlineable(); | 945 return expression()->IsInlineable(); |
643 } | 946 } |
644 | 947 |
645 | 948 |
| 949 void CountOperation::CollectInfo(AstNodeType::Flag* flags, |
| 950 int* node_count) const { |
| 951 expression()->CollectInfo(flags, node_count); |
| 952 *node_count += 1; |
| 953 } |
| 954 |
| 955 |
646 // ---------------------------------------------------------------------------- | 956 // ---------------------------------------------------------------------------- |
647 // Recording of type feedback | 957 // Recording of type feedback |
648 | 958 |
649 void Property::RecordTypeFeedback(TypeFeedbackOracle* oracle) { | 959 void Property::RecordTypeFeedback(TypeFeedbackOracle* oracle) { |
650 // Record type feedback from the oracle in the AST. | 960 // Record type feedback from the oracle in the AST. |
651 is_monomorphic_ = oracle->LoadIsMonomorphicNormal(this); | 961 is_monomorphic_ = oracle->LoadIsMonomorphicNormal(this); |
652 receiver_types_.Clear(); | 962 receiver_types_.Clear(); |
653 if (key()->IsPropertyName()) { | 963 if (key()->IsPropertyName()) { |
654 if (oracle->LoadIsBuiltin(this, Builtins::kLoadIC_ArrayLength)) { | 964 if (oracle->LoadIsBuiltin(this, Builtins::kLoadIC_ArrayLength)) { |
655 is_array_length_ = true; | 965 is_array_length_ = true; |
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1211 int pos) | 1521 int pos) |
1212 : label_(label), | 1522 : label_(label), |
1213 statements_(statements), | 1523 statements_(statements), |
1214 position_(pos), | 1524 position_(pos), |
1215 compare_type_(NONE), | 1525 compare_type_(NONE), |
1216 compare_id_(AstNode::GetNextId(isolate)), | 1526 compare_id_(AstNode::GetNextId(isolate)), |
1217 entry_id_(AstNode::GetNextId(isolate)) { | 1527 entry_id_(AstNode::GetNextId(isolate)) { |
1218 } | 1528 } |
1219 | 1529 |
1220 } } // namespace v8::internal | 1530 } } // namespace v8::internal |
OLD | NEW |