Index: runtime/vm/object.cc |
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc |
index 630ffd1ceaede7a6661d47fe4af990282895c967..59fed88a1bd26d99447b19c33047ee68cd5c5f0e 100644 |
--- a/runtime/vm/object.cc |
+++ b/runtime/vm/object.cc |
@@ -7118,6 +7118,33 @@ void Function::RestoreICDataMap( |
} |
+void Function::CopyICDataMap( |
+ ZoneGrowableArray<const ICData*>* deopt_id_to_ic_data) const { |
+ ASSERT(deopt_id_to_ic_data->is_empty()); |
+ Zone* zone = Thread::Current()->zone(); |
+ const Array& saved_ic_data = Array::Handle(zone, ic_data_array()); |
+ if (saved_ic_data.IsNull()) { |
+ return; |
+ } |
+ const intptr_t saved_length = saved_ic_data.Length(); |
+ ASSERT(saved_length > 0); |
+ if (saved_length > 1) { |
+ const intptr_t restored_length = ICData::Cast(Object::Handle( |
+ zone, saved_ic_data.At(saved_length - 1))).deopt_id() + 1; |
+ deopt_id_to_ic_data->SetLength(restored_length); |
+ for (intptr_t i = 0; i < restored_length; i++) { |
+ (*deopt_id_to_ic_data)[i] = NULL; |
+ } |
+ for (intptr_t i = 1; i < saved_length; i++) { |
+ ICData& ic_data = ICData::ZoneHandle(zone); |
+ ic_data ^= saved_ic_data.At(i); |
+ ic_data = ICData::CloneDescriptor(ic_data); |
+ (*deopt_id_to_ic_data)[ic_data.deopt_id()] = &ic_data; |
+ } |
+ } |
+} |
siva
2015/10/27 23:36:45
This function seems identical to RestoreICDataMap
srdjan
2015/10/28 16:54:43
Yes, passing argument clone_descriptor.
Also added
|
+ |
+ |
void Function::set_ic_data_array(const Array& value) const { |
StorePointer(&raw_ptr()->ic_data_array_, value.raw()); |
} |
@@ -12725,6 +12752,23 @@ RawICData* ICData::NewFrom(const ICData& from, intptr_t num_args_tested) { |
} |
+RawICData* ICData::CloneDescriptor(const ICData& from) { |
+ Zone* zone = Thread::Current()->zone(); |
+ const ICData& result = ICData::Handle(ICData::NewDescriptor( |
+ zone, |
+ Function::Handle(zone, from.owner()), |
+ String::Handle(zone, from.target_name()), |
+ Array::Handle(zone, from.arguments_descriptor()), |
+ from.deopt_id(), |
+ from.NumArgsTested())); |
+ // Preserve entry array. |
+ result.set_ic_data_array(Array::Handle(zone, from.ic_data())); |
+ // Copy deoptimization reasons. |
+ result.SetDeoptReasons(from.DeoptReasons()); |
+ return result.raw(); |
+} |
+ |
+ |
void ICData::PrintJSONImpl(JSONStream* stream, bool ref) const { |
JSONObject jsobj(stream); |
AddCommonObjectProperties(&jsobj, "Object", ref); |