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

Unified Diff: runtime/vm/jit_optimizer.cc

Issue 2829603002: Fall back to megamorphic stub when dispatching calls to rare classes. (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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/jit_optimizer.cc
diff --git a/runtime/vm/jit_optimizer.cc b/runtime/vm/jit_optimizer.cc
index 9e71b2728a12de19a082ce4d0ae07d76ab7f6825..b98e23d0382336068af685a6bb8c67edddcf9aaf 100644
--- a/runtime/vm/jit_optimizer.cc
+++ b/runtime/vm/jit_optimizer.cc
@@ -1549,17 +1549,6 @@ void JitOptimizer::VisitInstanceCall(InstanceCallInstr* instr) {
const ICData& unary_checks =
ICData::ZoneHandle(Z, instr->ic_data()->AsUnaryClassChecks());
- const bool is_dense = CheckClassInstr::IsDenseCidRange(unary_checks);
- const intptr_t number_of_checks = unary_checks.NumberOfChecks();
- if (op_kind == Token::kEQ &&
- number_of_checks > FLAG_max_equality_polymorphic_checks && !is_dense &&
- flow_graph()->InstanceCallNeedsClassCheck(
- instr, RawFunction::kRegularFunction)) {
- // Too many checks, it will be megamorphic which needs unary checks.
- instr->set_ic_data(&unary_checks);
- return;
- }
-
if ((op_kind == Token::kASSIGN_INDEX) && TryReplaceWithIndexedOp(instr)) {
return;
}
@@ -1629,7 +1618,11 @@ void JitOptimizer::VisitInstanceCall(InstanceCallInstr* instr) {
}
bool call_with_checks;
- if (has_one_target && FLAG_polymorphic_with_deopt) {
+ const int max_cids = (op_kind == Token::kEQ)
Vyacheslav Egorov (Google) 2017/04/19 08:24:00 It might be good to put the reasoning here to info
erikcorry 2017/04/19 13:15:41 Done.
+ ? FLAG_max_equality_polymorphic_checks
+ : FLAG_max_polymorphic_checks;
+ if (has_one_target && FLAG_polymorphic_with_deopt &&
+ unary_checks.NumberOfChecks() <= max_cids) {
// Type propagation has not run yet, we cannot eliminate the check.
AddReceiverCheck(instr);
// Call can still deoptimize, do not detach environment from instr.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698