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

Unified Diff: vm/intermediate_language.h

Issue 10665022: Make IL instructions a doubly-linked list within basic blocks. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: use_ssa flag off by default Created 8 years, 6 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
Index: vm/intermediate_language.h
===================================================================
--- vm/intermediate_language.h (revision 9056)
+++ vm/intermediate_language.h (working copy)
@@ -1734,7 +1734,7 @@
class Instruction : public ZoneAllocated {
public:
- Instruction() : cid_(-1), ic_data_(NULL) {
+ Instruction() : cid_(-1), ic_data_(NULL), successor_(NULL), previous_(NULL) {
Isolate* isolate = Isolate::Current();
cid_ = Computation::GetNextCid(isolate);
ic_data_ = Computation::GetICDataForCid(cid_, isolate);
@@ -1760,9 +1760,15 @@
// Visiting support.
virtual Instruction* Accept(FlowGraphVisitor* visitor) = 0;
- virtual Instruction* StraightLineSuccessor() const = 0;
- virtual void SetSuccessor(Instruction* instr) = 0;
+ Instruction* StraightLineSuccessor() const { return successor_; }
srdjan 2012/06/25 15:57:16 Since it is a very simple setter now, maybe rename
Florian Schneider 2012/07/02 09:20:42 Done.
+ void SetSuccessor(Instruction* instr);
+ Instruction* Previous() const { return previous_; }
srdjan 2012/06/25 15:57:16 s/Previous/previous/
Florian Schneider 2012/07/02 09:20:42 Done.
+ void SetPrevious(Instruction* instr);
+
+ // Remove instruction from the graph.
+ void RemoveFromGraph();
+
// Normal instructions can have 0 (inside a block) or 1 (last instruction in
// a block) successors. Branch instruction with >1 successors override this
// function.
@@ -1832,6 +1838,8 @@
private:
intptr_t cid_;
ICData* ic_data_;
+ Instruction* successor_;
+ Instruction* previous_;
DISALLOW_COPY_AND_ASSIGN(Instruction);
};
@@ -1940,9 +1948,6 @@
}
virtual void AddPredecessor(BlockEntryInstr* predecessor) { UNREACHABLE(); }
- virtual Instruction* StraightLineSuccessor() const { return NULL; }
- virtual void SetSuccessor(Instruction* instr) { UNREACHABLE(); }
-
virtual intptr_t SuccessorCount() const;
virtual BlockEntryInstr* SuccessorAt(intptr_t index) const;
@@ -1975,7 +1980,6 @@
JoinEntryInstr()
: BlockEntryInstr(),
predecessors_(2), // Two is the assumed to be the common case.
- successor_(NULL),
phis_(NULL),
phi_count_(0) { }
@@ -1989,13 +1993,6 @@
predecessors_.Add(predecessor);
}
- virtual Instruction* StraightLineSuccessor() const {
- return successor_;
- }
- virtual void SetSuccessor(Instruction* instr) {
- successor_ = instr;
- }
-
ZoneGrowableArray<PhiInstr*>* phis() const { return phis_; }
virtual void PrepareEntry(FlowGraphCompiler* compiler);
@@ -2006,7 +2003,6 @@
private:
ZoneGrowableArray<BlockEntryInstr*> predecessors_;
- Instruction* successor_;
ZoneGrowableArray<PhiInstr*>* phis_;
intptr_t phi_count_;
@@ -2019,14 +2015,12 @@
TargetEntryInstr()
: BlockEntryInstr(),
predecessor_(NULL),
- successor_(NULL),
try_index_(CatchClauseNode::kInvalidTryIndex) { }
// Used for exception catch entries.
explicit TargetEntryInstr(intptr_t try_index)
: BlockEntryInstr(),
predecessor_(NULL),
- successor_(NULL),
try_index_(try_index) { }
DECLARE_INSTRUCTION(TargetEntry)
@@ -2043,13 +2037,6 @@
predecessor_ = predecessor;
}
- virtual Instruction* StraightLineSuccessor() const {
- return successor_;
- }
- virtual void SetSuccessor(Instruction* instr) {
- successor_ = instr;
- }
-
bool HasTryIndex() const {
return try_index_ != CatchClauseNode::kInvalidTryIndex;
}
@@ -2063,7 +2050,6 @@
private:
BlockEntryInstr* predecessor_;
- Instruction* successor_;
const intptr_t try_index_;
DISALLOW_COPY_AND_ASSIGN(TargetEntryInstr);
@@ -2073,7 +2059,7 @@
class DoInstr : public Instruction {
public:
explicit DoInstr(Computation* computation)
- : computation_(computation), successor_(NULL) {
+ : computation_(computation) {
ASSERT(computation != NULL);
computation->set_instr(this);
}
@@ -2083,14 +2069,6 @@
Computation* computation() const { return computation_; }
virtual void replace_computation(Computation* value) { computation_ = value; }
- virtual Instruction* StraightLineSuccessor() const {
- return successor_;
- }
-
- virtual void SetSuccessor(Instruction* instr) {
- successor_ = instr;
- }
-
virtual void RecordAssignedVars(BitVector* assigned_vars);
virtual LocationSummary* locs() {
@@ -2103,7 +2081,6 @@
private:
Computation* computation_;
- Instruction* successor_;
DISALLOW_COPY_AND_ASSIGN(DoInstr);
};
@@ -2134,7 +2111,7 @@
class BindInstr : public Definition {
public:
explicit BindInstr(Computation* computation)
- : computation_(computation), successor_(NULL) {
+ : computation_(computation) {
ASSERT(computation != NULL);
computation->set_instr(this);
}
@@ -2144,14 +2121,6 @@
Computation* computation() const { return computation_; }
virtual void replace_computation(Computation* value) { computation_ = value; }
- virtual Instruction* StraightLineSuccessor() const {
- return successor_;
- }
-
- virtual void SetSuccessor(Instruction* instr) {
- successor_ = instr;
- }
-
// Static type of the underlying computation.
virtual RawAbstractType* StaticType() const {
return computation()->StaticType();
@@ -2167,7 +2136,6 @@
private:
Computation* computation_;
- Instruction* successor_;
DISALLOW_COPY_AND_ASSIGN(BindInstr);
};
@@ -2183,9 +2151,6 @@
DECLARE_INSTRUCTION(Phi)
- virtual Instruction* StraightLineSuccessor() const { return NULL; }
- virtual void SetSuccessor(Instruction* instr) { UNREACHABLE(); }
-
private:
GrowableArray<Value*> inputs_;
@@ -2205,9 +2170,6 @@
Value* value() const { return value_; }
intptr_t token_pos() const { return token_pos_; }
- virtual Instruction* StraightLineSuccessor() const { return NULL; }
- virtual void SetSuccessor(Instruction* instr) { UNREACHABLE(); }
-
virtual LocationSummary* MakeLocationSummary() const;
virtual void EmitNativeCode(FlowGraphCompiler* compiler);
@@ -2228,8 +2190,7 @@
: InstructionWithInputs(),
token_pos_(token_pos),
try_index_(try_index),
- exception_(exception),
- successor_(NULL) {
+ exception_(exception) {
ASSERT(exception_ != NULL);
}
@@ -2239,13 +2200,6 @@
intptr_t try_index() const { return try_index_; }
Value* exception() const { return exception_; }
- // Parser can generate a throw within an expression tree. We never
- // add successor instructions to the graph.
- virtual Instruction* StraightLineSuccessor() const { return NULL; }
- virtual void SetSuccessor(Instruction* instr) {
- ASSERT(successor_ == NULL);
- }
-
virtual LocationSummary* MakeLocationSummary() const;
virtual void EmitNativeCode(FlowGraphCompiler* compiler);
@@ -2254,7 +2208,6 @@
const intptr_t token_pos_;
const intptr_t try_index_;
Value* exception_;
- Instruction* successor_;
DISALLOW_COPY_AND_ASSIGN(ThrowInstr);
};
@@ -2270,8 +2223,7 @@
token_pos_(token_pos),
try_index_(try_index),
exception_(exception),
- stack_trace_(stack_trace),
- successor_(NULL) {
+ stack_trace_(stack_trace) {
ASSERT(exception_ != NULL);
ASSERT(stack_trace_ != NULL);
}
@@ -2283,15 +2235,6 @@
Value* exception() const { return exception_; }
Value* stack_trace() const { return stack_trace_; }
- // Parser can generate a rethrow within an expression tree. We
- // never add successor instructions to the graph.
- virtual Instruction* StraightLineSuccessor() const {
- return NULL;
- }
- virtual void SetSuccessor(Instruction* instr) {
- ASSERT(successor_ == NULL);
- }
-
virtual LocationSummary* MakeLocationSummary() const;
virtual void EmitNativeCode(FlowGraphCompiler* compiler);
@@ -2301,7 +2244,6 @@
const intptr_t try_index_;
Value* exception_;
Value* stack_trace_;
- Instruction* successor_;
DISALLOW_COPY_AND_ASSIGN(ReThrowInstr);
};
@@ -2326,9 +2268,6 @@
TargetEntryInstr** true_successor_address() { return &true_successor_; }
TargetEntryInstr** false_successor_address() { return &false_successor_; }
- virtual Instruction* StraightLineSuccessor() const { return NULL; }
- virtual void SetSuccessor(Instruction* instr) { UNREACHABLE(); }
-
virtual intptr_t SuccessorCount() const;
virtual BlockEntryInstr* SuccessorAt(intptr_t index) const;

Powered by Google App Engine
This is Rietveld 408576698