| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_HYDROGEN_H_ | 5 #ifndef V8_HYDROGEN_H_ |
| 6 #define V8_HYDROGEN_H_ | 6 #define V8_HYDROGEN_H_ |
| 7 | 7 |
| 8 #include "v8.h" | 8 #include "v8.h" |
| 9 | 9 |
| 10 #include "accessors.h" | 10 #include "accessors.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 void UpdateEnvironment(HEnvironment* env); | 102 void UpdateEnvironment(HEnvironment* env); |
| 103 HBasicBlock* parent_loop_header() const { return parent_loop_header_; } | 103 HBasicBlock* parent_loop_header() const { return parent_loop_header_; } |
| 104 | 104 |
| 105 void set_parent_loop_header(HBasicBlock* block) { | 105 void set_parent_loop_header(HBasicBlock* block) { |
| 106 ASSERT(parent_loop_header_ == NULL); | 106 ASSERT(parent_loop_header_ == NULL); |
| 107 parent_loop_header_ = block; | 107 parent_loop_header_ = block; |
| 108 } | 108 } |
| 109 | 109 |
| 110 bool HasParentLoopHeader() const { return parent_loop_header_ != NULL; } | 110 bool HasParentLoopHeader() const { return parent_loop_header_ != NULL; } |
| 111 | 111 |
| 112 void SetJoinId(BailoutId ast_id); | 112 void SetJoinId(BailoutId ast_id, int stack_checker_offset = 0); |
| 113 | 113 |
| 114 int PredecessorIndexOf(HBasicBlock* predecessor) const; | 114 int PredecessorIndexOf(HBasicBlock* predecessor) const; |
| 115 HPhi* AddNewPhi(int merged_index); | 115 HPhi* AddNewPhi(int merged_index); |
| 116 HSimulate* AddNewSimulate(BailoutId ast_id, | 116 HSimulate* AddNewSimulate(BailoutId ast_id, |
| 117 HSourcePosition position, | 117 HSourcePosition position, |
| 118 RemovableSimulate removable = FIXED_SIMULATE) { | 118 RemovableSimulate removable = FIXED_SIMULATE, |
| 119 HSimulate* instr = CreateSimulate(ast_id, removable); | 119 int arguments_offset = 0); |
| 120 AddInstruction(instr, position); | |
| 121 return instr; | |
| 122 } | |
| 123 void AssignCommonDominator(HBasicBlock* other); | 120 void AssignCommonDominator(HBasicBlock* other); |
| 124 void AssignLoopSuccessorDominators(); | 121 void AssignLoopSuccessorDominators(); |
| 125 | 122 |
| 126 // If a target block is tagged as an inline function return, all | 123 // If a target block is tagged as an inline function return, all |
| 127 // predecessors should contain the inlined exit sequence: | 124 // predecessors should contain the inlined exit sequence: |
| 128 // | 125 // |
| 129 // LeaveInlined | 126 // LeaveInlined |
| 130 // Simulate (caller's environment) | 127 // Simulate (caller's environment) |
| 131 // Goto (target block) | 128 // Goto (target block) |
| 132 bool IsInlineReturnTarget() const { return is_inline_return_target_; } | 129 bool IsInlineReturnTarget() const { return is_inline_return_target_; } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 158 | 155 |
| 159 inline Zone* zone() const; | 156 inline Zone* zone() const; |
| 160 | 157 |
| 161 #ifdef DEBUG | 158 #ifdef DEBUG |
| 162 void Verify(); | 159 void Verify(); |
| 163 #endif | 160 #endif |
| 164 | 161 |
| 165 protected: | 162 protected: |
| 166 friend class HGraphBuilder; | 163 friend class HGraphBuilder; |
| 167 | 164 |
| 168 HSimulate* CreateSimulate(BailoutId ast_id, RemovableSimulate removable); | 165 HSimulate* CreateSimulate(BailoutId ast_id, RemovableSimulate removable, |
| 166 int arguments_offset); |
| 169 void Finish(HControlInstruction* last, HSourcePosition position); | 167 void Finish(HControlInstruction* last, HSourcePosition position); |
| 170 void FinishExit(HControlInstruction* instruction, HSourcePosition position); | 168 void FinishExit(HControlInstruction* instruction, HSourcePosition position); |
| 171 void Goto(HBasicBlock* block, | 169 void Goto(HBasicBlock* block, |
| 172 HSourcePosition position, | 170 HSourcePosition position, |
| 173 FunctionState* state = NULL, | 171 FunctionState* state = NULL, |
| 174 bool add_simulate = true); | 172 bool add_simulate = true); |
| 175 void GotoNoSimulate(HBasicBlock* block, HSourcePosition position) { | 173 void GotoNoSimulate(HBasicBlock* block, HSourcePosition position) { |
| 176 Goto(block, position, NULL, false); | 174 Goto(block, position, NULL, false); |
| 177 } | 175 } |
| 178 | 176 |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 | 694 |
| 697 bool is_special_index(int i) const { | 695 bool is_special_index(int i) const { |
| 698 return i >= parameter_count() && i < parameter_count() + specials_count(); | 696 return i >= parameter_count() && i < parameter_count() + specials_count(); |
| 699 } | 697 } |
| 700 | 698 |
| 701 void PrintTo(StringStream* stream); | 699 void PrintTo(StringStream* stream); |
| 702 void PrintToStd(); | 700 void PrintToStd(); |
| 703 | 701 |
| 704 Zone* zone() const { return zone_; } | 702 Zone* zone() const { return zone_; } |
| 705 | 703 |
| 704 void VerifyStackHeight(BailoutId ast_id, |
| 705 int hydrogen_id, |
| 706 int stack_height_offset = 0); |
| 707 |
| 706 private: | 708 private: |
| 707 HEnvironment(const HEnvironment* other, Zone* zone); | 709 HEnvironment(const HEnvironment* other, Zone* zone); |
| 708 | 710 |
| 709 HEnvironment(HEnvironment* outer, | 711 HEnvironment(HEnvironment* outer, |
| 710 Handle<JSFunction> closure, | 712 Handle<JSFunction> closure, |
| 711 FrameType frame_type, | 713 FrameType frame_type, |
| 712 int arguments, | 714 int arguments, |
| 713 Zone* zone); | 715 Zone* zone); |
| 714 | 716 |
| 715 // Create an artificial stub environment (e.g. for argument adaptor or | 717 // Create an artificial stub environment (e.g. for argument adaptor or |
| (...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1286 P5 p5, P6 p6, P7 p7, P8 p8) { | 1288 P5 p5, P6 p6, P7 p7, P8 p8) { |
| 1287 return AddInstruction(NewUncasted<I>(p1, p2, p3, p4, p5, p6, p7, p8)); | 1289 return AddInstruction(NewUncasted<I>(p1, p2, p3, p4, p5, p6, p7, p8)); |
| 1288 } | 1290 } |
| 1289 | 1291 |
| 1290 template<class I, class P1, class P2, class P3, class P4, | 1292 template<class I, class P1, class P2, class P3, class P4, |
| 1291 class P5, class P6, class P7, class P8> | 1293 class P5, class P6, class P7, class P8> |
| 1292 I* Add(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8) { | 1294 I* Add(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8) { |
| 1293 return AddInstructionTyped(New<I>(p1, p2, p3, p4, p5, p6, p7, p8)); | 1295 return AddInstructionTyped(New<I>(p1, p2, p3, p4, p5, p6, p7, p8)); |
| 1294 } | 1296 } |
| 1295 | 1297 |
| 1296 void AddSimulate(BailoutId id, RemovableSimulate removable = FIXED_SIMULATE); | 1298 void AddSimulate(BailoutId id, RemovableSimulate removable = FIXED_SIMULATE, |
| 1299 int arguments_offset = 0); |
| 1297 | 1300 |
| 1298 protected: | 1301 protected: |
| 1299 virtual bool BuildGraph() = 0; | 1302 virtual bool BuildGraph() = 0; |
| 1300 | 1303 |
| 1301 HBasicBlock* CreateBasicBlock(HEnvironment* env); | 1304 HBasicBlock* CreateBasicBlock(HEnvironment* env); |
| 1302 HBasicBlock* CreateLoopHeaderBlock(); | 1305 HBasicBlock* CreateLoopHeaderBlock(); |
| 1303 | 1306 |
| 1304 HValue* BuildCheckHeapObject(HValue* object); | 1307 HValue* BuildCheckHeapObject(HValue* object); |
| 1305 HValue* BuildCheckString(HValue* string); | 1308 HValue* BuildCheckString(HValue* string); |
| 1306 HValue* BuildWrapReceiver(HValue* object, HValue* function); | 1309 HValue* BuildWrapReceiver(HValue* object, HValue* function); |
| (...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1881 inline HInstruction* HGraphBuilder::AddUncasted<HDeoptimize>( | 1884 inline HInstruction* HGraphBuilder::AddUncasted<HDeoptimize>( |
| 1882 const char* reason, Deoptimizer::BailoutType type) { | 1885 const char* reason, Deoptimizer::BailoutType type) { |
| 1883 return Add<HDeoptimize>(reason, type); | 1886 return Add<HDeoptimize>(reason, type); |
| 1884 } | 1887 } |
| 1885 | 1888 |
| 1886 | 1889 |
| 1887 template<> | 1890 template<> |
| 1888 inline HSimulate* HGraphBuilder::Add<HSimulate>( | 1891 inline HSimulate* HGraphBuilder::Add<HSimulate>( |
| 1889 BailoutId id, | 1892 BailoutId id, |
| 1890 RemovableSimulate removable) { | 1893 RemovableSimulate removable) { |
| 1891 HSimulate* instr = current_block()->CreateSimulate(id, removable); | 1894 HSimulate* instr = current_block()->CreateSimulate(id, removable, 0); |
| 1892 AddInstruction(instr); | 1895 AddInstruction(instr); |
| 1893 return instr; | 1896 return instr; |
| 1894 } | 1897 } |
| 1895 | 1898 |
| 1896 | 1899 |
| 1897 template<> | 1900 template<> |
| 1898 inline HSimulate* HGraphBuilder::Add<HSimulate>( | 1901 inline HSimulate* HGraphBuilder::Add<HSimulate>( |
| 1899 BailoutId id) { | 1902 BailoutId id) { |
| 1900 return Add<HSimulate>(id, FIXED_SIMULATE); | 1903 return Add<HSimulate>(id, FIXED_SIMULATE); |
| 1901 } | 1904 } |
| (...skipping 894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2796 } | 2799 } |
| 2797 | 2800 |
| 2798 private: | 2801 private: |
| 2799 HGraphBuilder* builder_; | 2802 HGraphBuilder* builder_; |
| 2800 }; | 2803 }; |
| 2801 | 2804 |
| 2802 | 2805 |
| 2803 } } // namespace v8::internal | 2806 } } // namespace v8::internal |
| 2804 | 2807 |
| 2805 #endif // V8_HYDROGEN_H_ | 2808 #endif // V8_HYDROGEN_H_ |
| OLD | NEW |