Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Side by Side Diff: src/hydrogen.h

Issue 8404030: Version 3.7.1 (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/heap-inl.h ('k') | src/hydrogen.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 ASSERT(parent_loop_header_ == NULL); 114 ASSERT(parent_loop_header_ == NULL);
115 parent_loop_header_ = block; 115 parent_loop_header_ = block;
116 } 116 }
117 117
118 bool HasParentLoopHeader() const { return parent_loop_header_ != NULL; } 118 bool HasParentLoopHeader() const { return parent_loop_header_ != NULL; }
119 119
120 void SetJoinId(int ast_id); 120 void SetJoinId(int ast_id);
121 121
122 void Finish(HControlInstruction* last); 122 void Finish(HControlInstruction* last);
123 void FinishExit(HControlInstruction* instruction); 123 void FinishExit(HControlInstruction* instruction);
124 void Goto(HBasicBlock* block); 124 void Goto(HBasicBlock* block, bool drop_extra = false);
125 125
126 int PredecessorIndexOf(HBasicBlock* predecessor) const; 126 int PredecessorIndexOf(HBasicBlock* predecessor) const;
127 void AddSimulate(int ast_id) { AddInstruction(CreateSimulate(ast_id)); } 127 void AddSimulate(int ast_id) { AddInstruction(CreateSimulate(ast_id)); }
128 void AssignCommonDominator(HBasicBlock* other); 128 void AssignCommonDominator(HBasicBlock* other);
129 129
130 void FinishExitWithDeoptimization(HDeoptimize::UseEnvironment has_uses) { 130 void FinishExitWithDeoptimization(HDeoptimize::UseEnvironment has_uses) {
131 FinishExit(CreateDeoptimize(has_uses)); 131 FinishExit(CreateDeoptimize(has_uses));
132 } 132 }
133 133
134 // Add the inlined function exit sequence, adding an HLeaveInlined 134 // Add the inlined function exit sequence, adding an HLeaveInlined
135 // instruction and updating the bailout environment. 135 // instruction and updating the bailout environment.
136 void AddLeaveInlined(HValue* return_value, HBasicBlock* target); 136 void AddLeaveInlined(HValue* return_value,
137 HBasicBlock* target,
138 bool drop_extra = false);
137 139
138 // If a target block is tagged as an inline function return, all 140 // If a target block is tagged as an inline function return, all
139 // predecessors should contain the inlined exit sequence: 141 // predecessors should contain the inlined exit sequence:
140 // 142 //
141 // LeaveInlined 143 // LeaveInlined
142 // Simulate (caller's environment) 144 // Simulate (caller's environment)
143 // Goto (target block) 145 // Goto (target block)
144 bool IsInlineReturnTarget() const { return is_inline_return_target_; } 146 bool IsInlineReturnTarget() const { return is_inline_return_target_; }
145 void MarkAsInlineReturnTarget() { is_inline_return_target_ = true; } 147 void MarkAsInlineReturnTarget() { is_inline_return_target_ = true; }
146 148
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 // Build the shared core part of the translation unpacking a value into 598 // Build the shared core part of the translation unpacking a value into
597 // control flow. 599 // control flow.
598 void BuildBranch(HValue* value); 600 void BuildBranch(HValue* value);
599 601
600 Expression* condition_; 602 Expression* condition_;
601 HBasicBlock* if_true_; 603 HBasicBlock* if_true_;
602 HBasicBlock* if_false_; 604 HBasicBlock* if_false_;
603 }; 605 };
604 606
605 607
606 class FunctionState BASE_EMBEDDED { 608 class FunctionState {
607 public: 609 public:
608 FunctionState(HGraphBuilder* owner, 610 FunctionState(HGraphBuilder* owner,
609 CompilationInfo* info, 611 CompilationInfo* info,
610 TypeFeedbackOracle* oracle); 612 TypeFeedbackOracle* oracle,
613 bool drop_extra);
611 ~FunctionState(); 614 ~FunctionState();
612 615
613 CompilationInfo* compilation_info() { return compilation_info_; } 616 CompilationInfo* compilation_info() { return compilation_info_; }
614 TypeFeedbackOracle* oracle() { return oracle_; } 617 TypeFeedbackOracle* oracle() { return oracle_; }
615 AstContext* call_context() { return call_context_; } 618 AstContext* call_context() { return call_context_; }
619 bool drop_extra() { return drop_extra_; }
616 HBasicBlock* function_return() { return function_return_; } 620 HBasicBlock* function_return() { return function_return_; }
617 TestContext* test_context() { return test_context_; } 621 TestContext* test_context() { return test_context_; }
618 void ClearInlinedTestContext() { 622 void ClearInlinedTestContext() {
619 delete test_context_; 623 delete test_context_;
620 test_context_ = NULL; 624 test_context_ = NULL;
621 } 625 }
622 626
623 FunctionState* outer() { return outer_; } 627 FunctionState* outer() { return outer_; }
624 628
625 private: 629 private:
626 HGraphBuilder* owner_; 630 HGraphBuilder* owner_;
627 631
628 CompilationInfo* compilation_info_; 632 CompilationInfo* compilation_info_;
629 TypeFeedbackOracle* oracle_; 633 TypeFeedbackOracle* oracle_;
630 634
631 // During function inlining, expression context of the call being 635 // During function inlining, expression context of the call being
632 // inlined. NULL when not inlining. 636 // inlined. NULL when not inlining.
633 AstContext* call_context_; 637 AstContext* call_context_;
634 638
639 // Indicate if we have to drop an extra value from the environment on
640 // return from inlined functions.
641 bool drop_extra_;
642
635 // When inlining in an effect of value context, this is the return block. 643 // When inlining in an effect of value context, this is the return block.
636 // It is NULL otherwise. When inlining in a test context, there are a 644 // It is NULL otherwise. When inlining in a test context, there are a
637 // pair of return blocks in the context. When not inlining, there is no 645 // pair of return blocks in the context. When not inlining, there is no
638 // local return point. 646 // local return point.
639 HBasicBlock* function_return_; 647 HBasicBlock* function_return_;
640 648
641 // When inlining a call in a test context, a context containing a pair of 649 // When inlining a call in a test context, a context containing a pair of
642 // return blocks. NULL in all other cases. 650 // return blocks. NULL in all other cases.
643 TestContext* test_context_; 651 TestContext* test_context_;
644 652
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 HValue* Pop() { return environment()->Pop(); } 729 HValue* Pop() { return environment()->Pop(); }
722 730
723 void Bailout(const char* reason); 731 void Bailout(const char* reason);
724 732
725 HBasicBlock* CreateJoin(HBasicBlock* first, 733 HBasicBlock* CreateJoin(HBasicBlock* first,
726 HBasicBlock* second, 734 HBasicBlock* second,
727 int join_id); 735 int join_id);
728 736
729 TypeFeedbackOracle* oracle() const { return function_state()->oracle(); } 737 TypeFeedbackOracle* oracle() const { return function_state()->oracle(); }
730 738
739 FunctionState* function_state() const { return function_state_; }
740
731 private: 741 private:
732 // Type of a member function that generates inline code for a native function. 742 // Type of a member function that generates inline code for a native function.
733 typedef void (HGraphBuilder::*InlineFunctionGenerator)(CallRuntime* call); 743 typedef void (HGraphBuilder::*InlineFunctionGenerator)(CallRuntime* call);
734 744
735 // Forward declarations for inner scope classes. 745 // Forward declarations for inner scope classes.
736 class SubgraphScope; 746 class SubgraphScope;
737 747
738 static const InlineFunctionGenerator kInlineFunctionGenerators[]; 748 static const InlineFunctionGenerator kInlineFunctionGenerators[];
739 749
740 static const int kMaxCallPolymorphism = 4; 750 static const int kMaxCallPolymorphism = 4;
741 static const int kMaxLoadPolymorphism = 4; 751 static const int kMaxLoadPolymorphism = 4;
742 static const int kMaxStorePolymorphism = 4; 752 static const int kMaxStorePolymorphism = 4;
743 753
744 static const int kMaxInlinedNodes = 196; 754 static const int kMaxInlinedNodes = 196;
745 static const int kMaxInlinedSize = 196; 755 static const int kMaxInlinedSize = 196;
746 static const int kMaxSourceSize = 600; 756 static const int kMaxSourceSize = 600;
747 757
748 // Simple accessors. 758 // Simple accessors.
749 FunctionState* function_state() const { return function_state_; }
750 void set_function_state(FunctionState* state) { function_state_ = state; } 759 void set_function_state(FunctionState* state) { function_state_ = state; }
751 760
752 AstContext* ast_context() const { return ast_context_; } 761 AstContext* ast_context() const { return ast_context_; }
753 void set_ast_context(AstContext* context) { ast_context_ = context; } 762 void set_ast_context(AstContext* context) { ast_context_ = context; }
754 763
755 // Accessors forwarded to the function state. 764 // Accessors forwarded to the function state.
756 CompilationInfo* info() const { 765 CompilationInfo* info() const {
757 return function_state()->compilation_info(); 766 return function_state()->compilation_info();
758 } 767 }
759 768
760 AstContext* call_context() const { 769 AstContext* call_context() const {
761 return function_state()->call_context(); 770 return function_state()->call_context();
762 } 771 }
763 HBasicBlock* function_return() const { 772 HBasicBlock* function_return() const {
764 return function_state()->function_return(); 773 return function_state()->function_return();
765 } 774 }
766 TestContext* inlined_test_context() const { 775 TestContext* inlined_test_context() const {
767 return function_state()->test_context(); 776 return function_state()->test_context();
768 } 777 }
769 void ClearInlinedTestContext() { 778 void ClearInlinedTestContext() {
770 function_state()->ClearInlinedTestContext(); 779 function_state()->ClearInlinedTestContext();
771 } 780 }
772 bool function_strict_mode() { 781 StrictModeFlag function_strict_mode_flag() {
773 return function_state()->compilation_info()->is_strict_mode(); 782 return function_state()->compilation_info()->strict_mode_flag();
774 } 783 }
775 784
776 // Generators for inline runtime functions. 785 // Generators for inline runtime functions.
777 #define INLINE_FUNCTION_GENERATOR_DECLARATION(Name, argc, ressize) \ 786 #define INLINE_FUNCTION_GENERATOR_DECLARATION(Name, argc, ressize) \
778 void Generate##Name(CallRuntime* call); 787 void Generate##Name(CallRuntime* call);
779 788
780 INLINE_FUNCTION_LIST(INLINE_FUNCTION_GENERATOR_DECLARATION) 789 INLINE_FUNCTION_LIST(INLINE_FUNCTION_GENERATOR_DECLARATION)
781 INLINE_RUNTIME_FUNCTION_LIST(INLINE_FUNCTION_GENERATOR_DECLARATION) 790 INLINE_RUNTIME_FUNCTION_LIST(INLINE_FUNCTION_GENERATOR_DECLARATION)
782 #undef INLINE_FUNCTION_GENERATOR_DECLARATION 791 #undef INLINE_FUNCTION_GENERATOR_DECLARATION
783 792
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 }; 885 };
877 GlobalPropertyAccess LookupGlobalProperty(Variable* var, 886 GlobalPropertyAccess LookupGlobalProperty(Variable* var,
878 LookupResult* lookup, 887 LookupResult* lookup,
879 bool is_store); 888 bool is_store);
880 889
881 bool TryArgumentsAccess(Property* expr); 890 bool TryArgumentsAccess(Property* expr);
882 891
883 // Try to optimize fun.apply(receiver, arguments) pattern. 892 // Try to optimize fun.apply(receiver, arguments) pattern.
884 bool TryCallApply(Call* expr); 893 bool TryCallApply(Call* expr);
885 894
886 bool TryInline(Call* expr); 895 bool TryInline(Call* expr, bool drop_extra = false);
887 bool TryInlineBuiltinFunction(Call* expr, 896 bool TryInlineBuiltinFunction(Call* expr,
888 HValue* receiver, 897 HValue* receiver,
889 Handle<Map> receiver_map, 898 Handle<Map> receiver_map,
890 CheckType check_type); 899 CheckType check_type);
891 900
892 // If --trace-inlining, print a line of the inlining trace. Inlining 901 // If --trace-inlining, print a line of the inlining trace. Inlining
893 // succeeded if the reason string is NULL and failed if there is a 902 // succeeded if the reason string is NULL and failed if there is a
894 // non-NULL reason string. 903 // non-NULL reason string.
895 void TraceInline(Handle<JSFunction> target, 904 void TraceInline(Handle<JSFunction> target,
896 Handle<JSFunction> caller, 905 Handle<JSFunction> caller,
897 const char* failure_reason); 906 const char* failure_reason);
898 907
899 void HandleGlobalVariableAssignment(Variable* var, 908 void HandleGlobalVariableAssignment(Variable* var,
900 HValue* value, 909 HValue* value,
901 int position, 910 int position,
902 int ast_id); 911 int ast_id);
903 912
904 void HandlePropertyAssignment(Assignment* expr); 913 void HandlePropertyAssignment(Assignment* expr);
905 void HandleCompoundAssignment(Assignment* expr); 914 void HandleCompoundAssignment(Assignment* expr);
906 void HandlePolymorphicStoreNamedField(Assignment* expr, 915 void HandlePolymorphicStoreNamedField(Assignment* expr,
907 HValue* object, 916 HValue* object,
908 HValue* value, 917 HValue* value,
909 SmallMapList* types, 918 SmallMapList* types,
910 Handle<String> name); 919 Handle<String> name);
911 void HandlePolymorphicCallNamed(Call* expr, 920 void HandlePolymorphicCallNamed(Call* expr,
912 HValue* receiver, 921 HValue* receiver,
913 SmallMapList* types, 922 SmallMapList* types,
914 Handle<String> name); 923 Handle<String> name);
915 bool TryLiteralCompare(CompareOperation* expr);
916 void HandleLiteralCompareTypeof(CompareOperation* expr, 924 void HandleLiteralCompareTypeof(CompareOperation* expr,
917 Expression* sub_expr, 925 HTypeof* typeof_expr,
918 Handle<String> check); 926 Handle<String> check);
919 void HandleLiteralCompareNil(CompareOperation* expr, 927 void HandleLiteralCompareNil(CompareOperation* expr,
920 Expression* sub_expr, 928 HValue* value,
921 NilValue nil); 929 NilValue nil);
922 930
923 HStringCharCodeAt* BuildStringCharCodeAt(HValue* context, 931 HStringCharCodeAt* BuildStringCharCodeAt(HValue* context,
924 HValue* string, 932 HValue* string,
925 HValue* index); 933 HValue* index);
926 HInstruction* BuildBinaryOperation(BinaryOperation* expr, 934 HInstruction* BuildBinaryOperation(BinaryOperation* expr,
927 HValue* left, 935 HValue* left,
928 HValue* right); 936 HValue* right);
929 HInstruction* BuildIncrement(bool returns_original_input, 937 HInstruction* BuildIncrement(bool returns_original_input,
930 CountOperation* expr); 938 CountOperation* expr);
(...skipping 13 matching lines...) Expand all
944 bool is_store); 952 bool is_store);
945 HInstruction* BuildFastElementAccess(HValue* elements, 953 HInstruction* BuildFastElementAccess(HValue* elements,
946 HValue* checked_key, 954 HValue* checked_key,
947 HValue* val, 955 HValue* val,
948 ElementsKind elements_kind, 956 ElementsKind elements_kind,
949 bool is_store); 957 bool is_store);
950 958
951 HInstruction* BuildMonomorphicElementAccess(HValue* object, 959 HInstruction* BuildMonomorphicElementAccess(HValue* object,
952 HValue* key, 960 HValue* key,
953 HValue* val, 961 HValue* val,
954 Expression* expr, 962 Handle<Map> map,
955 bool is_store); 963 bool is_store);
956 HValue* HandlePolymorphicElementAccess(HValue* object, 964 HValue* HandlePolymorphicElementAccess(HValue* object,
957 HValue* key, 965 HValue* key,
958 HValue* val, 966 HValue* val,
959 Expression* prop, 967 Expression* prop,
960 int ast_id, 968 int ast_id,
961 int position, 969 int position,
962 bool is_store, 970 bool is_store,
963 bool* has_side_effects); 971 bool* has_side_effects);
964 972
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
1241 const char* filename_; 1249 const char* filename_;
1242 HeapStringAllocator string_allocator_; 1250 HeapStringAllocator string_allocator_;
1243 StringStream trace_; 1251 StringStream trace_;
1244 int indent_; 1252 int indent_;
1245 }; 1253 };
1246 1254
1247 1255
1248 } } // namespace v8::internal 1256 } } // namespace v8::internal
1249 1257
1250 #endif // V8_HYDROGEN_H_ 1258 #endif // V8_HYDROGEN_H_
OLDNEW
« no previous file with comments | « src/heap-inl.h ('k') | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698