From 132bec50fcd4bc8dff85b9e4debfd61b1df2d960 Mon Sep 17 00:00:00 2001 From: Tess Strickland Date: Mon, 2 Nov 2020 17:26:59 +0000 Subject: [PATCH] [vm/compiler] Fix runtime regressions in GenerateAssertAssignable. Specifically, we used to specialize TypeParameter TTS stubs, but that was mistakenly removed when the non-IA32 versions were unified. Also move the int subtype check before TypeParameters as it was before. TEST=Ran golem benchmarks before submission to verify. Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-debug-x64-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-nnbd-linux-debug-ia32-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-nnbd-linux-debug-simarm_x64-try,vm-kernel-precomp-nnbd-linux-debug-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-nnbd-linux-release-simarm-try,vm-kernel-nnbd-linux-release-simarm64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-nnbd-linux-release-simarm64-try Change-Id: I235d519c49341af76a902ac22df46c6754445a11 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170086 Reviewed-by: Martin Kustermann Commit-Queue: Tess Strickland --- .../compiler/backend/flow_graph_compiler.cc | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/runtime/vm/compiler/backend/flow_graph_compiler.cc b/runtime/vm/compiler/backend/flow_graph_compiler.cc index b1e6debb6e3..1c0f9dbdf72 100644 --- a/runtime/vm/compiler/backend/flow_graph_compiler.cc +++ b/runtime/vm/compiler/backend/flow_graph_compiler.cc @@ -2446,6 +2446,17 @@ void FlowGraphCompiler::GenerateCallerChecksForAssertAssignable( return output_dst_type(); } + // If the int type is assignable to [dst_type] we special case it on the + // caller side! + const Type& int_type = Type::Handle(zone(), Type::IntType()); + bool is_non_smi = false; + if (int_type.IsSubtypeOf(dst_type, Heap::kOld)) { + __ BranchIfSmi(TypeTestABI::kInstanceReg, done); + is_non_smi = true; + } else if (!receiver_type->CanBeSmi()) { + is_non_smi = true; + } + if (dst_type.IsTypeParameter()) { // Special case: Instantiate the type parameter on the caller side, invoking // the TTS of the corresponding type parameter in the caller. @@ -2473,21 +2484,9 @@ void FlowGraphCompiler::GenerateCallerChecksForAssertAssignable( compiler::FieldAddress(kTypeArgumentsReg, compiler::target::TypeArguments::type_at_offset( type_param.index()))); - elide_info = true; return output_dst_type(); } - // If the int type is assignable to [dst_type] we special case it on the - // caller side! - const Type& int_type = Type::Handle(zone(), Type::IntType()); - bool is_non_smi = false; - if (int_type.IsSubtypeOf(dst_type, Heap::kOld)) { - __ BranchIfSmi(TypeTestABI::kInstanceReg, done); - is_non_smi = true; - } else if (!receiver_type->CanBeSmi()) { - is_non_smi = true; - } - if (auto const hi = thread()->hierarchy_info()) { const Class& type_class = Class::Handle(zone(), dst_type.type_class());