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

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
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,41 @@
}
+void Function::SetSavedICData(
Cutch 2014/06/16 21:39:42 Maybe rename to: SaveICData to go with RestoreICDa
srdjan 2014/06/16 21:58:09 Done.
+ 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);
+}
+
+
+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;

Powered by Google App Engine
This is Rietveld 408576698