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

Unified Diff: runtime/vm/object.cc

Issue 333403002: Cleanup: use a ZoneGrowableArray instead of Array for ICData map. (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') | no next file » | 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 37378)
+++ runtime/vm/object.cc (working copy)
@@ -6439,19 +6439,26 @@
}
-RawArray* Function::RestoreICDataMap() const {
- const Array& saved_icd = Array::Handle(ic_data_array());
+void Function::RestoreICDataMap(
+ ZoneGrowableArray<const ICData*>* deopt_id_to_ic_data) const {
+ Isolate* isolate = Isolate::Current();
+ const Array& saved_icd = Array::Handle(isolate, ic_data_array());
if (saved_icd.Length() == 0) {
- return Array::empty_array().raw();
+ deopt_id_to_ic_data->Clear();
+ return;;
}
ICData& icd = ICData::Handle();
icd ^= saved_icd.At(saved_icd.Length() - 1);
- const Array& result = Array::Handle(Array::New(icd.deopt_id() + 1));
+ const intptr_t len = icd.deopt_id() + 1;
+ deopt_id_to_ic_data->SetLength(len);
+ for (intptr_t i = 0; i < len; i++) {
+ (*deopt_id_to_ic_data)[i] = NULL;
+ }
for (intptr_t i = 0; i < saved_icd.Length(); i++) {
+ ICData& icd = ICData::ZoneHandle(isolate);
icd ^= saved_icd.At(i);
- result.SetAt(icd.deopt_id(), icd);
+ (*deopt_id_to_ic_data)[icd.deopt_id()] = &icd;
}
- return result.raw();
}
@@ -12046,54 +12053,6 @@
}
-intptr_t Code::ExtractIcDataArraysAtCalls(
- GrowableArray<intptr_t>* node_ids,
- const GrowableObjectArray& ic_data_objs) const {
- ASSERT(node_ids != NULL);
- ASSERT(!ic_data_objs.IsNull());
- const PcDescriptors& descriptors =
- PcDescriptors::Handle(this->pc_descriptors());
- ICData& ic_data_obj = ICData::Handle();
- intptr_t max_id = -1;
- for (intptr_t i = 0; i < descriptors.Length(); i++) {
- PcDescriptors::Kind kind = descriptors.DescriptorKind(i);
- if ((kind == PcDescriptors::kIcCall) ||
- (kind == PcDescriptors::kUnoptStaticCall)) {
- intptr_t deopt_id = descriptors.DeoptId(i);
- if (deopt_id > max_id) {
- max_id = deopt_id;
- }
- node_ids->Add(deopt_id);
- uword ret_addr = descriptors.PC(i);
- if (kind == PcDescriptors::kIcCall) {
- CodePatcher::GetInstanceCallAt(ret_addr, *this, &ic_data_obj);
- } else {
- CodePatcher::GetUnoptimizedStaticCallAt(ret_addr, *this, &ic_data_obj);
- }
- ic_data_objs.Add(ic_data_obj);
- }
- }
- return max_id;
-}
-
-
-RawArray* Code::ExtractTypeFeedbackArray() const {
- ASSERT(!IsNull() && !is_optimized());
- GrowableArray<intptr_t> deopt_ids;
- const GrowableObjectArray& ic_data_objs =
- GrowableObjectArray::Handle(GrowableObjectArray::New());
- const intptr_t max_id =
- ExtractIcDataArraysAtCalls(&deopt_ids, ic_data_objs);
- const Array& result = Array::Handle(Array::New(max_id + 1));
- for (intptr_t i = 0; i < deopt_ids.length(); i++) {
- intptr_t result_index = deopt_ids[i];
- ASSERT(result.At(result_index) == Object::null());
- result.SetAt(result_index, Object::Handle(ic_data_objs.At(i)));
- }
- return result.raw();
-}
-
-
RawStackmap* Code::GetStackmap(uword pc, Array* maps, Stackmap* map) const {
// This code is used during iterating frames during a GC and hence it
// should not in turn start a GC.
« no previous file with comments | « runtime/vm/object.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698