Change deoptimization description for materialized objects.
Use field offset instead of fields as arguments in the deoptimization instructions for materialization of objects. This is to prepare for materializing contexts and fixed-size arrays when doing allocation sinking. R=johnmccutchan@google.com Review URL: https://codereview.chromium.org//183683013 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33267 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
@@ -116,12 +116,22 @@ void DeferredObject::Materialize() {
|
||||
|
||||
const Instance& obj = Instance::ZoneHandle(Instance::New(cls));
|
||||
|
||||
Smi& offset = Smi::Handle();
|
||||
Field& field = Field::Handle();
|
||||
Object& value = Object::Handle();
|
||||
const Array& offset_map = Array::Handle(cls.OffsetToFieldMap());
|
||||
|
||||
for (intptr_t i = 0; i < field_count_; i++) {
|
||||
field ^= GetField(i);
|
||||
offset ^= GetFieldOffset(i);
|
||||
field ^= offset_map.At(offset.Value() / kWordSize);
|
||||
value = GetValue(i);
|
||||
obj.SetField(field, value);
|
||||
if (!field.IsNull()) {
|
||||
obj.SetField(field, value);
|
||||
} else {
|
||||
ASSERT(cls.IsSignatureClass() ||
|
||||
(offset.Value() == cls.type_arguments_field_offset()));
|
||||
obj.SetFieldAtOffset(offset.Value(), value);
|
||||
}
|
||||
|
||||
if (FLAG_trace_deoptimization_verbose) {
|
||||
OS::PrintErr(" %s <- %s\n",
|
||||
|
||||
@@ -164,7 +164,7 @@ class DeferredObject {
|
||||
};
|
||||
|
||||
enum {
|
||||
kFieldIndex = 0,
|
||||
kOffsetIndex = 0,
|
||||
kValueIndex,
|
||||
kFieldEntrySize,
|
||||
};
|
||||
@@ -178,8 +178,8 @@ class DeferredObject {
|
||||
return args_[kClassIndex];
|
||||
}
|
||||
|
||||
RawObject* GetField(intptr_t index) const {
|
||||
return args_[kFieldsStartIndex + kFieldEntrySize * index + kFieldIndex];
|
||||
RawObject* GetFieldOffset(intptr_t index) const {
|
||||
return args_[kFieldsStartIndex + kFieldEntrySize * index + kOffsetIndex];
|
||||
}
|
||||
|
||||
RawObject* GetValue(intptr_t index) const {
|
||||
|
||||
@@ -1377,8 +1377,9 @@ intptr_t DeoptInfoBuilder::EmitMaterializationArguments(intptr_t dest_index) {
|
||||
AddConstant(mat->cls(), dest_index++);
|
||||
for (intptr_t i = 0; i < mat->InputCount(); i++) {
|
||||
if (!mat->InputAt(i)->BindsToConstantNull()) {
|
||||
// Emit field-value pair.
|
||||
AddConstant(mat->FieldAt(i), dest_index++);
|
||||
// Emit offset-value pair.
|
||||
AddConstant(Smi::Handle(Smi::New(mat->FieldOffsetAt(i))),
|
||||
dest_index++);
|
||||
AddCopy(mat->InputAt(i), mat->LocationAt(i), dest_index++);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4073,8 +4073,8 @@ class MaterializeObjectInstr : public Definition {
|
||||
}
|
||||
|
||||
const Class& cls() const { return cls_; }
|
||||
const Field& FieldAt(intptr_t i) const {
|
||||
return *fields_[i];
|
||||
intptr_t FieldOffsetAt(intptr_t i) const {
|
||||
return fields_[i]->Offset();
|
||||
}
|
||||
const Location& LocationAt(intptr_t i) {
|
||||
return locations_[i];
|
||||
|
||||
@@ -4060,6 +4060,7 @@ class Instance : public Object {
|
||||
friend class SnapshotWriter;
|
||||
friend class StubCode;
|
||||
friend class TypedDataView;
|
||||
friend class DeferredObject;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user