Chromium Code Reviews| Index: src/hydrogen.h |
| diff --git a/src/hydrogen.h b/src/hydrogen.h |
| index 7417fdd2de495e92ed9b40e3b37f1cb3bba3bf4a..72ad07bb5af770b34da106a884f3c1f32ce9f3e8 100644 |
| --- a/src/hydrogen.h |
| +++ b/src/hydrogen.h |
| @@ -263,6 +263,7 @@ class HGraph: public ZoneObject { |
| void MarkDeoptimizeOnUndefined(); |
| void ComputeMinusZeroChecks(); |
| void ComputeSafeUint32Operations(); |
| + void GlobalValueNumbering(); |
| bool ProcessArgumentsObject(); |
| void EliminateRedundantPhis(); |
| void EliminateUnreachablePhis(); |
| @@ -850,6 +851,14 @@ class FunctionState { |
| }; |
| +class LoopBodyBuilder { |
|
Michael Starzinger
2013/01/31 13:15:10
The LoopBodyBuilder seems to be left-over, drop it
danno
2013/01/31 15:53:25
Done.
|
| + public: |
| + virtual ~LoopBodyBuilder() {} |
| + virtual void Build(HValue* current) = 0; |
| +}; |
| + |
| +class CopyElementLoopBodyBuilder; |
|
Michael Starzinger
2013/01/31 13:15:10
The CopyElementLoopBodyBuilder seems to be a left-
danno
2013/01/31 15:53:25
Done.
danno
2013/01/31 15:53:25
Done.
|
| + |
| class HGraphBuilder { |
| public: |
| explicit HGraphBuilder(CompilationInfo* info) |
| @@ -874,6 +883,9 @@ class HGraphBuilder { |
| protected: |
| virtual bool BuildGraph() = 0; |
| + HBasicBlock* CreateBasicBlock(HEnvironment* env); |
| + HBasicBlock* CreateLoopHeaderBlock(); |
| + |
| // Building common constructs |
| HInstruction* BuildExternalArrayElementAccess( |
| HValue* external_elements, |
| @@ -901,7 +913,86 @@ class HGraphBuilder { |
| bool is_store, |
| Representation checked_index_representation = Representation::None()); |
| + HValue* IntegerConstant(int value); |
|
Michael Starzinger
2013/01/31 13:15:10
There already is a HGraph::GetConstantInt32(), we
danno
2013/01/31 15:53:25
Done.
|
| + HValue* Zero() { return IntegerConstant(0); } |
| + HValue* One() { return IntegerConstant(1); } |
| + |
| + class IfBuilder { |
| + public: |
| + IfBuilder(HGraphBuilder* builder, |
| + BailoutId id = BailoutId::StubEntry()); |
| + ~IfBuilder() { |
| + if (!finished_) End(); |
| + } |
| + |
| + void BeginTrue(HValue* left, HValue* right, Token::Value token); |
| + void BeginFalse(); |
| + void End(); |
| + |
| + private: |
| + HGraphBuilder* builder_; |
| + bool finished_; |
| + HEnvironment* true_env_; |
| + HEnvironment* false_env_; |
| + HEnvironment* merge_env_; |
| + HBasicBlock* true_block_; |
| + HBasicBlock* false_block_; |
| + HBasicBlock* merge_block_; |
| + BailoutId id_; |
| + |
| + Zone* zone() { return builder_->zone(); } |
| + }; |
| + |
| + class LoopBuilder { |
| + public: |
| + enum Direction { |
| + kPreIncrement, |
| + kPostIncrement, |
| + kPreDecrement, |
| + kPostDecrement |
| + }; |
| + |
| + LoopBuilder(HGraphBuilder* builder, |
| + HValue* context, |
| + Direction direction, |
| + BailoutId id = BailoutId::StubEntry()); |
| + ~LoopBuilder() { |
| + ASSERT(finished_); |
| + } |
| + |
| + HValue* BeginBody(HValue* initial, HValue* terminating, Token::Value token); |
| + void EndBody(); |
| + |
| + private: |
| + HGraphBuilder* builder_; |
| + HValue* context_; |
| + HInstruction* increment_; |
| + HPhi* phi_; |
| + HEnvironment* body_env_; |
| + HEnvironment* exit_env_; |
| + HBasicBlock* header_block_; |
| + HBasicBlock* body_block_; |
| + HBasicBlock* exit_block_; |
| + Direction direction_; |
| + BailoutId id_; |
| + bool finished_; |
| + |
| + Zone* zone() { return builder_->zone(); } |
| + }; |
| + |
| + HValue* BuildAllocateElements(HContext* context, |
| + ElementsKind kind, |
| + HValue* capacity); |
| + |
| + void BuildCopyElements(HContext* context, |
| + HValue* from_elements, |
| + ElementsKind from_elements_kind, |
| + HValue* to_elements, |
| + ElementsKind to_elements_kind, |
| + HValue* length); |
| + |
| private: |
| + friend class CopyElementLoopBodyBuilder; |
|
Michael Starzinger
2013/01/31 13:15:10
The CopyElementLoopBodyBuilder seems to be a left-
danno
2013/01/31 15:53:25
Done.
|
| HGraphBuilder(); |
| CompilationInfo* info_; |
| HGraph* graph_; |
| @@ -1133,9 +1224,6 @@ class HOptimizedGraphBuilder: public HGraphBuilder, public AstVisitor { |
| AST_NODE_LIST(DECLARE_VISIT) |
| #undef DECLARE_VISIT |
| - HBasicBlock* CreateBasicBlock(HEnvironment* env); |
| - HBasicBlock* CreateLoopHeaderBlock(); |
| - |
| // Helpers for flow graph construction. |
| enum GlobalPropertyAccess { |
| kUseCell, |