diff options
Diffstat (limited to 'compiler/optimizing/nodes.h')
| -rw-r--r-- | compiler/optimizing/nodes.h | 65 | 
1 files changed, 17 insertions, 48 deletions
| diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h index 5cfbf4249e..6f4f3c9505 100644 --- a/compiler/optimizing/nodes.h +++ b/compiler/optimizing/nodes.h @@ -336,7 +336,7 @@ class HGraph : public ArenaObject<kArenaAllocGraph> {    }    // Acquires and stores RTI of inexact Object to be used when creating HNullConstant. -  void InitializeInexactObjectRTI(StackHandleScopeCollection* handles); +  void InitializeInexactObjectRTI(VariableSizedHandleScope* handles);    ArenaAllocator* GetArena() const { return arena_; }    const ArenaVector<HBasicBlock*>& GetBlocks() const { return blocks_; } @@ -366,13 +366,6 @@ class HGraph : public ArenaObject<kArenaAllocGraph> {    // is a throw-catch loop, i.e. the header is a catch block.    GraphAnalysisResult AnalyzeLoops() const; -  // Computes a linear order for the current graph (should be called before -  // using HLinearOrderIterator). Linearizes the graph such that: -  // (1): a block is always after its dominator, -  // (2): blocks of loops are contiguous. -  // This creates a natural and efficient ordering when visualizing live ranges. -  void Linearize(); -    // Iterate over blocks to compute try block membership. Needs reverse post    // order and loop information.    void ComputeTryBlockInformation(); @@ -1938,6 +1931,19 @@ class HInstruction : public ArenaObject<kArenaAllocInstruction> {      return !HasEnvironmentUses() && GetUses().HasExactlyOneElement();    } +  bool IsDeadAndRemovable() const { +    return +        !HasSideEffects() && +        !CanThrow() && +        !IsSuspendCheck() && +        !IsControlFlow() && +        !IsNativeDebugInfo() && +        !IsParameterValue() && +        !HasUses() && +        // If we added an explicit barrier then we should keep it. +        !IsMemoryBarrier(); +  } +    // Does this instruction strictly dominate `other_instruction`?    // Returns false if this instruction and `other_instruction` are the same.    // Aborts if this instruction and `other_instruction` are both phis. @@ -2087,10 +2093,10 @@ class HInstruction : public ArenaObject<kArenaAllocInstruction> {    // to the current method. Such instructions are:    // (1): Instructions that require an environment, as calling the runtime requires    //      to walk the stack and have the current method stored at a specific stack address. -  // (2): Object literals like classes and strings, that are loaded from the dex cache -  //      fields of the current method. +  // (2): HCurrentMethod, potentially used by HInvokeStaticOrDirect, HLoadString, or HLoadClass +  //      to access the dex cache.    bool NeedsCurrentMethod() const { -    return NeedsEnvironment() || IsLoadClass() || IsLoadString(); +    return NeedsEnvironment() || IsCurrentMethod();    }    // Returns whether the code generation of the instruction will require to have access @@ -6661,43 +6667,6 @@ class HPostOrderIterator : public ValueObject {    DISALLOW_COPY_AND_ASSIGN(HPostOrderIterator);  }; -class HLinearPostOrderIterator : public ValueObject { - public: -  explicit HLinearPostOrderIterator(const HGraph& graph) -      : order_(graph.GetLinearOrder()), index_(graph.GetLinearOrder().size()) {} - -  bool Done() const { return index_ == 0; } - -  HBasicBlock* Current() const { return order_[index_ - 1u]; } - -  void Advance() { -    --index_; -    DCHECK_GE(index_, 0U); -  } - - private: -  const ArenaVector<HBasicBlock*>& order_; -  size_t index_; - -  DISALLOW_COPY_AND_ASSIGN(HLinearPostOrderIterator); -}; - -class HLinearOrderIterator : public ValueObject { - public: -  explicit HLinearOrderIterator(const HGraph& graph) -      : order_(graph.GetLinearOrder()), index_(0) {} - -  bool Done() const { return index_ == order_.size(); } -  HBasicBlock* Current() const { return order_[index_]; } -  void Advance() { ++index_; } - - private: -  const ArenaVector<HBasicBlock*>& order_; -  size_t index_; - -  DISALLOW_COPY_AND_ASSIGN(HLinearOrderIterator); -}; -  // Iterator over the blocks that art part of the loop. Includes blocks part  // of an inner loop. The order in which the blocks are iterated is on their  // block id. |