Chromium Code Reviews| Index: src/hydrogen.h |
| diff --git a/src/hydrogen.h b/src/hydrogen.h |
| index 8be784074481c1dc0083b34b7443ced084eb7417..d9253479f4b8782c56e1237428a6d1f6e8ba456a 100644 |
| --- a/src/hydrogen.h |
| +++ b/src/hydrogen.h |
| @@ -46,6 +46,7 @@ class FunctionState; |
| class HEnvironment; |
| class HGraph; |
| class HLoopInformation; |
| +class HOsrBuilder; |
| class HTracer; |
| class LAllocator; |
| class LChunk; |
| @@ -359,24 +360,16 @@ class HGraph: public ZoneObject { |
| void Verify(bool do_full_verify) const; |
| #endif |
| - bool has_osr_loop_entry() { |
| - return osr_loop_entry_.is_set(); |
| + bool has_osr() { |
| + return osr_ != NULL; |
| } |
| - HBasicBlock* osr_loop_entry() { |
| - return osr_loop_entry_.get(); |
| + void set_osr(HOsrBuilder* osr) { |
| + osr_ = osr; |
| } |
| - void set_osr_loop_entry(HBasicBlock* entry) { |
| - osr_loop_entry_.set(entry); |
| - } |
| - |
| - ZoneList<HUnknownOSRValue*>* osr_values() { |
| - return osr_values_.get(); |
| - } |
| - |
| - void set_osr_values(ZoneList<HUnknownOSRValue*>* values) { |
| - osr_values_.set(values); |
| + HOsrBuilder* osr() { |
| + return osr_; |
| } |
| int update_type_change_checksum(int delta) { |
| @@ -485,8 +478,7 @@ class HGraph: public ZoneObject { |
| SetOncePointer<HConstant> constant_invalid_context_; |
| SetOncePointer<HArgumentsObject> arguments_object_; |
| - SetOncePointer<HBasicBlock> osr_loop_entry_; |
| - SetOncePointer<ZoneList<HUnknownOSRValue*> > osr_values_; |
| + HOsrBuilder* osr_; |
| CompilationInfo* info_; |
| Zone* zone_; |
| @@ -1426,6 +1418,35 @@ class HGraphBuilder { |
| int no_side_effects_scope_count_; |
| }; |
| +// Responsible for building graph parts related to OSR and otherwise |
| +// setting up the graph to do an OSR compile. |
| +class HOsrBuilder { |
|
Michael Starzinger
2013/07/03 10:54:12
Since the implementation has been factored out int
|
| + public: |
| + explicit HOsrBuilder(HOptimizedGraphBuilder* builder) |
| + : builder_(builder), |
| + osr_entry_(NULL), |
| + osr_loop_entry_(NULL), |
| + osr_values_(NULL) { } |
| + // Creates the loop entry block for the given statement, setting up OSR |
| + // entries as necessary, and sets the current block to the new block. |
| + HBasicBlock* BuildPossibleOsrLoopEntry(IterationStatement* statement); |
| + |
| + // Process the hydrogen graph after it has been completed, performing |
| + // any OSR-specific cleanups or changes. |
| + void FinishGraph(); |
| + |
| + // Process the OSR values and phis after initial graph optimization. |
| + void FinishOsrValues(); |
| + |
| + private: |
| + HBasicBlock* BuildLoopEntry(); |
| + bool HasOsrEntryAt(IterationStatement* statement); |
| + |
| + HOptimizedGraphBuilder* builder_; |
| + HBasicBlock* osr_entry_; |
| + HBasicBlock* osr_loop_entry_; |
| + ZoneList<HUnknownOSRValue*>* osr_values_; |
| +}; |
| class HOptimizedGraphBuilder: public HGraphBuilder, public AstVisitor { |
| public: |
| @@ -1584,8 +1605,6 @@ class HOptimizedGraphBuilder: public HGraphBuilder, public AstVisitor { |
| void VisitArithmeticExpression(BinaryOperation* expr); |
| bool PreProcessOsrEntry(IterationStatement* statement); |
| - // True iff. we are compiling for OSR and the statement is the entry. |
| - bool HasOsrEntryAt(IterationStatement* statement); |
| void VisitLoopBody(IterationStatement* stmt, |
| HBasicBlock* loop_entry, |
| BreakAndContinueInfo* break_info); |
| @@ -1947,9 +1966,12 @@ class HOptimizedGraphBuilder: public HGraphBuilder, public AstVisitor { |
| bool inline_bailout_; |
| + HOsrBuilder osr_; |
| + |
| friend class FunctionState; // Pushes and pops the state stack. |
| friend class AstContext; // Pushes and pops the AST context stack. |
| friend class KeyedLoadFastElementStub; |
| + friend class HOsrBuilder; |
| DISALLOW_COPY_AND_ASSIGN(HOptimizedGraphBuilder); |
| }; |