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

Unified Diff: runtime/vm/intermediate_language.h

Issue 9601011: Implement postfix indexed increment. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 10 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
« runtime/vm/flow_graph_builder.cc ('K') | « runtime/vm/flow_graph_compiler_x64.cc ('k') | no next file » | 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 05fe05d6610b58a7f965761d91a9eb9092d19373..dc1e2a51e0cc9ed9865f4885dc6c571831e1017a 100644
--- a/runtime/vm/intermediate_language.h
+++ b/runtime/vm/intermediate_language.h
@@ -20,6 +20,8 @@ class LocalVariable;
//
// <Computation> ::=
// <Value>
+// | CopyTemp <int>
+// | SetTemp <int>
// | AssertAssignable <Value> <AbstractType>
// | InstanceCall <AstNode> <String> <Value> ...
// | StaticCall <StaticCallNode> <Value> ...
@@ -45,6 +47,8 @@ class LocalVariable;
// (including the values) typename and classname.
#define FOR_EACH_COMPUTATION(M) \
FOR_EACH_VALUE(M) \
+ M(CopyTemp, CopyTempComp) \
+ M(SetTemp, SetTempComp) \
M(AssertAssignable, AssertAssignableComp) \
M(InstanceCall, InstanceCallComp) \
M(StaticCall, StaticCallComp) \
@@ -132,6 +136,46 @@ class ConstantVal: public Value {
#undef DECLARE_VALUE
+// A computation that produces a copy of a (random-access) temporary. The
+// index is relative to the last temporary allocated (e.g., the last
+// temporary is index 0, the one before that is -1, etc.). This instruction
+// is used in the non-optimizing backend and compiled away in the optimizing
+// backend.
+class CopyTempComp : public Computation {
+ public:
+ explicit CopyTempComp(intptr_t index) : index_(index) { }
+
+ DECLARE_COMPUTATION(CopyTemp)
+
+ intptr_t index() const { return index_; }
+
+ private:
+ const intptr_t index_;
+
+ DISALLOW_COPY_AND_ASSIGN(CopyTempComp);
+};
+
+
+// A computation that assigns (a duplicate of) the last allocated temporary
+// to a random-access already allocated temporary. The index is relative to
+// the last temporary allocated (e.g., the last temporary is index 0, the
+// one before that is -1, etc.). This instruction is used in the
+// non-optimizing backend and compiled away in the optimizing backend.
+class SetTempComp : public Computation {
+ public:
+ explicit SetTempComp(intptr_t index) : index_(index) { }
+
+ DECLARE_COMPUTATION(SetTemp)
+
+ intptr_t index() const { return index_; }
+
+ private:
+ const intptr_t index_;
+
+ DISALLOW_COPY_AND_ASSIGN(SetTempComp);
+};
+
+
class AssertAssignableComp : public Computation {
public:
AssertAssignableComp(Value* value, const AbstractType& type)
@@ -152,12 +196,14 @@ class AssertAssignableComp : public Computation {
class InstanceCallComp : public Computation {
public:
- InstanceCallComp(AstNode* node,
+ InstanceCallComp(intptr_t node_id,
+ intptr_t token_index,
const String& function_name,
ZoneGrowableArray<Value*>* arguments,
const Array& argument_names,
intptr_t checked_argument_count)
- : ast_node_(*node),
+ : node_id_(node_id),
+ token_index_(token_index),
function_name_(function_name),
arguments_(arguments),
argument_names_(argument_names),
@@ -169,10 +215,8 @@ class InstanceCallComp : public Computation {
DECLARE_COMPUTATION(InstanceCall)
- // Accessors forwarded to the AST node.
- intptr_t node_id() const { return ast_node_.id(); }
- intptr_t token_index() const { return ast_node_.token_index(); }
-
+ intptr_t node_id() const { return node_id_; }
+ intptr_t token_index() const { return token_index_; }
const String& function_name() const { return function_name_; }
int ArgumentCount() const { return arguments_->length(); }
Value* ArgumentAt(int index) const { return (*arguments_)[index]; }
@@ -180,7 +224,8 @@ class InstanceCallComp : public Computation {
intptr_t checked_argument_count() const { return checked_argument_count_; }
private:
- const AstNode& ast_node_;
+ const intptr_t node_id_;
+ const intptr_t token_index_;
const String& function_name_;
ZoneGrowableArray<Value*>* const arguments_;
const Array& argument_names_;
« runtime/vm/flow_graph_builder.cc ('K') | « runtime/vm/flow_graph_compiler_x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698