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

Unified Diff: runtime/vm/object.cc

Issue 335173002: Save ICData of unoptimized code in the function, thus preserving it across repated unoptimized comp… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 6 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/object.h ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
===================================================================
--- runtime/vm/object.cc (revision 37375)
+++ runtime/vm/object.cc (working copy)
@@ -2523,6 +2523,7 @@
function.SwitchToUnoptimizedCode();
} else if (function.unoptimized_code() == code.raw()) {
ReportSwitchingCode(code);
+ function.ClearICData();
// Remove the code object from the function. The next time the
// function is invoked, it will be compiled again.
function.ClearCode();
@@ -6017,6 +6018,7 @@
clone.set_deoptimization_counter(0);
clone.set_optimized_instruction_count(0);
clone.set_optimized_call_site_count(0);
+ clone.set_ic_data_array(Array::Handle());
return clone.raw();
}
@@ -6416,6 +6418,57 @@
}
+void Function::SaveICDataMap(
+ const ZoneGrowableArray<const ICData*>& deopt_id_to_ic_data) const {
+ // Compute number of ICData objectsto save.
+ intptr_t count = 0;
+ for (intptr_t i = 0; i < deopt_id_to_ic_data.length(); i++) {
+ if (deopt_id_to_ic_data[i] != NULL) {
+ count++;
+ }
+ }
+
+ const Array& a = Array::Handle(Array::New(count, Heap::kOld));
+ count = 0;
+ for (intptr_t i = 0; i < deopt_id_to_ic_data.length(); i++) {
+ if (deopt_id_to_ic_data[i] != NULL) {
+ a.SetAt(count++, *deopt_id_to_ic_data[i]);
+ }
+ }
+ set_ic_data_array(a);
+}
+
+
+RawArray* Function::RestoreICDataMap() const {
+ const Array& saved_icd = Array::Handle(ic_data_array());
+ if (saved_icd.Length() == 0) {
+ return Array::empty_array().raw();
+ }
+ ICData& icd = ICData::Handle();
+ icd ^= saved_icd.At(saved_icd.Length() - 1);
+ const Array& result = Array::Handle(Array::New(icd.deopt_id() + 1));
+ for (intptr_t i = 0; i < saved_icd.Length(); i++) {
+ icd ^= saved_icd.At(i);
+ result.SetAt(icd.deopt_id(), icd);
+ }
+ return result.raw();
+}
+
+
+void Function::set_ic_data_array(const Array& value) const {
+ StorePointer(&raw_ptr()->ic_data_array_, value.raw());
+}
+
+
+RawArray* Function::ic_data_array() const {
+ return raw_ptr()->ic_data_array_;
+}
+
+void Function::ClearICData() const {
+ set_ic_data_array(Array::Handle());
+}
+
+
bool Function::CheckSourceFingerprint(int32_t fp) const {
if (SourceFingerprint() != fp) {
const bool recalculatingFingerprints = false;
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698