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

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
Index: runtime/vm/flow_graph_compiler_x64.cc
===================================================================
--- runtime/vm/flow_graph_compiler_x64.cc (revision 4911)
+++ runtime/vm/flow_graph_compiler_x64.cc (working copy)
@@ -16,6 +16,7 @@
namespace dart {
+DECLARE_FLAG(bool, enable_type_checks);
DECLARE_FLAG(bool, print_ast);
DECLARE_FLAG(bool, print_scopes);
DECLARE_FLAG(bool, trace_functions);
@@ -32,9 +33,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();
@@ -176,6 +185,46 @@
}
+void FlowGraphCompiler::VisitLoadInstanceField(LoadInstanceFieldComp* comp) {
+ LoadValue(comp->instance()); // -> RAX.
+ __ movq(RAX, FieldAddress(RAX, comp->field_offset()));
+}
+
+
+void FlowGraphCompiler::VisitStoreInstanceField(StoreInstanceFieldComp* comp) {
+ LoadValue(comp->value());
+ if (FLAG_enable_type_checks) {
+ GenerateAssertAssignable(comp->node_id(),
Kevin Millikin (Google) 2012/03/05 11:02:41 There is an AssertAssignableComp that can go in th
srdjan 2012/03/05 18:35:21 Moved to graph builder.
+ comp->token_index(),
+ AbstractType::ZoneHandle(comp->field_type()),
+ String::ZoneHandle(comp->field_name()));
+ }
+ __ 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());
+ if (FLAG_enable_type_checks) {
srdjan 2012/03/05 18:35:21 Removed here as well.
+ GenerateAssertAssignable(comp->node_id(),
+ comp->token_index(),
+ AbstractType::ZoneHandle(comp->field().type()),
+ String::ZoneHandle(comp->field().name()));
+ }
+ __ 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.
@@ -190,7 +239,6 @@
__ popq(RAX);
}
-
void FlowGraphCompiler::VisitInstanceSetter(InstanceSetterComp* comp) {
// Preserve the second argument under the arguments as the result of the
// computation, then call the getter.

Powered by Google App Engine
This is Rietveld 408576698