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

Unified Diff: runtime/vm/object.cc

Issue 1414933006: Copy ICData descriptors when starting background compilation, so that they do not change while comp… (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: j Created 5 years, 2 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
« runtime/vm/compiler.cc ('K') | « runtime/vm/object.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
+ }
+ }
+}
+
+
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()));
siva 2015/10/27 23:36:45 The ic_data array doesn't have to be cloned?
srdjan 2015/10/28 16:54:43 No. Added the following comment in .h: // Gener
+ // 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);
« runtime/vm/compiler.cc ('K') | « runtime/vm/object.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698