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

Unified Diff: runtime/vm/intermediate_language.h

Issue 10453098: Move Throw and ReThrow to the location based code generation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Move Branch as well, introduce base class for instruction with inputs Created 8 years, 7 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: runtime/vm/intermediate_language.h
diff --git a/runtime/vm/intermediate_language.h b/runtime/vm/intermediate_language.h
index 280847c7f3fbb41833ab7caf66c386b965260151..9e066b52d336c7a871b3614f8d5cbbb2b28a829c 100644
--- a/runtime/vm/intermediate_language.h
+++ b/runtime/vm/intermediate_language.h
@@ -1431,7 +1431,7 @@ FOR_EACH_INSTRUCTION(INSTRUCTION_TYPE_CHECK)
// Returns structure describing location constraints required
// to emit native code for this instruction.
- virtual LocationSummary* locs() const {
+ virtual LocationSummary* locs() {
// TODO(vegorov): This should be pure virtual method.
// However we are temporary using NULL for instructions that
// were not converted to the location based code generation yet.
@@ -1449,6 +1449,25 @@ FOR_EACH_INSTRUCTION(INSTRUCTION_TYPE_CHECK)
};
+class InstructionWithInputs : public Instruction {
+ public:
+ InstructionWithInputs() : locs_(NULL) {
+ }
+
+ virtual LocationSummary* locs() {
+ if (locs_ == NULL) {
+ locs_ = MakeLocationSummary();
+ }
+ return locs_;
+ }
+
+ virtual LocationSummary* MakeLocationSummary() const = 0;
+
+ private:
+ LocationSummary* locs_;
srdjan 2012/05/31 16:00:53 Add DISALLOW_COPY_AND_ASSIGN. Generally I am not
+};
+
+
// Basic block entries are administrative nodes. There is a distinguished
// graph entry with no predecessor. Joins are the only nodes with multiple
// predecessors. Targets are all other basic block entries. The types
@@ -1651,7 +1670,7 @@ class DoInstr : public Instruction {
virtual void RecordAssignedVars(BitVector* assigned_vars);
- virtual LocationSummary* locs() const {
+ virtual LocationSummary* locs() {
return computation()->locs();
}
@@ -1702,7 +1721,7 @@ class BindInstr : public Instruction {
virtual void RecordAssignedVars(BitVector* assigned_vars);
- virtual LocationSummary* locs() const {
+ virtual LocationSummary* locs() {
return computation()->locs();
}
@@ -1740,7 +1759,7 @@ class ReturnInstr : public Instruction {
};
-class ThrowInstr : public Instruction {
+class ThrowInstr : public InstructionWithInputs {
public:
ThrowInstr(intptr_t token_index,
intptr_t try_index,
@@ -1765,6 +1784,10 @@ class ThrowInstr : public Instruction {
ASSERT(successor_ == NULL);
}
+ virtual LocationSummary* MakeLocationSummary() const;
+
+ virtual void EmitNativeCode(FlowGraphCompiler* compiler);
+
private:
const intptr_t token_index_;
const intptr_t try_index_;
@@ -1775,7 +1798,7 @@ class ThrowInstr : public Instruction {
};
-class ReThrowInstr : public Instruction {
+class ReThrowInstr : public InstructionWithInputs {
public:
ReThrowInstr(intptr_t token_index,
intptr_t try_index,
@@ -1806,6 +1829,10 @@ class ReThrowInstr : public Instruction {
ASSERT(successor_ == NULL);
}
+ virtual LocationSummary* MakeLocationSummary() const;
+
+ virtual void EmitNativeCode(FlowGraphCompiler* compiler);
+
private:
const intptr_t token_index_;
const intptr_t try_index_;
@@ -1817,7 +1844,7 @@ class ReThrowInstr : public Instruction {
};
-class BranchInstr : public Instruction {
+class BranchInstr : public InstructionWithInputs {
public:
explicit BranchInstr(Value* value)
: value_(value),
@@ -1844,6 +1871,10 @@ class BranchInstr : public Instruction {
GrowableArray<BitVector*>* assigned_vars,
intptr_t variable_count);
+ virtual LocationSummary* MakeLocationSummary() const;
+
+ virtual void EmitNativeCode(FlowGraphCompiler* compiler);
+
private:
Value* value_;
TargetEntryInstr* true_successor_;
@@ -1885,7 +1916,7 @@ class FlowGraphVisitor : public ValueObject {
// Map a block number in a forward iteration into the block number in the
// corresponding reverse iteration. Used to obtain an index into
// block_order for reverse iterations.
- intptr_t reverse_index(intptr_t index) {
+ intptr_t reverse_index(intptr_t index) const {
return block_order_.length() - index - 1;
}

Powered by Google App Engine
This is Rietveld 408576698