Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(834)

Unified Diff: runtime/vm/intermediate_language.h

Issue 10964012: Revert "A simpler scheme for garbage collection of ureachable phi inputs." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/growable_array.h ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language.h
diff --git a/runtime/vm/intermediate_language.h b/runtime/vm/intermediate_language.h
index b4fe33aa46126a307aab797502ce3d772db53708..f47d6e3b90e42ee873f3f74efc4a681f60ff1bb0 100644
--- a/runtime/vm/intermediate_language.h
+++ b/runtime/vm/intermediate_language.h
@@ -655,6 +655,7 @@ class BlockEntryInstr : public Instruction {
void set_postorder_number(intptr_t number) { postorder_number_ = number; }
intptr_t block_id() const { return block_id_; }
+ void set_block_id(intptr_t value) { block_id_ = value; }
void set_start_pos(intptr_t pos) { start_pos_ = pos; }
intptr_t start_pos() const { return start_pos_; }
@@ -723,11 +724,11 @@ class BlockEntryInstr : public Instruction {
}
protected:
- BlockEntryInstr(intptr_t block_id, intptr_t try_index)
- : block_id_(block_id),
- try_index_(try_index),
+ explicit BlockEntryInstr(intptr_t try_index)
+ : try_index_(try_index),
preorder_number_(-1),
postorder_number_(-1),
+ block_id_(-1),
dominator_(NULL),
dominated_blocks_(1),
last_instruction_(NULL),
@@ -738,12 +739,12 @@ class BlockEntryInstr : public Instruction {
virtual void ClearPredecessors() = 0;
virtual void AddPredecessor(BlockEntryInstr* predecessor) = 0;
- const intptr_t block_id_;
const intptr_t try_index_;
intptr_t preorder_number_;
intptr_t postorder_number_;
// Starting and ending lifetime positions for this block. Used by
// the linear scan register allocator.
+ intptr_t block_id_;
intptr_t start_pos_;
intptr_t end_pos_;
BlockEntryInstr* dominator_; // Immediate dominator, NULL for graph entry.
@@ -873,8 +874,8 @@ class GraphEntryInstr : public BlockEntryInstr {
class JoinEntryInstr : public BlockEntryInstr {
public:
- JoinEntryInstr(intptr_t block_id, intptr_t try_index)
- : BlockEntryInstr(block_id, try_index),
+ explicit JoinEntryInstr(intptr_t try_index)
+ : BlockEntryInstr(try_index),
predecessors_(2), // Two is the assumed to be the common case.
phis_(NULL),
phi_count_(0) { }
@@ -901,13 +902,28 @@ class JoinEntryInstr : public BlockEntryInstr {
virtual void PrintTo(BufferFormatter* f) const;
virtual void PrintToVisualizer(BufferFormatter* f) const;
+ // After recomputing predecessors to eliminate unreachable ones,
+ // reorganize phi inputs to match the predecessor order and to eliminate
+ // unreachable inputs.
+ void EliminateUnreachablePhiInputs();
+
private:
- virtual void ClearPredecessors() { predecessors_.Clear(); }
- virtual void AddPredecessor(BlockEntryInstr* predecessor);
+ virtual void ClearPredecessors() {
+ // Keep a 'backup' of any existing predecessors to enable garbage
+ // collection of phis after eliminating unreachable code and recomputing
+ // predecessors.
+ stale_predecessors_.Clear();
+ stale_predecessors_.AddArray(predecessors_);
+ predecessors_.Clear();
+ }
+ virtual void AddPredecessor(BlockEntryInstr* predecessor) {
+ predecessors_.Add(predecessor);
+ }
GrowableArray<BlockEntryInstr*> predecessors_;
ZoneGrowableArray<PhiInstr*>* phis_;
intptr_t phi_count_;
+ GrowableArray<BlockEntryInstr*> stale_predecessors_;
DISALLOW_COPY_AND_ASSIGN(JoinEntryInstr);
};
@@ -915,11 +931,17 @@ class JoinEntryInstr : public BlockEntryInstr {
class TargetEntryInstr : public BlockEntryInstr {
public:
- TargetEntryInstr(intptr_t block_id, intptr_t try_index)
- : BlockEntryInstr(block_id, try_index),
+ explicit TargetEntryInstr(intptr_t try_index)
+ : BlockEntryInstr(try_index),
predecessor_(NULL),
catch_try_index_(CatchClauseNode::kInvalidTryIndex) { }
+ // Used for exception catch entries.
+ TargetEntryInstr(intptr_t try_index, intptr_t catch_try_index)
+ : BlockEntryInstr(try_index),
+ predecessor_(NULL),
+ catch_try_index_(catch_try_index) { }
+
DECLARE_INSTRUCTION(TargetEntry)
virtual intptr_t PredecessorCount() const {
@@ -941,7 +963,6 @@ class TargetEntryInstr : public BlockEntryInstr {
ASSERT(IsCatchEntry());
return catch_try_index_;
}
- void set_catch_try_index(intptr_t index) { catch_try_index_ = index; }
virtual void PrepareEntry(FlowGraphCompiler* compiler);
@@ -956,7 +977,7 @@ class TargetEntryInstr : public BlockEntryInstr {
}
BlockEntryInstr* predecessor_;
- intptr_t catch_try_index_;
+ const intptr_t catch_try_index_;
DISALLOW_COPY_AND_ASSIGN(TargetEntryInstr);
};
@@ -1145,7 +1166,7 @@ class PhiInstr : public Definition {
virtual void PrintToVisualizer(BufferFormatter* f) const;
private:
- friend class ConstantPropagator; // Direct access to inputs_.
+ friend class JoinEntryInstr; // Direct access to inputs_ array.
JoinEntryInstr* block_;
GrowableArray<Value*> inputs_;
« no previous file with comments | « runtime/vm/growable_array.h ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698