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

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
Index: runtime/vm/intermediate_language.h
===================================================================
--- runtime/vm/intermediate_language.h (revision 4911)
+++ runtime/vm/intermediate_language.h (working copy)
@@ -28,6 +28,10 @@
// | StoreIndexed <Value> <Value> <Value> <Value>
// | StrictCompare <Token::kind> <Value> <Value>
// | NativeCall <NativeBodyNode>
+// | LoadInstanceField <LoadInstanceFieldNode> <Value>
+// | StoreInstanceField <StoreInstanceFieldNode> <Value> <Value>
+// | LoadStaticField <Field>
+// | StoreStaticField <StoreStaticFieldNode> <Value>
//
// <Value> ::=
// Temp <int>
@@ -53,6 +57,10 @@
M(NativeCall, NativeCallComp) \
M(StoreIndexed, StoreIndexedComp) \
M(InstanceSetter, InstanceSetterComp) \
+ M(StoreInstanceField, StoreInstanceFieldComp) \
+ M(LoadInstanceField, LoadInstanceFieldComp) \
+ M(LoadStaticField, LoadStaticFieldComp) \
+ M(StoreStaticField, StoreStaticFieldComp)
#define FORWARD_DECLARATION(ShortName, ClassName) class ClassName;
@@ -284,6 +292,95 @@
};
+class LoadInstanceFieldComp : public Computation {
+ public:
+ LoadInstanceFieldComp(LoadInstanceFieldNode* ast_node, Value* instance)
+ : ast_node_(*ast_node), instance_(instance) {
+ ASSERT(instance_ != NULL);
+ }
+
+ DECLARE_COMPUTATION(LoadInstanceFieldComp)
+
+ RawString* name() const { return ast_node_.field().name(); }
Kevin Millikin (Google) 2012/03/05 11:02:41 Might also just expose a const Field& accessor ins
srdjan 2012/03/05 18:35:21 Using Field type as suggested
+ intptr_t field_offset() const { return ast_node_.field().Offset(); }
+
+ 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(); }
+ RawString* field_name() const { return ast_node_.field().name(); }
+ RawAbstractType* field_type() const { return ast_node_.field().type(); }
+ intptr_t field_offset() const { return ast_node_.field().Offset(); }
+
+ 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 in a placeholder (the first
// operand is a preallocated slot that can be used).
« runtime/vm/flow_graph_compiler_x64.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