Chromium Code Reviews| 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; |