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

Unified Diff: runtime/vm/jit_optimizer.cc

Issue 2453463006: Revert "Revert "Recognize and optimize a.runtimeType == b.runtimeType pattern."" (Closed)
Patch Set: Created 4 years, 2 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/isolate.h ('k') | runtime/vm/method_recognizer.h » ('j') | 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 00f1588f9eba4a371e5e32346d7717be82bb297c..63c79bc2a0f948c63075106fea7611d72b981b57 100644
--- a/runtime/vm/jit_optimizer.cc
+++ b/runtime/vm/jit_optimizer.cc
@@ -1707,13 +1707,20 @@ void JitOptimizer::VisitInstanceCall(InstanceCallInstr* instr) {
// we don't have one target.
const Function& target =
Function::Handle(Z, unary_checks.GetTargetAt(0));
- const bool polymorphic_target = MethodRecognizer::PolymorphicTarget(target);
- has_one_target = !polymorphic_target;
+ if (target.recognized_kind() == MethodRecognizer::kObjectRuntimeType) {
+ has_one_target =
+ PolymorphicInstanceCallInstr::ComputeRuntimeType(unary_checks) !=
+ Type::null();
+ } else {
+ const bool polymorphic_target =
+ MethodRecognizer::PolymorphicTarget(target);
+ has_one_target = !polymorphic_target;
+ }
}
if (has_one_target) {
- RawFunction::Kind function_kind =
- Function::Handle(Z, unary_checks.GetTargetAt(0)).kind();
+ const Function& target = Function::Handle(Z, unary_checks.GetTargetAt(0));
+ const RawFunction::Kind function_kind = target.kind();
if (!flow_graph()->InstanceCallNeedsClassCheck(instr, function_kind)) {
PolymorphicInstanceCallInstr* call =
new(Z) PolymorphicInstanceCallInstr(instr, unary_checks,
« no previous file with comments | « runtime/vm/isolate.h ('k') | runtime/vm/method_recognizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698