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

Unified Diff: vm/intermediate_language.h

Issue 10829141: Support Throw and ReThrow in SSA-based compiler. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 5 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 | « vm/il_printer.cc ('k') | vm/intermediate_language.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vm/intermediate_language.h
===================================================================
--- vm/intermediate_language.h (revision 10157)
+++ vm/intermediate_language.h (working copy)
@@ -1800,6 +1800,21 @@
virtual void PrintToVisualizer(BufferFormatter* f) const;
+#define DECLARE_CALL_INSTRUCTION(type) \
+ virtual void Accept(FlowGraphVisitor* visitor); \
+ virtual bool Is##type() const { return true; } \
+ virtual type##Instr* As##type() { return this; } \
+ virtual intptr_t InputCount() const { return 0; } \
+ virtual Value* InputAt(intptr_t i) const { \
+ UNREACHABLE(); \
+ return NULL; \
+ } \
+ virtual void SetInputAt(intptr_t i, Value* value) { UNREACHABLE(); } \
+ virtual const char* DebugName() const { return #type; } \
+ virtual void PrintTo(BufferFormatter* f) const; \
+ virtual void PrintToVisualizer(BufferFormatter* f) const;
+
+
class Instruction : public ZoneAllocated {
public:
Instruction()
@@ -1931,8 +1946,6 @@
public:
InstructionWithInputs() : locs_(NULL) { }
- virtual intptr_t ArgumentCount() const { return 0; }
-
virtual LocationSummary* locs() {
if (locs_ == NULL) {
locs_ = MakeLocationSummary();
@@ -2453,6 +2466,8 @@
DECLARE_INSTRUCTION(PushArgument)
+ virtual intptr_t ArgumentCount() const { return 0; }
+
Value* value() const { return value_; }
virtual LocationSummary* MakeLocationSummary() const;
@@ -2480,6 +2495,8 @@
DECLARE_INSTRUCTION(Return)
+ virtual intptr_t ArgumentCount() const { return 0; }
+
intptr_t cid() const { return cid_; }
intptr_t token_pos() const { return token_pos_; }
Value* value() const { return value_; }
@@ -2501,23 +2518,19 @@
class ThrowInstr : public InstructionWithInputs {
public:
- ThrowInstr(intptr_t token_pos,
- intptr_t try_index,
- Value* exception)
+ ThrowInstr(intptr_t token_pos, intptr_t try_index)
: InstructionWithInputs(),
cid_(Isolate::Current()->GetNextCid()),
token_pos_(token_pos),
- try_index_(try_index),
- exception_(exception) {
- ASSERT(exception_ != NULL);
- }
+ try_index_(try_index) { }
- DECLARE_INSTRUCTION(Throw)
+ DECLARE_CALL_INSTRUCTION(Throw)
+ virtual intptr_t ArgumentCount() const { return 1; }
+
intptr_t cid() const { return cid_; }
intptr_t token_pos() const { return token_pos_; }
intptr_t try_index() const { return try_index_; }
- Value* exception() const { return exception_; }
virtual LocationSummary* MakeLocationSummary() const;
@@ -2529,7 +2542,6 @@
const intptr_t cid_; // Computation/instruction id.
const intptr_t token_pos_;
const intptr_t try_index_;
- Value* exception_;
DISALLOW_COPY_AND_ASSIGN(ThrowInstr);
};
@@ -2538,26 +2550,19 @@
class ReThrowInstr : public InstructionWithInputs {
public:
ReThrowInstr(intptr_t token_pos,
- intptr_t try_index,
- Value* exception,
- Value* stack_trace)
+ intptr_t try_index)
: InstructionWithInputs(),
cid_(Isolate::Current()->GetNextCid()),
token_pos_(token_pos),
- try_index_(try_index),
- exception_(exception),
- stack_trace_(stack_trace) {
- ASSERT(exception_ != NULL);
- ASSERT(stack_trace_ != NULL);
- }
+ try_index_(try_index) { }
- DECLARE_INSTRUCTION(ReThrow)
+ DECLARE_CALL_INSTRUCTION(ReThrow)
+ virtual intptr_t ArgumentCount() const { return 2; }
+
intptr_t cid() const { return cid_; }
intptr_t token_pos() const { return token_pos_; }
intptr_t try_index() const { return try_index_; }
- Value* exception() const { return exception_; }
- Value* stack_trace() const { return stack_trace_; }
virtual LocationSummary* MakeLocationSummary() const;
@@ -2569,8 +2574,6 @@
const intptr_t cid_; // Computation/instruction id.
const intptr_t token_pos_;
const intptr_t try_index_;
- Value* exception_;
- Value* stack_trace_;
DISALLOW_COPY_AND_ASSIGN(ReThrowInstr);
};
@@ -2585,6 +2588,8 @@
DECLARE_INSTRUCTION(Goto)
+ virtual intptr_t ArgumentCount() const { return 0; }
+
JoinEntryInstr* successor() const { return successor_; }
void set_successor(JoinEntryInstr* successor) { successor_ = successor; }
virtual intptr_t SuccessorCount() const;
@@ -2649,6 +2654,8 @@
DECLARE_INSTRUCTION(Branch)
+ virtual intptr_t ArgumentCount() const { return 0; }
+
Value* left() const { return left_; }
Value* right() const { return right_; }
Token::Kind kind() const { return kind_; }
« no previous file with comments | « vm/il_printer.cc ('k') | vm/intermediate_language.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698