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

Unified Diff: runtime/vm/flow_graph_compiler_x64.cc

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.h ('k') | runtime/vm/intermediate_language.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_compiler_x64.cc
===================================================================
--- runtime/vm/flow_graph_compiler_x64.cc (revision 4963)
+++ runtime/vm/flow_graph_compiler_x64.cc (working copy)
@@ -32,9 +32,17 @@
Isolate::Current()->long_jump_base()->Jump(1, error);
}
-
#define __ assembler_->
+
+void FlowGraphCompiler::GenerateAssertAssignable(intptr_t node_id,
+ intptr_t token_index,
+ const AbstractType& dst_type,
+ const String& dst_name) {
+ Bailout("GenerateAssertAssignable");
+}
+
+
void FlowGraphCompiler::LoadValue(Value* value) {
if (value->IsConstant()) {
ConstantVal* constant = value->AsConstant();
@@ -86,6 +94,15 @@
}
+// Truee iff. the v2 is above v1 on stack, or one of them is constant.
+static bool VerifyValues(Value* v1, Value* v2) {
+ if (v1->IsTemp() && v2->IsTemp()) {
+ return (v1->AsTemp()->index() + 1) == v2->AsTemp()->index();
+ }
+ return true;
+}
+
+
void FlowGraphCompiler::EmitInstanceCall(intptr_t node_id,
intptr_t token_index,
const String& function_name,
@@ -176,6 +193,35 @@
}
+void FlowGraphCompiler::VisitLoadInstanceField(LoadInstanceFieldComp* comp) {
+ LoadValue(comp->instance()); // -> RAX.
+ __ movq(RAX, FieldAddress(RAX, comp->field().Offset()));
+}
+
+
+void FlowGraphCompiler::VisitStoreInstanceField(StoreInstanceFieldComp* comp) {
+ VerifyValues(comp->instance(), comp->value());
+ LoadValue(comp->value());
+ __ movq(R10, RAX);
+ LoadValue(comp->instance()); // -> RAX.
+ __ StoreIntoObject(RAX, FieldAddress(RAX, comp->field().Offset()), R10);
+}
+
+
+
+void FlowGraphCompiler::VisitLoadStaticField(LoadStaticFieldComp* comp) {
+ __ LoadObject(RDX, comp->field());
+ __ movq(RAX, FieldAddress(RDX, Field::value_offset()));
+}
+
+
+void FlowGraphCompiler::VisitStoreStaticField(StoreStaticFieldComp* comp) {
+ LoadValue(comp->value());
+ __ LoadObject(RDX, comp->field());
+ __ StoreIntoObject(RDX, FieldAddress(RDX, Field::value_offset()), RAX);
+}
+
+
void FlowGraphCompiler::VisitStoreIndexed(StoreIndexedComp* comp) {
// Call operator []= but preserve the third argument value under the
// arguments as the result of the computation.
« no previous file with comments | « runtime/vm/flow_graph_compiler_x64.h ('k') | runtime/vm/intermediate_language.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698