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

Side by Side Diff: src/hydrogen.h

Issue 8360001: Fix bug in environment simulation after inlined call-as-function. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Added r9619. Created 9 years, 2 months 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/deoptimizer.cc ('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 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 BASE_EMBEDDED {
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
(...skipping 116 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,
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
1240 const char* filename_; 1249 const char* filename_;
1241 HeapStringAllocator string_allocator_; 1250 HeapStringAllocator string_allocator_;
1242 StringStream trace_; 1251 StringStream trace_;
1243 int indent_; 1252 int indent_;
1244 }; 1253 };
1245 1254
1246 1255
1247 } } // namespace v8::internal 1256 } } // namespace v8::internal
1248 1257
1249 #endif // V8_HYDROGEN_H_ 1258 #endif // V8_HYDROGEN_H_
OLDNEW
« no previous file with comments | « src/deoptimizer.cc ('k') | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698