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 24 matching lines...) Expand all Loading... | |
35 #include "compiler.h" | 35 #include "compiler.h" |
36 #include "hydrogen-instructions.h" | 36 #include "hydrogen-instructions.h" |
37 #include "type-info.h" | 37 #include "type-info.h" |
38 #include "zone.h" | 38 #include "zone.h" |
39 | 39 |
40 namespace v8 { | 40 namespace v8 { |
41 namespace internal { | 41 namespace internal { |
42 | 42 |
43 // Forward declarations. | 43 // Forward declarations. |
44 class BitVector; | 44 class BitVector; |
45 class FunctionState; | |
45 class HEnvironment; | 46 class HEnvironment; |
46 class HGraph; | 47 class HGraph; |
47 class HLoopInformation; | 48 class HLoopInformation; |
48 class HTracer; | 49 class HTracer; |
49 class LAllocator; | 50 class LAllocator; |
50 class LChunk; | 51 class LChunk; |
51 class LiveRange; | 52 class LiveRange; |
52 | 53 |
53 | 54 |
54 class HBasicBlock: public ZoneObject { | 55 class HBasicBlock: public ZoneObject { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
114 ASSERT(parent_loop_header_ == NULL); | 115 ASSERT(parent_loop_header_ == NULL); |
115 parent_loop_header_ = block; | 116 parent_loop_header_ = block; |
116 } | 117 } |
117 | 118 |
118 bool HasParentLoopHeader() const { return parent_loop_header_ != NULL; } | 119 bool HasParentLoopHeader() const { return parent_loop_header_ != NULL; } |
119 | 120 |
120 void SetJoinId(int ast_id); | 121 void SetJoinId(int ast_id); |
121 | 122 |
122 void Finish(HControlInstruction* last); | 123 void Finish(HControlInstruction* last); |
123 void FinishExit(HControlInstruction* instruction); | 124 void FinishExit(HControlInstruction* instruction); |
124 void Goto(HBasicBlock* block, bool drop_extra = false); | 125 void Goto(HBasicBlock* block, FunctionState* state = NULL); |
125 | 126 |
126 int PredecessorIndexOf(HBasicBlock* predecessor) const; | 127 int PredecessorIndexOf(HBasicBlock* predecessor) const; |
127 void AddSimulate(int ast_id) { AddInstruction(CreateSimulate(ast_id)); } | 128 void AddSimulate(int ast_id) { AddInstruction(CreateSimulate(ast_id)); } |
128 void AssignCommonDominator(HBasicBlock* other); | 129 void AssignCommonDominator(HBasicBlock* other); |
129 void AssignLoopSuccessorDominators(); | 130 void AssignLoopSuccessorDominators(); |
130 | 131 |
131 void FinishExitWithDeoptimization(HDeoptimize::UseEnvironment has_uses) { | 132 void FinishExitWithDeoptimization(HDeoptimize::UseEnvironment has_uses) { |
132 FinishExit(CreateDeoptimize(has_uses)); | 133 FinishExit(CreateDeoptimize(has_uses)); |
133 } | 134 } |
134 | 135 |
135 // Add the inlined function exit sequence, adding an HLeaveInlined | 136 // Add the inlined function exit sequence, adding an HLeaveInlined |
136 // instruction and updating the bailout environment. | 137 // instruction and updating the bailout environment. |
137 void AddLeaveInlined(HValue* return_value, | 138 void AddLeaveInlined(HValue* return_value, |
138 HBasicBlock* target, | 139 HBasicBlock* target, |
139 bool drop_extra = false); | 140 FunctionState* state = NULL); |
140 | 141 |
141 // If a target block is tagged as an inline function return, all | 142 // If a target block is tagged as an inline function return, all |
142 // predecessors should contain the inlined exit sequence: | 143 // predecessors should contain the inlined exit sequence: |
143 // | 144 // |
144 // LeaveInlined | 145 // LeaveInlined |
145 // Simulate (caller's environment) | 146 // Simulate (caller's environment) |
146 // Goto (target block) | 147 // Goto (target block) |
147 bool IsInlineReturnTarget() const { return is_inline_return_target_; } | 148 bool IsInlineReturnTarget() const { return is_inline_return_target_; } |
148 void MarkAsInlineReturnTarget() { is_inline_return_target_ = true; } | 149 void MarkAsInlineReturnTarget() { is_inline_return_target_ = true; } |
149 | 150 |
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
708 bool is_construct() { return return_handling_ == CONSTRUCT_CALL_RETURN; } | 709 bool is_construct() { return return_handling_ == CONSTRUCT_CALL_RETURN; } |
709 HBasicBlock* function_return() { return function_return_; } | 710 HBasicBlock* function_return() { return function_return_; } |
710 TestContext* test_context() { return test_context_; } | 711 TestContext* test_context() { return test_context_; } |
711 void ClearInlinedTestContext() { | 712 void ClearInlinedTestContext() { |
712 delete test_context_; | 713 delete test_context_; |
713 test_context_ = NULL; | 714 test_context_ = NULL; |
714 } | 715 } |
715 | 716 |
716 FunctionState* outer() { return outer_; } | 717 FunctionState* outer() { return outer_; } |
717 | 718 |
719 HInstruction* entry() { return entry_; } | |
720 void set_entry(HInstruction* entry) { entry_ = entry; } | |
721 | |
722 HInstruction* arguments_elements() { return arguments_elements_; } | |
723 void set_arguments_elements(HInstruction* arguments_elements) { | |
724 arguments_elements_ = arguments_elements; | |
725 } | |
726 | |
727 bool arguments_pushed() { return arguments_elements() != NULL; } | |
728 | |
718 private: | 729 private: |
719 HGraphBuilder* owner_; | 730 HGraphBuilder* owner_; |
720 | 731 |
721 CompilationInfo* compilation_info_; | 732 CompilationInfo* compilation_info_; |
722 TypeFeedbackOracle* oracle_; | 733 TypeFeedbackOracle* oracle_; |
723 | 734 |
724 // During function inlining, expression context of the call being | 735 // During function inlining, expression context of the call being |
725 // inlined. NULL when not inlining. | 736 // inlined. NULL when not inlining. |
726 AstContext* call_context_; | 737 AstContext* call_context_; |
727 | 738 |
728 // Indicate whether we have to perform special handling on return from | 739 // Indicate whether we have to perform special handling on return from |
729 // inlined functions. | 740 // inlined functions. |
730 // - DROP_EXTRA_ON_RETURN: Drop an extra value from the environment. | 741 // - DROP_EXTRA_ON_RETURN: Drop an extra value from the environment. |
731 // - CONSTRUCT_CALL_RETURN: Either use allocated receiver or return value. | 742 // - CONSTRUCT_CALL_RETURN: Either use allocated receiver or return value. |
732 ReturnHandlingFlag return_handling_; | 743 ReturnHandlingFlag return_handling_; |
733 | 744 |
734 // When inlining in an effect or value context, this is the return block. | 745 // When inlining in an effect or value context, this is the return block. |
735 // It is NULL otherwise. When inlining in a test context, there are a | 746 // It is NULL otherwise. When inlining in a test context, there are a |
736 // pair of return blocks in the context. When not inlining, there is no | 747 // pair of return blocks in the context. When not inlining, there is no |
737 // local return point. | 748 // local return point. |
738 HBasicBlock* function_return_; | 749 HBasicBlock* function_return_; |
739 | 750 |
740 // When inlining a call in a test context, a context containing a pair of | 751 // When inlining a call in a test context, a context containing a pair of |
741 // return blocks. NULL in all other cases. | 752 // return blocks. NULL in all other cases. |
742 TestContext* test_context_; | 753 TestContext* test_context_; |
743 | 754 |
755 // When inlining HEnterInlined instruction corresponding to the function | |
756 // entry. | |
757 HInstruction* entry_; | |
Kevin Millikin (Chromium)
2012/04/11 11:49:18
Why not HEnterInlined* and HArgumentsElements* bel
Vyacheslav Egorov (Chromium)
2012/04/11 12:47:28
Done.
| |
758 | |
759 HInstruction* arguments_elements_; | |
760 | |
744 FunctionState* outer_; | 761 FunctionState* outer_; |
745 }; | 762 }; |
746 | 763 |
747 | 764 |
748 class HGraphBuilder: public AstVisitor { | 765 class HGraphBuilder: public AstVisitor { |
749 public: | 766 public: |
750 enum BreakType { BREAK, CONTINUE }; | 767 enum BreakType { BREAK, CONTINUE }; |
751 enum SwitchType { UNKNOWN_SWITCH, SMI_SWITCH, STRING_SWITCH }; | 768 enum SwitchType { UNKNOWN_SWITCH, SMI_SWITCH, STRING_SWITCH }; |
752 | 769 |
753 // A class encapsulating (lazily-allocated) break and continue blocks for | 770 // A class encapsulating (lazily-allocated) break and continue blocks for |
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1374 const char* filename_; | 1391 const char* filename_; |
1375 HeapStringAllocator string_allocator_; | 1392 HeapStringAllocator string_allocator_; |
1376 StringStream trace_; | 1393 StringStream trace_; |
1377 int indent_; | 1394 int indent_; |
1378 }; | 1395 }; |
1379 | 1396 |
1380 | 1397 |
1381 } } // namespace v8::internal | 1398 } } // namespace v8::internal |
1382 | 1399 |
1383 #endif // V8_HYDROGEN_H_ | 1400 #endif // V8_HYDROGEN_H_ |
OLD | NEW |