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

Unified Diff: runtime/vm/flow_graph_optimizer.cc

Issue 179443004: VM: Replace StoreVMField with StoreInstanceField. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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_inliner.cc ('k') | runtime/vm/flow_graph_type_propagator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_optimizer.cc
===================================================================
--- runtime/vm/flow_graph_optimizer.cc (revision 33058)
+++ runtime/vm/flow_graph_optimizer.cc (working copy)
@@ -2216,10 +2216,9 @@
}
LoadFieldInstr* load = new LoadFieldInstr(
new Value(call->ArgumentAt(0)),
- field.Offset(),
+ &field,
AbstractType::ZoneHandle(field.type()),
field.is_final());
- load->set_field(&field);
if (field.guarded_cid() != kIllegalCid) {
if (!field.is_nullable() || (field.guarded_cid() == kNullCid)) {
load->set_result_cid(field.guarded_cid());
@@ -2692,11 +2691,11 @@
// This is an internal method, no need to check argument types.
Definition* array = call->ArgumentAt(0);
Definition* value = call->ArgumentAt(1);
- StoreVMFieldInstr* store = new StoreVMFieldInstr(
- new Value(array),
+ StoreInstanceFieldInstr* store = new StoreInstanceFieldInstr(
GrowableObjectArray::data_offset(),
+ new Value(array),
new Value(value),
- Type::ZoneHandle());
+ kEmitStoreBarrier);
ReplaceCall(call, store);
return true;
}
@@ -2708,11 +2707,11 @@
// range.
Definition* array = call->ArgumentAt(0);
Definition* value = call->ArgumentAt(1);
- StoreVMFieldInstr* store = new StoreVMFieldInstr(
- new Value(array),
+ StoreInstanceFieldInstr* store = new StoreInstanceFieldInstr(
GrowableObjectArray::length_offset(),
+ new Value(array),
new Value(value),
- Type::ZoneHandle());
+ kEmitStoreBarrier);
ReplaceCall(call, store);
return true;
}
@@ -4963,27 +4962,21 @@
}
case Instruction::kStoreInstanceField: {
- StoreInstanceFieldInstr* store_instance_field =
+ StoreInstanceFieldInstr* store =
instr->AsStoreInstanceField();
- kind_ = kField;
- representation_ = store_instance_field->
- RequiredInputRepresentation(StoreInstanceFieldInstr::kValuePos);
- instance_ =
- OriginalDefinition(store_instance_field->instance()->definition());
- field_ = &store_instance_field->field();
+ representation_ = store->RequiredInputRepresentation(
+ StoreInstanceFieldInstr::kValuePos);
+ instance_ = OriginalDefinition(store->instance()->definition());
+ if (!store->field().IsNull()) {
+ kind_ = kField;
+ field_ = &store->field();
+ } else {
+ kind_ = kVMField;
+ offset_in_bytes_ = store->offset_in_bytes();
+ }
break;
}
- case Instruction::kStoreVMField: {
- StoreVMFieldInstr* store_vm_field = instr->AsStoreVMField();
- kind_ = kVMField;
- representation_ = store_vm_field->
- RequiredInputRepresentation(StoreVMFieldInstr::kValuePos);
- instance_ = OriginalDefinition(store_vm_field->dest()->definition());
- offset_in_bytes_ = store_vm_field->offset_in_bytes();
- break;
- }
-
case Instruction::kLoadStaticField:
kind_ = kField;
representation_ = instr->AsLoadStaticField()->representation();
@@ -5265,15 +5258,13 @@
instr->AsStoreInstanceField();
if (store_instance_field != NULL) {
Definition* instance = store_instance_field->instance()->definition();
- return Alias::Field(GetInstanceFieldId(instance,
- store_instance_field->field()));
+ if (!store_instance_field->field().IsNull()) {
+ return Alias::Field(GetInstanceFieldId(instance,
+ store_instance_field->field()));
+ }
+ return Alias::VMField(store_instance_field->offset_in_bytes());
}
- StoreVMFieldInstr* store_vm_field = instr->AsStoreVMField();
- if (store_vm_field != NULL) {
- return Alias::VMField(store_vm_field->offset_in_bytes());
- }
-
if (instr->IsStoreContext()) {
return Alias::CurrentContext();
}
@@ -5375,8 +5366,6 @@
use = use->next_use()) {
Instruction* instr = use->instruction();
if (instr->IsPushArgument() ||
- (instr->IsStoreVMField()
- && (use->use_index() != StoreVMFieldInstr::kObjectPos)) ||
(instr->IsStoreInstanceField()
&& (use->use_index() != StoreInstanceFieldInstr::kInstancePos)) ||
instr->IsStoreStaticField() ||
@@ -5577,11 +5566,6 @@
return store_instance_field->value()->definition();
}
- StoreVMFieldInstr* store_vm_field = instr->AsStoreVMField();
- if (store_vm_field != NULL) {
- return store_vm_field->value()->definition();
- }
-
StoreStaticFieldInstr* store_static_field = instr->AsStoreStaticField();
if (store_static_field != NULL) {
return store_static_field->value()->definition();
@@ -7327,11 +7311,6 @@
}
-void ConstantPropagator::VisitStoreVMField(StoreVMFieldInstr* instr) {
- SetValue(instr, instr->value()->definition()->constant_value());
-}
-
-
void ConstantPropagator::VisitInstantiateType(InstantiateTypeInstr* instr) {
const Object& object =
instr->instantiator()->definition()->constant_value();
@@ -7987,8 +7966,7 @@
!defn->IsPushArgument() &&
!defn->IsStoreIndexed() &&
!defn->IsStoreInstanceField() &&
- !defn->IsStoreStaticField() &&
- !defn->IsStoreVMField()) {
+ !defn->IsStoreStaticField()) {
if (FLAG_trace_constant_propagation) {
OS::Print("Constant v%" Pd " = %s\n",
defn->ssa_temp_index(),
@@ -8578,9 +8556,8 @@
for (intptr_t i = 0; i < fields.length(); i++) {
const Field* field = fields[i];
LoadFieldInstr* load = new LoadFieldInstr(new Value(alloc),
- field->Offset(),
+ field,
AbstractType::ZoneHandle());
- load->set_field(field);
flow_graph_->InsertBefore(
exit, load, NULL, Definition::kValue);
values->Add(new Value(load));
« no previous file with comments | « runtime/vm/flow_graph_inliner.cc ('k') | runtime/vm/flow_graph_type_propagator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698