OLD | NEW |
1 // Copyright 2012 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 |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 | 422 |
423 Zone* HBasicBlock::zone() const { return graph_->zone(); } | 423 Zone* HBasicBlock::zone() const { return graph_->zone(); } |
424 | 424 |
425 | 425 |
426 // Type of stack frame an environment might refer to. | 426 // Type of stack frame an environment might refer to. |
427 enum FrameType { | 427 enum FrameType { |
428 JS_FUNCTION, | 428 JS_FUNCTION, |
429 JS_CONSTRUCT, | 429 JS_CONSTRUCT, |
430 JS_GETTER, | 430 JS_GETTER, |
431 JS_SETTER, | 431 JS_SETTER, |
432 ARGUMENTS_ADAPTOR | 432 ARGUMENTS_ADAPTOR, |
| 433 STUB |
433 }; | 434 }; |
434 | 435 |
435 | 436 |
436 class HEnvironment: public ZoneObject { | 437 class HEnvironment: public ZoneObject { |
437 public: | 438 public: |
438 HEnvironment(HEnvironment* outer, | 439 HEnvironment(HEnvironment* outer, |
439 Scope* scope, | 440 Scope* scope, |
440 Handle<JSFunction> closure, | 441 Handle<JSFunction> closure, |
441 Zone* zone); | 442 Zone* zone); |
442 | 443 |
| 444 explicit HEnvironment(Zone* zone); |
| 445 |
443 HEnvironment* arguments_environment() { | 446 HEnvironment* arguments_environment() { |
444 return outer()->frame_type() == ARGUMENTS_ADAPTOR ? outer() : this; | 447 return outer()->frame_type() == ARGUMENTS_ADAPTOR ? outer() : this; |
445 } | 448 } |
446 | 449 |
447 // Simple accessors. | 450 // Simple accessors. |
448 Handle<JSFunction> closure() const { return closure_; } | 451 Handle<JSFunction> closure() const { return closure_; } |
449 const ZoneList<HValue*>* values() const { return &values_; } | 452 const ZoneList<HValue*>* values() const { return &values_; } |
450 const ZoneList<int>* assigned_variables() const { | 453 const ZoneList<int>* assigned_variables() const { |
451 return &assigned_variables_; | 454 return &assigned_variables_; |
452 } | 455 } |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 | 632 |
630 private: | 633 private: |
631 Zone* zone() const { return graph_->zone(); } | 634 Zone* zone() const { return graph_->zone(); } |
632 | 635 |
633 HGraph* graph_; | 636 HGraph* graph_; |
634 ZoneList<HValue*> worklist_; | 637 ZoneList<HValue*> worklist_; |
635 BitVector in_worklist_; | 638 BitVector in_worklist_; |
636 }; | 639 }; |
637 | 640 |
638 | 641 |
639 class HGraphBuilder; | 642 class HOptimizedGraphBuilder; |
640 | 643 |
641 enum ArgumentsAllowedFlag { | 644 enum ArgumentsAllowedFlag { |
642 ARGUMENTS_NOT_ALLOWED, | 645 ARGUMENTS_NOT_ALLOWED, |
643 ARGUMENTS_ALLOWED | 646 ARGUMENTS_ALLOWED |
644 }; | 647 }; |
645 | 648 |
646 // This class is not BASE_EMBEDDED because our inlining implementation uses | 649 // This class is not BASE_EMBEDDED because our inlining implementation uses |
647 // new and delete. | 650 // new and delete. |
648 class AstContext { | 651 class AstContext { |
649 public: | 652 public: |
(...skipping 15 matching lines...) Expand all Loading... |
665 // Finishes the current basic block and materialize a boolean for | 668 // Finishes the current basic block and materialize a boolean for |
666 // value context, nothing for effect, generate a branch for test context. | 669 // value context, nothing for effect, generate a branch for test context. |
667 // Call this function in tail position in the Visit functions for | 670 // Call this function in tail position in the Visit functions for |
668 // expressions. | 671 // expressions. |
669 virtual void ReturnControl(HControlInstruction* instr, BailoutId ast_id) = 0; | 672 virtual void ReturnControl(HControlInstruction* instr, BailoutId ast_id) = 0; |
670 | 673 |
671 void set_for_typeof(bool for_typeof) { for_typeof_ = for_typeof; } | 674 void set_for_typeof(bool for_typeof) { for_typeof_ = for_typeof; } |
672 bool is_for_typeof() { return for_typeof_; } | 675 bool is_for_typeof() { return for_typeof_; } |
673 | 676 |
674 protected: | 677 protected: |
675 AstContext(HGraphBuilder* owner, Expression::Context kind); | 678 AstContext(HOptimizedGraphBuilder* owner, Expression::Context kind); |
676 virtual ~AstContext(); | 679 virtual ~AstContext(); |
677 | 680 |
678 HGraphBuilder* owner() const { return owner_; } | 681 HOptimizedGraphBuilder* owner() const { return owner_; } |
679 | 682 |
680 inline Zone* zone() const; | 683 inline Zone* zone() const; |
681 | 684 |
682 // We want to be able to assert, in a context-specific way, that the stack | 685 // We want to be able to assert, in a context-specific way, that the stack |
683 // height makes sense when the context is filled. | 686 // height makes sense when the context is filled. |
684 #ifdef DEBUG | 687 #ifdef DEBUG |
685 int original_length_; | 688 int original_length_; |
686 #endif | 689 #endif |
687 | 690 |
688 private: | 691 private: |
689 HGraphBuilder* owner_; | 692 HOptimizedGraphBuilder* owner_; |
690 Expression::Context kind_; | 693 Expression::Context kind_; |
691 AstContext* outer_; | 694 AstContext* outer_; |
692 bool for_typeof_; | 695 bool for_typeof_; |
693 }; | 696 }; |
694 | 697 |
695 | 698 |
696 class EffectContext: public AstContext { | 699 class EffectContext: public AstContext { |
697 public: | 700 public: |
698 explicit EffectContext(HGraphBuilder* owner) | 701 explicit EffectContext(HOptimizedGraphBuilder* owner) |
699 : AstContext(owner, Expression::kEffect) { | 702 : AstContext(owner, Expression::kEffect) { |
700 } | 703 } |
701 virtual ~EffectContext(); | 704 virtual ~EffectContext(); |
702 | 705 |
703 virtual void ReturnValue(HValue* value); | 706 virtual void ReturnValue(HValue* value); |
704 virtual void ReturnInstruction(HInstruction* instr, BailoutId ast_id); | 707 virtual void ReturnInstruction(HInstruction* instr, BailoutId ast_id); |
705 virtual void ReturnControl(HControlInstruction* instr, BailoutId ast_id); | 708 virtual void ReturnControl(HControlInstruction* instr, BailoutId ast_id); |
706 }; | 709 }; |
707 | 710 |
708 | 711 |
709 class ValueContext: public AstContext { | 712 class ValueContext: public AstContext { |
710 public: | 713 public: |
711 explicit ValueContext(HGraphBuilder* owner, ArgumentsAllowedFlag flag) | 714 ValueContext(HOptimizedGraphBuilder* owner, ArgumentsAllowedFlag flag) |
712 : AstContext(owner, Expression::kValue), flag_(flag) { | 715 : AstContext(owner, Expression::kValue), flag_(flag) { |
713 } | 716 } |
714 virtual ~ValueContext(); | 717 virtual ~ValueContext(); |
715 | 718 |
716 virtual void ReturnValue(HValue* value); | 719 virtual void ReturnValue(HValue* value); |
717 virtual void ReturnInstruction(HInstruction* instr, BailoutId ast_id); | 720 virtual void ReturnInstruction(HInstruction* instr, BailoutId ast_id); |
718 virtual void ReturnControl(HControlInstruction* instr, BailoutId ast_id); | 721 virtual void ReturnControl(HControlInstruction* instr, BailoutId ast_id); |
719 | 722 |
720 bool arguments_allowed() { return flag_ == ARGUMENTS_ALLOWED; } | 723 bool arguments_allowed() { return flag_ == ARGUMENTS_ALLOWED; } |
721 | 724 |
722 private: | 725 private: |
723 ArgumentsAllowedFlag flag_; | 726 ArgumentsAllowedFlag flag_; |
724 }; | 727 }; |
725 | 728 |
726 | 729 |
727 class TestContext: public AstContext { | 730 class TestContext: public AstContext { |
728 public: | 731 public: |
729 TestContext(HGraphBuilder* owner, | 732 TestContext(HOptimizedGraphBuilder* owner, |
730 Expression* condition, | 733 Expression* condition, |
731 TypeFeedbackOracle* oracle, | 734 TypeFeedbackOracle* oracle, |
732 HBasicBlock* if_true, | 735 HBasicBlock* if_true, |
733 HBasicBlock* if_false) | 736 HBasicBlock* if_false) |
734 : AstContext(owner, Expression::kTest), | 737 : AstContext(owner, Expression::kTest), |
735 condition_(condition), | 738 condition_(condition), |
736 oracle_(oracle), | 739 oracle_(oracle), |
737 if_true_(if_true), | 740 if_true_(if_true), |
738 if_false_(if_false) { | 741 if_false_(if_false) { |
739 } | 742 } |
(...skipping 19 matching lines...) Expand all Loading... |
759 | 762 |
760 Expression* condition_; | 763 Expression* condition_; |
761 TypeFeedbackOracle* oracle_; | 764 TypeFeedbackOracle* oracle_; |
762 HBasicBlock* if_true_; | 765 HBasicBlock* if_true_; |
763 HBasicBlock* if_false_; | 766 HBasicBlock* if_false_; |
764 }; | 767 }; |
765 | 768 |
766 | 769 |
767 class FunctionState { | 770 class FunctionState { |
768 public: | 771 public: |
769 FunctionState(HGraphBuilder* owner, | 772 FunctionState(HOptimizedGraphBuilder* owner, |
770 CompilationInfo* info, | 773 CompilationInfo* info, |
771 TypeFeedbackOracle* oracle, | 774 TypeFeedbackOracle* oracle, |
772 InliningKind inlining_kind); | 775 InliningKind inlining_kind); |
773 ~FunctionState(); | 776 ~FunctionState(); |
774 | 777 |
775 CompilationInfo* compilation_info() { return compilation_info_; } | 778 CompilationInfo* compilation_info() { return compilation_info_; } |
776 TypeFeedbackOracle* oracle() { return oracle_; } | 779 TypeFeedbackOracle* oracle() { return oracle_; } |
777 AstContext* call_context() { return call_context_; } | 780 AstContext* call_context() { return call_context_; } |
778 InliningKind inlining_kind() const { return inlining_kind_; } | 781 InliningKind inlining_kind() const { return inlining_kind_; } |
779 HBasicBlock* function_return() { return function_return_; } | 782 HBasicBlock* function_return() { return function_return_; } |
780 TestContext* test_context() { return test_context_; } | 783 TestContext* test_context() { return test_context_; } |
781 void ClearInlinedTestContext() { | 784 void ClearInlinedTestContext() { |
782 delete test_context_; | 785 delete test_context_; |
783 test_context_ = NULL; | 786 test_context_ = NULL; |
784 } | 787 } |
785 | 788 |
786 FunctionState* outer() { return outer_; } | 789 FunctionState* outer() { return outer_; } |
787 | 790 |
788 HEnterInlined* entry() { return entry_; } | 791 HEnterInlined* entry() { return entry_; } |
789 void set_entry(HEnterInlined* entry) { entry_ = entry; } | 792 void set_entry(HEnterInlined* entry) { entry_ = entry; } |
790 | 793 |
791 HArgumentsElements* arguments_elements() { return arguments_elements_; } | 794 HArgumentsElements* arguments_elements() { return arguments_elements_; } |
792 void set_arguments_elements(HArgumentsElements* arguments_elements) { | 795 void set_arguments_elements(HArgumentsElements* arguments_elements) { |
793 arguments_elements_ = arguments_elements; | 796 arguments_elements_ = arguments_elements; |
794 } | 797 } |
795 | 798 |
796 bool arguments_pushed() { return arguments_elements() != NULL; } | 799 bool arguments_pushed() { return arguments_elements() != NULL; } |
797 | 800 |
798 private: | 801 private: |
799 HGraphBuilder* owner_; | 802 HOptimizedGraphBuilder* owner_; |
800 | 803 |
801 CompilationInfo* compilation_info_; | 804 CompilationInfo* compilation_info_; |
802 TypeFeedbackOracle* oracle_; | 805 TypeFeedbackOracle* oracle_; |
803 | 806 |
804 // During function inlining, expression context of the call being | 807 // During function inlining, expression context of the call being |
805 // inlined. NULL when not inlining. | 808 // inlined. NULL when not inlining. |
806 AstContext* call_context_; | 809 AstContext* call_context_; |
807 | 810 |
808 // The kind of call which is currently being inlined. | 811 // The kind of call which is currently being inlined. |
809 InliningKind inlining_kind_; | 812 InliningKind inlining_kind_; |
(...skipping 11 matching lines...) Expand all Loading... |
821 // When inlining HEnterInlined instruction corresponding to the function | 824 // When inlining HEnterInlined instruction corresponding to the function |
822 // entry. | 825 // entry. |
823 HEnterInlined* entry_; | 826 HEnterInlined* entry_; |
824 | 827 |
825 HArgumentsElements* arguments_elements_; | 828 HArgumentsElements* arguments_elements_; |
826 | 829 |
827 FunctionState* outer_; | 830 FunctionState* outer_; |
828 }; | 831 }; |
829 | 832 |
830 | 833 |
831 class HGraphBuilder: public AstVisitor { | 834 class HGraphBuilder { |
| 835 public: |
| 836 explicit HGraphBuilder(CompilationInfo* info) |
| 837 : info_(info), graph_(NULL), current_block_(NULL) {} |
| 838 virtual ~HGraphBuilder() {} |
| 839 |
| 840 HBasicBlock* current_block() const { return current_block_; } |
| 841 void set_current_block(HBasicBlock* block) { current_block_ = block; } |
| 842 HEnvironment* environment() const { |
| 843 return current_block()->last_environment(); |
| 844 } |
| 845 Zone* zone() const { return info_->zone(); } |
| 846 HGraph* graph() { return graph_; } |
| 847 |
| 848 HGraph* CreateGraph(); |
| 849 |
| 850 // Adding instructions. |
| 851 HInstruction* AddInstruction(HInstruction* instr); |
| 852 void AddSimulate(BailoutId id, |
| 853 RemovableSimulate removable = FIXED_SIMULATE); |
| 854 |
| 855 protected: |
| 856 virtual bool BuildGraph() = 0; |
| 857 |
| 858 // Building common constructs |
| 859 HInstruction* BuildExternalArrayElementAccess( |
| 860 HValue* external_elements, |
| 861 HValue* checked_key, |
| 862 HValue* val, |
| 863 HValue* dependency, |
| 864 ElementsKind elements_kind, |
| 865 bool is_store); |
| 866 |
| 867 HInstruction* BuildFastElementAccess( |
| 868 HValue* elements, |
| 869 HValue* checked_key, |
| 870 HValue* val, |
| 871 HValue* dependency, |
| 872 ElementsKind elements_kind, |
| 873 bool is_store); |
| 874 |
| 875 HInstruction* BuildUncheckedMonomorphicElementAccess( |
| 876 HValue* object, |
| 877 HValue* key, |
| 878 HValue* val, |
| 879 HCheckMaps* mapcheck, |
| 880 bool is_js_array, |
| 881 ElementsKind elements_kind, |
| 882 bool is_store); |
| 883 |
| 884 private: |
| 885 HGraphBuilder(); |
| 886 CompilationInfo* info_; |
| 887 HGraph* graph_; |
| 888 HBasicBlock* current_block_; |
| 889 }; |
| 890 |
| 891 |
| 892 class HOptimizedGraphBuilder: public HGraphBuilder, public AstVisitor { |
832 public: | 893 public: |
833 enum BreakType { BREAK, CONTINUE }; | 894 enum BreakType { BREAK, CONTINUE }; |
834 enum SwitchType { UNKNOWN_SWITCH, SMI_SWITCH, STRING_SWITCH }; | 895 enum SwitchType { UNKNOWN_SWITCH, SMI_SWITCH, STRING_SWITCH }; |
835 | 896 |
836 // A class encapsulating (lazily-allocated) break and continue blocks for | 897 // A class encapsulating (lazily-allocated) break and continue blocks for |
837 // a breakable statement. Separated from BreakAndContinueScope so that it | 898 // a breakable statement. Separated from BreakAndContinueScope so that it |
838 // can have a separate lifetime. | 899 // can have a separate lifetime. |
839 class BreakAndContinueInfo BASE_EMBEDDED { | 900 class BreakAndContinueInfo BASE_EMBEDDED { |
840 public: | 901 public: |
841 explicit BreakAndContinueInfo(BreakableStatement* target, | 902 explicit BreakAndContinueInfo(BreakableStatement* target, |
(...skipping 15 matching lines...) Expand all Loading... |
857 BreakableStatement* target_; | 918 BreakableStatement* target_; |
858 HBasicBlock* break_block_; | 919 HBasicBlock* break_block_; |
859 HBasicBlock* continue_block_; | 920 HBasicBlock* continue_block_; |
860 int drop_extra_; | 921 int drop_extra_; |
861 }; | 922 }; |
862 | 923 |
863 // A helper class to maintain a stack of current BreakAndContinueInfo | 924 // A helper class to maintain a stack of current BreakAndContinueInfo |
864 // structures mirroring BreakableStatement nesting. | 925 // structures mirroring BreakableStatement nesting. |
865 class BreakAndContinueScope BASE_EMBEDDED { | 926 class BreakAndContinueScope BASE_EMBEDDED { |
866 public: | 927 public: |
867 BreakAndContinueScope(BreakAndContinueInfo* info, HGraphBuilder* owner) | 928 BreakAndContinueScope(BreakAndContinueInfo* info, |
| 929 HOptimizedGraphBuilder* owner) |
868 : info_(info), owner_(owner), next_(owner->break_scope()) { | 930 : info_(info), owner_(owner), next_(owner->break_scope()) { |
869 owner->set_break_scope(this); | 931 owner->set_break_scope(this); |
870 } | 932 } |
871 | 933 |
872 ~BreakAndContinueScope() { owner_->set_break_scope(next_); } | 934 ~BreakAndContinueScope() { owner_->set_break_scope(next_); } |
873 | 935 |
874 BreakAndContinueInfo* info() { return info_; } | 936 BreakAndContinueInfo* info() { return info_; } |
875 HGraphBuilder* owner() { return owner_; } | 937 HOptimizedGraphBuilder* owner() { return owner_; } |
876 BreakAndContinueScope* next() { return next_; } | 938 BreakAndContinueScope* next() { return next_; } |
877 | 939 |
878 // Search the break stack for a break or continue target. | 940 // Search the break stack for a break or continue target. |
879 HBasicBlock* Get(BreakableStatement* stmt, BreakType type, int* drop_extra); | 941 HBasicBlock* Get(BreakableStatement* stmt, BreakType type, int* drop_extra); |
880 | 942 |
881 private: | 943 private: |
882 BreakAndContinueInfo* info_; | 944 BreakAndContinueInfo* info_; |
883 HGraphBuilder* owner_; | 945 HOptimizedGraphBuilder* owner_; |
884 BreakAndContinueScope* next_; | 946 BreakAndContinueScope* next_; |
885 }; | 947 }; |
886 | 948 |
887 HGraphBuilder(CompilationInfo* info, TypeFeedbackOracle* oracle); | 949 HOptimizedGraphBuilder(CompilationInfo* info, TypeFeedbackOracle* oracle); |
888 | 950 |
889 HGraph* CreateGraph(); | 951 virtual bool BuildGraph(); |
890 | 952 |
891 // Simple accessors. | 953 // Simple accessors. |
892 HGraph* graph() const { return graph_; } | |
893 BreakAndContinueScope* break_scope() const { return break_scope_; } | 954 BreakAndContinueScope* break_scope() const { return break_scope_; } |
894 void set_break_scope(BreakAndContinueScope* head) { break_scope_ = head; } | 955 void set_break_scope(BreakAndContinueScope* head) { break_scope_ = head; } |
895 | 956 |
896 HBasicBlock* current_block() const { return current_block_; } | |
897 void set_current_block(HBasicBlock* block) { current_block_ = block; } | |
898 HEnvironment* environment() const { | |
899 return current_block()->last_environment(); | |
900 } | |
901 | |
902 bool inline_bailout() { return inline_bailout_; } | 957 bool inline_bailout() { return inline_bailout_; } |
903 | 958 |
904 // Adding instructions. | |
905 HInstruction* AddInstruction(HInstruction* instr); | |
906 void AddSimulate(BailoutId ast_id, | |
907 RemovableSimulate removable = FIXED_SIMULATE); | |
908 | |
909 // Bailout environment manipulation. | 959 // Bailout environment manipulation. |
910 void Push(HValue* value) { environment()->Push(value); } | 960 void Push(HValue* value) { environment()->Push(value); } |
911 HValue* Pop() { return environment()->Pop(); } | 961 HValue* Pop() { return environment()->Pop(); } |
912 | 962 |
913 void Bailout(const char* reason); | 963 void Bailout(const char* reason); |
914 | 964 |
915 HBasicBlock* CreateJoin(HBasicBlock* first, | 965 HBasicBlock* CreateJoin(HBasicBlock* first, |
916 HBasicBlock* second, | 966 HBasicBlock* second, |
917 BailoutId join_id); | 967 BailoutId join_id); |
918 | 968 |
919 TypeFeedbackOracle* oracle() const { return function_state()->oracle(); } | 969 TypeFeedbackOracle* oracle() const { return function_state()->oracle(); } |
920 | 970 |
921 FunctionState* function_state() const { return function_state_; } | 971 FunctionState* function_state() const { return function_state_; } |
922 | 972 |
923 void VisitDeclarations(ZoneList<Declaration*>* declarations); | 973 void VisitDeclarations(ZoneList<Declaration*>* declarations); |
924 | 974 |
925 void* operator new(size_t size, Zone* zone) { | 975 void* operator new(size_t size, Zone* zone) { |
926 return zone->New(static_cast<int>(size)); | 976 return zone->New(static_cast<int>(size)); |
927 } | 977 } |
928 void operator delete(void* pointer, Zone* zone) { } | 978 void operator delete(void* pointer, Zone* zone) { } |
929 void operator delete(void* pointer) { } | 979 void operator delete(void* pointer) { } |
930 | 980 |
| 981 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); |
| 982 |
931 private: | 983 private: |
932 // Type of a member function that generates inline code for a native function. | 984 // Type of a member function that generates inline code for a native function. |
933 typedef void (HGraphBuilder::*InlineFunctionGenerator)(CallRuntime* call); | 985 typedef void (HOptimizedGraphBuilder::*InlineFunctionGenerator) |
| 986 (CallRuntime* call); |
934 | 987 |
935 // Forward declarations for inner scope classes. | 988 // Forward declarations for inner scope classes. |
936 class SubgraphScope; | 989 class SubgraphScope; |
937 | 990 |
938 static const InlineFunctionGenerator kInlineFunctionGenerators[]; | 991 static const InlineFunctionGenerator kInlineFunctionGenerators[]; |
939 | 992 |
940 static const int kMaxCallPolymorphism = 4; | 993 static const int kMaxCallPolymorphism = 4; |
941 static const int kMaxLoadPolymorphism = 4; | 994 static const int kMaxLoadPolymorphism = 4; |
942 static const int kMaxStorePolymorphism = 4; | 995 static const int kMaxStorePolymorphism = 4; |
943 | 996 |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1132 NilValue nil); | 1185 NilValue nil); |
1133 | 1186 |
1134 HStringCharCodeAt* BuildStringCharCodeAt(HValue* context, | 1187 HStringCharCodeAt* BuildStringCharCodeAt(HValue* context, |
1135 HValue* string, | 1188 HValue* string, |
1136 HValue* index); | 1189 HValue* index); |
1137 HInstruction* BuildBinaryOperation(BinaryOperation* expr, | 1190 HInstruction* BuildBinaryOperation(BinaryOperation* expr, |
1138 HValue* left, | 1191 HValue* left, |
1139 HValue* right); | 1192 HValue* right); |
1140 HInstruction* BuildIncrement(bool returns_original_input, | 1193 HInstruction* BuildIncrement(bool returns_original_input, |
1141 CountOperation* expr); | 1194 CountOperation* expr); |
1142 HInstruction* BuildFastElementAccess(HValue* elements, | 1195 HInstruction* BuildLoadKeyedGeneric(HValue* object, |
1143 HValue* checked_key, | 1196 HValue* key); |
1144 HValue* val, | |
1145 HValue* dependency, | |
1146 ElementsKind elements_kind, | |
1147 bool is_store); | |
1148 | 1197 |
1149 HInstruction* TryBuildConsolidatedElementLoad(HValue* object, | 1198 HInstruction* TryBuildConsolidatedElementLoad(HValue* object, |
1150 HValue* key, | 1199 HValue* key, |
1151 HValue* val, | 1200 HValue* val, |
1152 SmallMapList* maps); | 1201 SmallMapList* maps); |
1153 | 1202 |
1154 HInstruction* BuildUncheckedMonomorphicElementAccess(HValue* object, | |
1155 HValue* key, | |
1156 HValue* val, | |
1157 HCheckMaps* mapcheck, | |
1158 Handle<Map> map, | |
1159 bool is_store); | |
1160 | |
1161 HInstruction* BuildMonomorphicElementAccess(HValue* object, | 1203 HInstruction* BuildMonomorphicElementAccess(HValue* object, |
1162 HValue* key, | 1204 HValue* key, |
1163 HValue* val, | 1205 HValue* val, |
1164 HValue* dependency, | 1206 HValue* dependency, |
1165 Handle<Map> map, | 1207 Handle<Map> map, |
1166 bool is_store); | 1208 bool is_store); |
1167 | 1209 |
1168 HValue* HandlePolymorphicElementAccess(HValue* object, | 1210 HValue* HandlePolymorphicElementAccess(HValue* object, |
1169 HValue* key, | 1211 HValue* key, |
1170 HValue* val, | 1212 HValue* val, |
(...skipping 19 matching lines...) Expand all Loading... |
1190 Handle<String> name, | 1232 Handle<String> name, |
1191 Property* expr); | 1233 Property* expr); |
1192 HInstruction* BuildCallGetter(HValue* object, | 1234 HInstruction* BuildCallGetter(HValue* object, |
1193 Handle<Map> map, | 1235 Handle<Map> map, |
1194 Handle<JSFunction> getter, | 1236 Handle<JSFunction> getter, |
1195 Handle<JSObject> holder); | 1237 Handle<JSObject> holder); |
1196 HInstruction* BuildLoadNamedMonomorphic(HValue* object, | 1238 HInstruction* BuildLoadNamedMonomorphic(HValue* object, |
1197 Handle<String> name, | 1239 Handle<String> name, |
1198 Property* expr, | 1240 Property* expr, |
1199 Handle<Map> map); | 1241 Handle<Map> map); |
1200 HInstruction* BuildLoadKeyedGeneric(HValue* object, HValue* key); | |
1201 HInstruction* BuildExternalArrayElementAccess( | |
1202 HValue* external_elements, | |
1203 HValue* checked_key, | |
1204 HValue* val, | |
1205 HValue* dependency, | |
1206 ElementsKind elements_kind, | |
1207 bool is_store); | |
1208 | 1242 |
1209 void AddCheckMapsWithTransitions(HValue* object, | 1243 void AddCheckMapsWithTransitions(HValue* object, |
1210 Handle<Map> map); | 1244 Handle<Map> map); |
1211 | 1245 |
1212 HInstruction* BuildStoreNamedField(HValue* object, | 1246 HInstruction* BuildStoreNamedField(HValue* object, |
1213 Handle<String> name, | 1247 Handle<String> name, |
1214 HValue* value, | 1248 HValue* value, |
1215 Handle<Map> map, | 1249 Handle<Map> map, |
1216 LookupResult* lookup); | 1250 LookupResult* lookup); |
1217 HInstruction* BuildStoreNamedGeneric(HValue* object, | 1251 HInstruction* BuildStoreNamedGeneric(HValue* object, |
(...skipping 21 matching lines...) Expand all Loading... |
1239 | 1273 |
1240 void AddCheckConstantFunction(Handle<JSObject> holder, | 1274 void AddCheckConstantFunction(Handle<JSObject> holder, |
1241 HValue* receiver, | 1275 HValue* receiver, |
1242 Handle<Map> receiver_map); | 1276 Handle<Map> receiver_map); |
1243 | 1277 |
1244 bool MatchRotateRight(HValue* left, | 1278 bool MatchRotateRight(HValue* left, |
1245 HValue* right, | 1279 HValue* right, |
1246 HValue** operand, | 1280 HValue** operand, |
1247 HValue** shift_amount); | 1281 HValue** shift_amount); |
1248 | 1282 |
1249 Zone* zone() const { return zone_; } | |
1250 | |
1251 // The translation state of the currently-being-translated function. | 1283 // The translation state of the currently-being-translated function. |
1252 FunctionState* function_state_; | 1284 FunctionState* function_state_; |
1253 | 1285 |
1254 // The base of the function state stack. | 1286 // The base of the function state stack. |
1255 FunctionState initial_function_state_; | 1287 FunctionState initial_function_state_; |
1256 | 1288 |
1257 // Expression context of the currently visited subexpression. NULL when | 1289 // Expression context of the currently visited subexpression. NULL when |
1258 // visiting statements. | 1290 // visiting statements. |
1259 AstContext* ast_context_; | 1291 AstContext* ast_context_; |
1260 | 1292 |
1261 // A stack of breakable statements entered. | 1293 // A stack of breakable statements entered. |
1262 BreakAndContinueScope* break_scope_; | 1294 BreakAndContinueScope* break_scope_; |
1263 | 1295 |
1264 HGraph* graph_; | |
1265 HBasicBlock* current_block_; | |
1266 | |
1267 int inlined_count_; | 1296 int inlined_count_; |
1268 ZoneList<Handle<Object> > globals_; | 1297 ZoneList<Handle<Object> > globals_; |
1269 | 1298 |
1270 Zone* zone_; | |
1271 | |
1272 bool inline_bailout_; | 1299 bool inline_bailout_; |
1273 | 1300 |
1274 friend class FunctionState; // Pushes and pops the state stack. | 1301 friend class FunctionState; // Pushes and pops the state stack. |
1275 friend class AstContext; // Pushes and pops the AST context stack. | 1302 friend class AstContext; // Pushes and pops the AST context stack. |
| 1303 friend class KeyedLoadFastElementStub; |
1276 | 1304 |
1277 DISALLOW_COPY_AND_ASSIGN(HGraphBuilder); | 1305 DISALLOW_COPY_AND_ASSIGN(HOptimizedGraphBuilder); |
1278 }; | 1306 }; |
1279 | 1307 |
1280 | 1308 |
1281 Zone* AstContext::zone() const { return owner_->zone(); } | 1309 Zone* AstContext::zone() const { return owner_->zone(); } |
1282 | 1310 |
1283 | 1311 |
1284 class HValueMap: public ZoneObject { | 1312 class HValueMap: public ZoneObject { |
1285 public: | 1313 public: |
1286 explicit HValueMap(Zone* zone) | 1314 explicit HValueMap(Zone* zone) |
1287 : array_size_(0), | 1315 : array_size_(0), |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1440 const char* name_; | 1468 const char* name_; |
1441 HGraph* graph_; | 1469 HGraph* graph_; |
1442 LChunk* chunk_; | 1470 LChunk* chunk_; |
1443 LAllocator* allocator_; | 1471 LAllocator* allocator_; |
1444 unsigned start_allocation_size_; | 1472 unsigned start_allocation_size_; |
1445 }; | 1473 }; |
1446 | 1474 |
1447 | 1475 |
1448 class HTracer: public Malloced { | 1476 class HTracer: public Malloced { |
1449 public: | 1477 public: |
1450 void TraceCompilation(FunctionLiteral* function); | 1478 void TraceCompilation(CompilationInfo* info); |
1451 void TraceHydrogen(const char* name, HGraph* graph); | 1479 void TraceHydrogen(const char* name, HGraph* graph); |
1452 void TraceLithium(const char* name, LChunk* chunk); | 1480 void TraceLithium(const char* name, LChunk* chunk); |
1453 void TraceLiveRanges(const char* name, LAllocator* allocator); | 1481 void TraceLiveRanges(const char* name, LAllocator* allocator); |
1454 | 1482 |
1455 static HTracer* Instance() { | 1483 static HTracer* Instance() { |
1456 static SetOncePointer<HTracer> instance; | 1484 static SetOncePointer<HTracer> instance; |
1457 if (!instance.is_set()) { | 1485 if (!instance.is_set()) { |
1458 instance.set(new HTracer("hydrogen.cfg")); | 1486 instance.set(new HTracer("hydrogen.cfg")); |
1459 } | 1487 } |
1460 return instance.get(); | 1488 return instance.get(); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1527 const char* filename_; | 1555 const char* filename_; |
1528 HeapStringAllocator string_allocator_; | 1556 HeapStringAllocator string_allocator_; |
1529 StringStream trace_; | 1557 StringStream trace_; |
1530 int indent_; | 1558 int indent_; |
1531 }; | 1559 }; |
1532 | 1560 |
1533 | 1561 |
1534 } } // namespace v8::internal | 1562 } } // namespace v8::internal |
1535 | 1563 |
1536 #endif // V8_HYDROGEN_H_ | 1564 #endif // V8_HYDROGEN_H_ |
OLD | NEW |