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 explicit ValueContext(HOptimizedGraphBuilder* owner, |
Jakob Kummerow
2012/11/28 16:28:22
nit: no need for "explicit"
danno
2012/11/30 16:23:24
Done.
| |
715 ArgumentsAllowedFlag flag) | |
712 : AstContext(owner, Expression::kValue), flag_(flag) { | 716 : AstContext(owner, Expression::kValue), flag_(flag) { |
713 } | 717 } |
714 virtual ~ValueContext(); | 718 virtual ~ValueContext(); |
715 | 719 |
716 virtual void ReturnValue(HValue* value); | 720 virtual void ReturnValue(HValue* value); |
717 virtual void ReturnInstruction(HInstruction* instr, BailoutId ast_id); | 721 virtual void ReturnInstruction(HInstruction* instr, BailoutId ast_id); |
718 virtual void ReturnControl(HControlInstruction* instr, BailoutId ast_id); | 722 virtual void ReturnControl(HControlInstruction* instr, BailoutId ast_id); |
719 | 723 |
720 bool arguments_allowed() { return flag_ == ARGUMENTS_ALLOWED; } | 724 bool arguments_allowed() { return flag_ == ARGUMENTS_ALLOWED; } |
721 | 725 |
722 private: | 726 private: |
723 ArgumentsAllowedFlag flag_; | 727 ArgumentsAllowedFlag flag_; |
724 }; | 728 }; |
725 | 729 |
726 | 730 |
727 class TestContext: public AstContext { | 731 class TestContext: public AstContext { |
728 public: | 732 public: |
729 TestContext(HGraphBuilder* owner, | 733 TestContext(HOptimizedGraphBuilder* owner, |
730 Expression* condition, | 734 Expression* condition, |
731 TypeFeedbackOracle* oracle, | 735 TypeFeedbackOracle* oracle, |
732 HBasicBlock* if_true, | 736 HBasicBlock* if_true, |
733 HBasicBlock* if_false) | 737 HBasicBlock* if_false) |
734 : AstContext(owner, Expression::kTest), | 738 : AstContext(owner, Expression::kTest), |
735 condition_(condition), | 739 condition_(condition), |
736 oracle_(oracle), | 740 oracle_(oracle), |
737 if_true_(if_true), | 741 if_true_(if_true), |
738 if_false_(if_false) { | 742 if_false_(if_false) { |
739 } | 743 } |
(...skipping 19 matching lines...) Expand all Loading... | |
759 | 763 |
760 Expression* condition_; | 764 Expression* condition_; |
761 TypeFeedbackOracle* oracle_; | 765 TypeFeedbackOracle* oracle_; |
762 HBasicBlock* if_true_; | 766 HBasicBlock* if_true_; |
763 HBasicBlock* if_false_; | 767 HBasicBlock* if_false_; |
764 }; | 768 }; |
765 | 769 |
766 | 770 |
767 class FunctionState { | 771 class FunctionState { |
768 public: | 772 public: |
769 FunctionState(HGraphBuilder* owner, | 773 FunctionState(HOptimizedGraphBuilder* owner, |
770 CompilationInfo* info, | 774 CompilationInfo* info, |
771 TypeFeedbackOracle* oracle, | 775 TypeFeedbackOracle* oracle, |
772 InliningKind inlining_kind); | 776 InliningKind inlining_kind); |
773 ~FunctionState(); | 777 ~FunctionState(); |
774 | 778 |
775 CompilationInfo* compilation_info() { return compilation_info_; } | 779 CompilationInfo* compilation_info() { return compilation_info_; } |
776 TypeFeedbackOracle* oracle() { return oracle_; } | 780 TypeFeedbackOracle* oracle() { return oracle_; } |
777 AstContext* call_context() { return call_context_; } | 781 AstContext* call_context() { return call_context_; } |
778 InliningKind inlining_kind() const { return inlining_kind_; } | 782 InliningKind inlining_kind() const { return inlining_kind_; } |
779 HBasicBlock* function_return() { return function_return_; } | 783 HBasicBlock* function_return() { return function_return_; } |
780 TestContext* test_context() { return test_context_; } | 784 TestContext* test_context() { return test_context_; } |
781 void ClearInlinedTestContext() { | 785 void ClearInlinedTestContext() { |
782 delete test_context_; | 786 delete test_context_; |
783 test_context_ = NULL; | 787 test_context_ = NULL; |
784 } | 788 } |
785 | 789 |
786 FunctionState* outer() { return outer_; } | 790 FunctionState* outer() { return outer_; } |
787 | 791 |
788 HEnterInlined* entry() { return entry_; } | 792 HEnterInlined* entry() { return entry_; } |
789 void set_entry(HEnterInlined* entry) { entry_ = entry; } | 793 void set_entry(HEnterInlined* entry) { entry_ = entry; } |
790 | 794 |
791 HArgumentsElements* arguments_elements() { return arguments_elements_; } | 795 HArgumentsElements* arguments_elements() { return arguments_elements_; } |
792 void set_arguments_elements(HArgumentsElements* arguments_elements) { | 796 void set_arguments_elements(HArgumentsElements* arguments_elements) { |
793 arguments_elements_ = arguments_elements; | 797 arguments_elements_ = arguments_elements; |
794 } | 798 } |
795 | 799 |
796 bool arguments_pushed() { return arguments_elements() != NULL; } | 800 bool arguments_pushed() { return arguments_elements() != NULL; } |
797 | 801 |
798 private: | 802 private: |
799 HGraphBuilder* owner_; | 803 HOptimizedGraphBuilder* owner_; |
800 | 804 |
801 CompilationInfo* compilation_info_; | 805 CompilationInfo* compilation_info_; |
802 TypeFeedbackOracle* oracle_; | 806 TypeFeedbackOracle* oracle_; |
803 | 807 |
804 // During function inlining, expression context of the call being | 808 // During function inlining, expression context of the call being |
805 // inlined. NULL when not inlining. | 809 // inlined. NULL when not inlining. |
806 AstContext* call_context_; | 810 AstContext* call_context_; |
807 | 811 |
808 // The kind of call which is currently being inlined. | 812 // The kind of call which is currently being inlined. |
809 InliningKind inlining_kind_; | 813 InliningKind inlining_kind_; |
(...skipping 11 matching lines...) Expand all Loading... | |
821 // When inlining HEnterInlined instruction corresponding to the function | 825 // When inlining HEnterInlined instruction corresponding to the function |
822 // entry. | 826 // entry. |
823 HEnterInlined* entry_; | 827 HEnterInlined* entry_; |
824 | 828 |
825 HArgumentsElements* arguments_elements_; | 829 HArgumentsElements* arguments_elements_; |
826 | 830 |
827 FunctionState* outer_; | 831 FunctionState* outer_; |
828 }; | 832 }; |
829 | 833 |
830 | 834 |
831 class HGraphBuilder: public AstVisitor { | 835 class HGraphBuilder { |
836 public: | |
837 explicit HGraphBuilder(CompilationInfo* info) | |
838 : info_(info), graph_(NULL), current_block_(NULL) {} | |
839 virtual ~HGraphBuilder() {} | |
840 | |
841 HBasicBlock* current_block() const { return current_block_; } | |
842 void set_current_block(HBasicBlock* block) { current_block_ = block; } | |
843 HEnvironment* environment() const { | |
844 return current_block()->last_environment(); | |
845 } | |
846 Zone* zone() const { return info_->zone(); } | |
847 HGraph* graph() { return graph_; } | |
848 | |
849 HGraph* CreateGraph(); | |
850 | |
851 // Adding instructions. | |
852 HInstruction* AddInstruction(HInstruction* instr); | |
853 void AddSimulate(BailoutId id, | |
854 RemovableSimulate removable = FIXED_SIMULATE); | |
855 | |
856 protected: | |
857 virtual bool BuildGraph() = 0; | |
858 | |
859 // Building common constructs | |
860 HInstruction* BuildExternalArrayElementAccess( | |
861 HValue* external_elements, | |
862 HValue* checked_key, | |
863 HValue* val, | |
864 HValue* dependency, | |
865 ElementsKind elements_kind, | |
866 bool is_store); | |
867 | |
868 HInstruction* BuildFastElementAccess( | |
869 HValue* elements, | |
870 HValue* checked_key, | |
871 HValue* val, | |
872 HValue* dependency, | |
873 ElementsKind elements_kind, | |
874 bool is_store); | |
875 | |
876 HInstruction* BuildUncheckedMonomorphicElementAccess( | |
877 HValue* object, | |
878 HValue* key, | |
879 HValue* val, | |
880 HCheckMaps* mapcheck, | |
881 bool is_js_array, | |
882 ElementsKind elements_kind, | |
883 bool is_store); | |
884 | |
885 private: | |
886 HGraphBuilder(); | |
887 CompilationInfo* info_; | |
888 HGraph* graph_; | |
889 HBasicBlock* current_block_; | |
890 }; | |
891 | |
892 | |
893 class HOptimizedGraphBuilder: public HGraphBuilder, public AstVisitor { | |
832 public: | 894 public: |
833 enum BreakType { BREAK, CONTINUE }; | 895 enum BreakType { BREAK, CONTINUE }; |
834 enum SwitchType { UNKNOWN_SWITCH, SMI_SWITCH, STRING_SWITCH }; | 896 enum SwitchType { UNKNOWN_SWITCH, SMI_SWITCH, STRING_SWITCH }; |
835 | 897 |
836 // A class encapsulating (lazily-allocated) break and continue blocks for | 898 // A class encapsulating (lazily-allocated) break and continue blocks for |
837 // a breakable statement. Separated from BreakAndContinueScope so that it | 899 // a breakable statement. Separated from BreakAndContinueScope so that it |
838 // can have a separate lifetime. | 900 // can have a separate lifetime. |
839 class BreakAndContinueInfo BASE_EMBEDDED { | 901 class BreakAndContinueInfo BASE_EMBEDDED { |
840 public: | 902 public: |
841 explicit BreakAndContinueInfo(BreakableStatement* target, | 903 explicit BreakAndContinueInfo(BreakableStatement* target, |
(...skipping 15 matching lines...) Expand all Loading... | |
857 BreakableStatement* target_; | 919 BreakableStatement* target_; |
858 HBasicBlock* break_block_; | 920 HBasicBlock* break_block_; |
859 HBasicBlock* continue_block_; | 921 HBasicBlock* continue_block_; |
860 int drop_extra_; | 922 int drop_extra_; |
861 }; | 923 }; |
862 | 924 |
863 // A helper class to maintain a stack of current BreakAndContinueInfo | 925 // A helper class to maintain a stack of current BreakAndContinueInfo |
864 // structures mirroring BreakableStatement nesting. | 926 // structures mirroring BreakableStatement nesting. |
865 class BreakAndContinueScope BASE_EMBEDDED { | 927 class BreakAndContinueScope BASE_EMBEDDED { |
866 public: | 928 public: |
867 BreakAndContinueScope(BreakAndContinueInfo* info, HGraphBuilder* owner) | 929 BreakAndContinueScope(BreakAndContinueInfo* info, |
930 HOptimizedGraphBuilder* owner) | |
868 : info_(info), owner_(owner), next_(owner->break_scope()) { | 931 : info_(info), owner_(owner), next_(owner->break_scope()) { |
869 owner->set_break_scope(this); | 932 owner->set_break_scope(this); |
870 } | 933 } |
871 | 934 |
872 ~BreakAndContinueScope() { owner_->set_break_scope(next_); } | 935 ~BreakAndContinueScope() { owner_->set_break_scope(next_); } |
873 | 936 |
874 BreakAndContinueInfo* info() { return info_; } | 937 BreakAndContinueInfo* info() { return info_; } |
875 HGraphBuilder* owner() { return owner_; } | 938 HOptimizedGraphBuilder* owner() { return owner_; } |
876 BreakAndContinueScope* next() { return next_; } | 939 BreakAndContinueScope* next() { return next_; } |
877 | 940 |
878 // Search the break stack for a break or continue target. | 941 // Search the break stack for a break or continue target. |
879 HBasicBlock* Get(BreakableStatement* stmt, BreakType type, int* drop_extra); | 942 HBasicBlock* Get(BreakableStatement* stmt, BreakType type, int* drop_extra); |
880 | 943 |
881 private: | 944 private: |
882 BreakAndContinueInfo* info_; | 945 BreakAndContinueInfo* info_; |
883 HGraphBuilder* owner_; | 946 HOptimizedGraphBuilder* owner_; |
884 BreakAndContinueScope* next_; | 947 BreakAndContinueScope* next_; |
885 }; | 948 }; |
886 | 949 |
887 HGraphBuilder(CompilationInfo* info, TypeFeedbackOracle* oracle); | 950 HOptimizedGraphBuilder(CompilationInfo* info, TypeFeedbackOracle* oracle); |
888 | 951 |
889 HGraph* CreateGraph(); | 952 virtual bool BuildGraph(); |
890 | 953 |
891 // Simple accessors. | 954 // Simple accessors. |
892 HGraph* graph() const { return graph_; } | |
893 BreakAndContinueScope* break_scope() const { return break_scope_; } | 955 BreakAndContinueScope* break_scope() const { return break_scope_; } |
894 void set_break_scope(BreakAndContinueScope* head) { break_scope_ = head; } | 956 void set_break_scope(BreakAndContinueScope* head) { break_scope_ = head; } |
895 | 957 |
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_; } | 958 bool inline_bailout() { return inline_bailout_; } |
903 | 959 |
904 // Adding instructions. | |
905 HInstruction* AddInstruction(HInstruction* instr); | |
906 void AddSimulate(BailoutId ast_id, | |
907 RemovableSimulate removable = FIXED_SIMULATE); | |
908 | |
909 // Bailout environment manipulation. | 960 // Bailout environment manipulation. |
910 void Push(HValue* value) { environment()->Push(value); } | 961 void Push(HValue* value) { environment()->Push(value); } |
911 HValue* Pop() { return environment()->Pop(); } | 962 HValue* Pop() { return environment()->Pop(); } |
912 | 963 |
913 void Bailout(const char* reason); | 964 void Bailout(const char* reason); |
914 | 965 |
915 HBasicBlock* CreateJoin(HBasicBlock* first, | 966 HBasicBlock* CreateJoin(HBasicBlock* first, |
916 HBasicBlock* second, | 967 HBasicBlock* second, |
917 BailoutId join_id); | 968 BailoutId join_id); |
918 | 969 |
919 TypeFeedbackOracle* oracle() const { return function_state()->oracle(); } | 970 TypeFeedbackOracle* oracle() const { return function_state()->oracle(); } |
920 | 971 |
921 FunctionState* function_state() const { return function_state_; } | 972 FunctionState* function_state() const { return function_state_; } |
922 | 973 |
923 void VisitDeclarations(ZoneList<Declaration*>* declarations); | 974 void VisitDeclarations(ZoneList<Declaration*>* declarations); |
924 | 975 |
925 void* operator new(size_t size, Zone* zone) { | 976 void* operator new(size_t size, Zone* zone) { |
926 return zone->New(static_cast<int>(size)); | 977 return zone->New(static_cast<int>(size)); |
927 } | 978 } |
928 void operator delete(void* pointer, Zone* zone) { } | 979 void operator delete(void* pointer, Zone* zone) { } |
929 void operator delete(void* pointer) { } | 980 void operator delete(void* pointer) { } |
930 | 981 |
931 private: | 982 private: |
932 // Type of a member function that generates inline code for a native function. | 983 // Type of a member function that generates inline code for a native function. |
933 typedef void (HGraphBuilder::*InlineFunctionGenerator)(CallRuntime* call); | 984 typedef void (HOptimizedGraphBuilder::*InlineFunctionGenerator) |
985 (CallRuntime* call); | |
934 | 986 |
935 // Forward declarations for inner scope classes. | 987 // Forward declarations for inner scope classes. |
936 class SubgraphScope; | 988 class SubgraphScope; |
937 | 989 |
938 static const InlineFunctionGenerator kInlineFunctionGenerators[]; | 990 static const InlineFunctionGenerator kInlineFunctionGenerators[]; |
939 | 991 |
940 static const int kMaxCallPolymorphism = 4; | 992 static const int kMaxCallPolymorphism = 4; |
941 static const int kMaxLoadPolymorphism = 4; | 993 static const int kMaxLoadPolymorphism = 4; |
942 static const int kMaxStorePolymorphism = 4; | 994 static const int kMaxStorePolymorphism = 4; |
943 | 995 |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1132 NilValue nil); | 1184 NilValue nil); |
1133 | 1185 |
1134 HStringCharCodeAt* BuildStringCharCodeAt(HValue* context, | 1186 HStringCharCodeAt* BuildStringCharCodeAt(HValue* context, |
1135 HValue* string, | 1187 HValue* string, |
1136 HValue* index); | 1188 HValue* index); |
1137 HInstruction* BuildBinaryOperation(BinaryOperation* expr, | 1189 HInstruction* BuildBinaryOperation(BinaryOperation* expr, |
1138 HValue* left, | 1190 HValue* left, |
1139 HValue* right); | 1191 HValue* right); |
1140 HInstruction* BuildIncrement(bool returns_original_input, | 1192 HInstruction* BuildIncrement(bool returns_original_input, |
1141 CountOperation* expr); | 1193 CountOperation* expr); |
1142 HInstruction* BuildFastElementAccess(HValue* elements, | 1194 HInstruction* BuildLoadKeyedGeneric(HValue* object, |
1143 HValue* checked_key, | 1195 HValue* key); |
1144 HValue* val, | |
1145 HValue* dependency, | |
1146 ElementsKind elements_kind, | |
1147 bool is_store); | |
1148 | 1196 |
1149 HInstruction* TryBuildConsolidatedElementLoad(HValue* object, | 1197 HInstruction* TryBuildConsolidatedElementLoad(HValue* object, |
1150 HValue* key, | 1198 HValue* key, |
1151 HValue* val, | 1199 HValue* val, |
1152 SmallMapList* maps); | 1200 SmallMapList* maps); |
1153 | 1201 |
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, | 1202 HInstruction* BuildMonomorphicElementAccess(HValue* object, |
1162 HValue* key, | 1203 HValue* key, |
1163 HValue* val, | 1204 HValue* val, |
1164 HValue* dependency, | 1205 HValue* dependency, |
1165 Handle<Map> map, | 1206 Handle<Map> map, |
1166 bool is_store); | 1207 bool is_store); |
1167 | 1208 |
1168 HValue* HandlePolymorphicElementAccess(HValue* object, | 1209 HValue* HandlePolymorphicElementAccess(HValue* object, |
1169 HValue* key, | 1210 HValue* key, |
1170 HValue* val, | 1211 HValue* val, |
(...skipping 19 matching lines...) Expand all Loading... | |
1190 Handle<String> name, | 1231 Handle<String> name, |
1191 Property* expr); | 1232 Property* expr); |
1192 HInstruction* BuildCallGetter(HValue* object, | 1233 HInstruction* BuildCallGetter(HValue* object, |
1193 Handle<Map> map, | 1234 Handle<Map> map, |
1194 Handle<JSFunction> getter, | 1235 Handle<JSFunction> getter, |
1195 Handle<JSObject> holder); | 1236 Handle<JSObject> holder); |
1196 HInstruction* BuildLoadNamedMonomorphic(HValue* object, | 1237 HInstruction* BuildLoadNamedMonomorphic(HValue* object, |
1197 Handle<String> name, | 1238 Handle<String> name, |
1198 Property* expr, | 1239 Property* expr, |
1199 Handle<Map> map); | 1240 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 | 1241 |
1209 void AddCheckMapsWithTransitions(HValue* object, | 1242 void AddCheckMapsWithTransitions(HValue* object, |
1210 Handle<Map> map); | 1243 Handle<Map> map); |
1211 | 1244 |
1212 HInstruction* BuildStoreNamedField(HValue* object, | 1245 HInstruction* BuildStoreNamedField(HValue* object, |
1213 Handle<String> name, | 1246 Handle<String> name, |
1214 HValue* value, | 1247 HValue* value, |
1215 Handle<Map> map, | 1248 Handle<Map> map, |
1216 LookupResult* lookup); | 1249 LookupResult* lookup); |
1217 HInstruction* BuildStoreNamedGeneric(HValue* object, | 1250 HInstruction* BuildStoreNamedGeneric(HValue* object, |
(...skipping 21 matching lines...) Expand all Loading... | |
1239 | 1272 |
1240 void AddCheckConstantFunction(Handle<JSObject> holder, | 1273 void AddCheckConstantFunction(Handle<JSObject> holder, |
1241 HValue* receiver, | 1274 HValue* receiver, |
1242 Handle<Map> receiver_map); | 1275 Handle<Map> receiver_map); |
1243 | 1276 |
1244 bool MatchRotateRight(HValue* left, | 1277 bool MatchRotateRight(HValue* left, |
1245 HValue* right, | 1278 HValue* right, |
1246 HValue** operand, | 1279 HValue** operand, |
1247 HValue** shift_amount); | 1280 HValue** shift_amount); |
1248 | 1281 |
1249 Zone* zone() const { return zone_; } | |
1250 | |
1251 // The translation state of the currently-being-translated function. | 1282 // The translation state of the currently-being-translated function. |
1252 FunctionState* function_state_; | 1283 FunctionState* function_state_; |
1253 | 1284 |
1254 // The base of the function state stack. | 1285 // The base of the function state stack. |
1255 FunctionState initial_function_state_; | 1286 FunctionState initial_function_state_; |
1256 | 1287 |
1257 // Expression context of the currently visited subexpression. NULL when | 1288 // Expression context of the currently visited subexpression. NULL when |
1258 // visiting statements. | 1289 // visiting statements. |
1259 AstContext* ast_context_; | 1290 AstContext* ast_context_; |
1260 | 1291 |
1261 // A stack of breakable statements entered. | 1292 // A stack of breakable statements entered. |
1262 BreakAndContinueScope* break_scope_; | 1293 BreakAndContinueScope* break_scope_; |
1263 | 1294 |
1264 HGraph* graph_; | |
1265 HBasicBlock* current_block_; | |
1266 | |
1267 int inlined_count_; | 1295 int inlined_count_; |
1268 ZoneList<Handle<Object> > globals_; | 1296 ZoneList<Handle<Object> > globals_; |
1269 | 1297 |
1270 Zone* zone_; | |
1271 | |
1272 bool inline_bailout_; | 1298 bool inline_bailout_; |
1273 | 1299 |
1274 friend class FunctionState; // Pushes and pops the state stack. | 1300 friend class FunctionState; // Pushes and pops the state stack. |
1275 friend class AstContext; // Pushes and pops the AST context stack. | 1301 friend class AstContext; // Pushes and pops the AST context stack. |
1302 friend class KeyedLoadFastElementStub; | |
1276 | 1303 |
1277 DISALLOW_COPY_AND_ASSIGN(HGraphBuilder); | 1304 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); |
Jakob Kummerow
2012/11/28 16:28:22
These used to be public; did you move them to the
danno
2012/11/30 16:23:24
Done.
Jakob Kummerow
2012/11/30 16:43:02
Actually, since the macro's expansions contains ap
| |
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 |