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

Unified Diff: runtime/vm/intermediate_language.h

Issue 9586024: Add Load/Store Static/Instance fields. (Closed) Base URL: http://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
« no previous file with comments | « 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
===================================================================
--- runtime/vm/intermediate_language.h (revision 4963)
+++ runtime/vm/intermediate_language.h (working copy)
@@ -29,6 +29,10 @@
// | NativeCall <NativeBodyNode>
// | StoreIndexed <StoreIndexedNode> <Value> <Value> <Value>
// | InstanceSetter <InstanceSetterNode> <Value> <Value>
+// | LoadInstanceField <LoadInstanceFieldNode> <Value>
+// | StoreInstanceField <StoreInstanceFieldNode> <Value> <Value>
+// | LoadStaticField <Field>
+// | StoreStaticField <StoreStaticFieldNode> <Value>
//
// <Value> ::=
// Temp <int>
@@ -54,6 +58,10 @@
M(NativeCall, NativeCallComp) \
M(StoreIndexed, StoreIndexedComp) \
M(InstanceSetter, InstanceSetterComp) \
+ M(LoadInstanceField, LoadInstanceFieldComp) \
+ M(StoreInstanceField, StoreInstanceFieldComp) \
+ M(LoadStaticField, LoadStaticFieldComp) \
+ M(StoreStaticField, StoreStaticFieldComp)
#define FORWARD_DECLARATION(ShortName, ClassName) class ClassName;
@@ -285,6 +293,92 @@
};
+class LoadInstanceFieldComp : public Computation {
+ public:
+ LoadInstanceFieldComp(LoadInstanceFieldNode* ast_node, Value* instance)
+ : ast_node_(*ast_node), instance_(instance) {
+ ASSERT(instance_ != NULL);
+ }
+
+ DECLARE_COMPUTATION(LoadInstanceFieldComp)
+
+ const Field& field() const { return ast_node_.field(); }
+
+ Value* instance() const { return instance_; }
+
+ private:
+ const LoadInstanceFieldNode& ast_node_;
+ Value* instance_;
+
+ DISALLOW_COPY_AND_ASSIGN(LoadInstanceFieldComp);
+};
+
+
+class StoreInstanceFieldComp : public Computation {
+ public:
+ StoreInstanceFieldComp(StoreInstanceFieldNode* ast_node,
+ Value* instance,
+ Value* value)
+ : ast_node_(*ast_node), instance_(instance), value_(value) {
+ ASSERT(instance_ != NULL);
+ ASSERT(value_ != NULL);
+ }
+
+ DECLARE_COMPUTATION(StoreInstanceFieldComp)
+
+ intptr_t node_id() const { return ast_node_.id(); }
+ intptr_t token_index() const { return ast_node_.token_index(); }
+ const Field& field() const { return ast_node_.field(); }
+
+ Value* instance() const { return instance_; }
+ Value* value() const { return value_; }
+
+ private:
+ const StoreInstanceFieldNode& ast_node_;
+ Value* instance_;
+ Value* value_;
+
+ DISALLOW_COPY_AND_ASSIGN(StoreInstanceFieldComp);
+};
+
+
+class LoadStaticFieldComp : public Computation {
+ public:
+ explicit LoadStaticFieldComp(const Field& field) : field_(field) {}
+
+ DECLARE_COMPUTATION(LoadStaticFieldComp);
+
+ const Field& field() const { return field_; }
+
+ private:
+ const Field& field_;
+
+ DISALLOW_COPY_AND_ASSIGN(LoadStaticFieldComp);
+};
+
+
+class StoreStaticFieldComp : public Computation {
+ public:
+ StoreStaticFieldComp(StoreStaticFieldNode* ast_node, Value* value)
+ : ast_node_(*ast_node), value_(value) {
+ ASSERT(value != NULL);
+ }
+
+ DECLARE_COMPUTATION(StoreStaticFieldComp);
+
+ intptr_t token_index() const { return ast_node_.token_index(); }
+ intptr_t node_id() const { return ast_node_.id(); }
+ const Field& field() const { return ast_node_.field(); }
+ Value* value() const { return value_; }
+
+ private:
+ const StoreStaticFieldNode& ast_node_;
+ Value* value_;
+
+ DISALLOW_COPY_AND_ASSIGN(StoreStaticFieldComp);
+};
+
+
// Not simply an InstanceCall because it has somewhat more complicated
// semantics: the value operand is preserved before the call.
class StoreIndexedComp : public Computation {
« no previous file with comments | « 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