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

Unified Diff: runtime/vm/intermediate_language_dbc.cc

Issue 2809583002: Use off-heap data for type feedback in PolymorphicInstanceCallInstr (Closed)
Patch Set: Created 3 years, 8 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/intermediate_language_dbc.cc
diff --git a/runtime/vm/intermediate_language_dbc.cc b/runtime/vm/intermediate_language_dbc.cc
index c3a2ac839c06958fb441b4b69970849de427906c..fe14bff96f65b41a215b2f80b61a6373b406ba30 100644
--- a/runtime/vm/intermediate_language_dbc.cc
+++ b/runtime/vm/intermediate_language_dbc.cc
@@ -238,26 +238,21 @@ EMIT_NATIVE_CODE(PolymorphicInstanceCall,
0,
Location::RegisterLocation(0),
LocationSummary::kCall) {
- ASSERT(ic_data().NumArgsTested() == 1);
const Array& arguments_descriptor = Array::Handle(ArgumentsDescriptor::New(
instance_call()->ArgumentCount(), instance_call()->argument_names()));
const intptr_t argdesc_kidx = __ AddConstant(arguments_descriptor);
+ const PolymorphicTargets& ic_data = targets();
// Push the target onto the stack.
if (with_checks()) {
- const intptr_t may_be_smi =
- (ic_data().GetReceiverClassIdAt(0) == kSmiCid) ? 1 : 0;
- GrowableArray<CidRangeTarget> sorted_ic_data;
- FlowGraphCompiler::SortICDataByCount(ic_data(), &sorted_ic_data,
- /* drop_smi = */ true);
- const intptr_t sorted_length = sorted_ic_data.length();
- if (!Utils::IsUint(8, sorted_length)) {
+ const intptr_t length = ic_data.length();
+ if (!Utils::IsUint(8, length)) {
Unsupported(compiler);
UNREACHABLE();
}
bool using_ranges = false;
- for (intptr_t i = 0; i < sorted_length; i++) {
- if (sorted_ic_data[i].cid_start != sorted_ic_data[i].cid_end) {
+ for (intptr_t i = 0; i < length; i++) {
+ if (ic_data[i].cid_start != ic_data[i].cid_end) {
using_ranges = true;
break;
}
@@ -265,24 +260,14 @@ EMIT_NATIVE_CODE(PolymorphicInstanceCall,
if (using_ranges) {
__ PushPolymorphicInstanceCallByRange(instance_call()->ArgumentCount(),
- sorted_length + may_be_smi);
+ length);
} else {
- __ PushPolymorphicInstanceCall(instance_call()->ArgumentCount(),
- sorted_length + may_be_smi);
- }
- if (may_be_smi == 1) {
- const Function& target =
- Function::ZoneHandle(compiler->zone(), ic_data().GetTargetAt(0));
- __ Nop(compiler->ToEmbeddableCid(kSmiCid, this));
- if (using_ranges) {
- __ Nop(compiler->ToEmbeddableCid(1, this));
- }
- __ Nop(__ AddConstant(target));
+ __ PushPolymorphicInstanceCall(instance_call()->ArgumentCount(), length);
}
- for (intptr_t i = 0; i < sorted_length; i++) {
- const Function& target = *sorted_ic_data[i].target;
- intptr_t cid_start = sorted_ic_data[i].cid_start;
- intptr_t cid_end = sorted_ic_data[i].cid_end;
+ for (intptr_t i = 0; i < length; i++) {
+ const Function& target = *ic_data[i].target;
+ intptr_t cid_start = ic_data[i].cid_start;
+ intptr_t cid_end = ic_data[i].cid_end;
__ Nop(compiler->ToEmbeddableCid(cid_start, this));
if (using_ranges) {
@@ -293,8 +278,8 @@ EMIT_NATIVE_CODE(PolymorphicInstanceCall,
compiler->EmitDeopt(deopt_id(),
ICData::kDeoptPolymorphicInstanceCallTestFail, 0);
} else {
- ASSERT(ic_data().HasOneTarget());
- const Function& target = Function::ZoneHandle(ic_data().GetTargetAt(0));
+ ASSERT(HasSingleRecognizedTarget());
+ const Function& target = FirstTarget();
__ PushConstant(target);
}
@@ -1535,7 +1520,7 @@ EMIT_NATIVE_CODE(CheckClass, 1) {
__ Nop(compiler->ToEmbeddableCid(low_cid, this));
__ Nop(__ AddConstant(Smi::Handle(Smi::New(cid_mask))));
} else {
- GrowableArray<CidRangeTarget> sorted_ic_data;
+ ZoneGrowableArray<CidRangeTarget> sorted_ic_data;
FlowGraphCompiler::SortICDataByCount(unary_checks(), &sorted_ic_data,
/* drop_smi = */ true);
const intptr_t sorted_length = sorted_ic_data.length();

Powered by Google App Engine
This is Rietveld 408576698