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

Unified Diff: runtime/vm/intermediate_language.h

Issue 9699090: Make Throw and ReThrow instructions instead of computations. That way they can terminate a basic bl… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 9 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/flow_graph_compiler_x64.cc ('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
===================================================================
--- runtime/vm/intermediate_language.h (revision 5537)
+++ runtime/vm/intermediate_language.h (working copy)
@@ -40,8 +40,6 @@
// | CreateArray <ArrayNode> <Value> ...
// | CreateClosure <ClosureNode>
// | AllocateObject <ConstructorCallNode>
-// | Throw <Value>
-// | ReThrow <Value> <Value>
// | NativeLoadField <Value> <intptr_t>
// | ExtractFactoryTypeArgumentsComp <ConstructorCallNode> <Value>
// | ExtractConstructorTypeArgumentsComp <ConstructorCallNode> <Value>
@@ -82,8 +80,6 @@
M(CreateArray, CreateArrayComp) \
M(CreateClosure, CreateClosureComp) \
M(AllocateObject, AllocateObjectComp) \
- M(Throw, ThrowComp) \
- M(ReThrow, ReThrowComp) \
M(NativeLoadField, NativeLoadFieldComp) \
M(ExtractFactoryTypeArguments, ExtractFactoryTypeArgumentsComp) \
M(ExtractConstructorTypeArguments, ExtractConstructorTypeArgumentsComp) \
@@ -647,61 +643,6 @@
};
-class ThrowComp : public Computation {
- public:
- explicit ThrowComp(intptr_t node_id,
- intptr_t token_index,
- Value* exception)
- : node_id_(node_id), token_index_(token_index), exception_(exception) {
- ASSERT(exception_ != NULL);
- }
-
- DECLARE_COMPUTATION(Throw)
-
- intptr_t node_id() const { return node_id_; }
- intptr_t token_index() const { return token_index_; }
- Value* exception() const { return exception_; }
-
- private:
- intptr_t node_id_;
- intptr_t token_index_;
- Value* exception_;
-
- DISALLOW_COPY_AND_ASSIGN(ThrowComp);
-};
-
-
-class ReThrowComp : public Computation {
- public:
- ReThrowComp(intptr_t node_id,
- intptr_t token_index,
- Value* exception,
- Value* stack_trace)
- : node_id_(node_id),
- token_index_(token_index),
- exception_(exception),
- stack_trace_(stack_trace) {
- ASSERT(exception_ != NULL);
- ASSERT(stack_trace_ != NULL);
- }
-
- DECLARE_COMPUTATION(ReThrow)
-
- intptr_t node_id() const { return node_id_; }
- intptr_t token_index() const { return token_index_; }
- Value* exception() const { return exception_; }
- Value* stack_trace() const { return stack_trace_; }
-
- private:
- intptr_t node_id_;
- intptr_t token_index_;
- Value* exception_;
- Value* stack_trace_;
-
- DISALLOW_COPY_AND_ASSIGN(ReThrowComp);
-};
-
-
class NativeLoadFieldComp : public Computation {
public:
NativeLoadFieldComp(Value* value, intptr_t offset_in_bytes)
@@ -830,6 +771,8 @@
M(Do) \
M(Bind) \
M(Return) \
+ M(Throw) \
+ M(ReThrow) \
M(Branch) \
@@ -1070,7 +1013,9 @@
class ReturnInstr : public Instruction {
public:
ReturnInstr(Value* value, intptr_t token_index)
- : Instruction(), value_(value), token_index_(token_index) { }
+ : Instruction(), value_(value), token_index_(token_index) {
+ ASSERT(value_ != NULL);
+ }
DECLARE_INSTRUCTION(Return)
@@ -1089,6 +1034,70 @@
};
+class ThrowInstr : public Instruction {
+ public:
+ ThrowInstr(intptr_t node_id, intptr_t token_index, Value* exception)
+ : Instruction(),
+ node_id_(node_id),
+ token_index_(token_index),
+ exception_(exception) {
+ ASSERT(exception_ != NULL);
+ }
+
+ DECLARE_INSTRUCTION(Throw)
+
+ intptr_t node_id() const { return node_id_; }
+ intptr_t token_index() const { return token_index_; }
+ Value* exception() const { return exception_; }
+
+ virtual void SetSuccessor(Instruction* instr) { UNREACHABLE(); }
+
+ virtual void Postorder(GrowableArray<BlockEntryInstr*>* block_entries);
+
+ private:
+ intptr_t node_id_;
+ intptr_t token_index_;
+ Value* exception_;
+
+ DISALLOW_COPY_AND_ASSIGN(ThrowInstr);
+};
+
+
+class ReThrowInstr : public Instruction {
+ public:
+ ReThrowInstr(intptr_t node_id,
+ intptr_t token_index,
+ Value* exception,
+ Value* stack_trace)
+ : node_id_(node_id),
+ token_index_(token_index),
+ exception_(exception),
+ stack_trace_(stack_trace) {
+ ASSERT(exception_ != NULL);
+ ASSERT(stack_trace_ != NULL);
+ }
+
+ DECLARE_INSTRUCTION(ReThrow)
+
+ intptr_t node_id() const { return node_id_; }
+ intptr_t token_index() const { return token_index_; }
+ Value* exception() const { return exception_; }
+ Value* stack_trace() const { return stack_trace_; }
+
+ virtual void SetSuccessor(Instruction* instr) { UNREACHABLE(); }
+
+ virtual void Postorder(GrowableArray<BlockEntryInstr*>* block_entries);
+
+ private:
+ intptr_t node_id_;
+ intptr_t token_index_;
+ Value* exception_;
+ Value* stack_trace_;
+
+ DISALLOW_COPY_AND_ASSIGN(ReThrowInstr);
+};
+
+
class BranchInstr : public Instruction {
public:
explicit BranchInstr(Value* value)
« no previous file with comments | « runtime/vm/flow_graph_compiler_x64.cc ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698