Index: runtime/vm/stub_code_x64.cc |
diff --git a/runtime/vm/stub_code_x64.cc b/runtime/vm/stub_code_x64.cc |
index a68eaab83827e34e7a61a0c62daa3014afdd14e0..13e0f014de0941685aa81fccf406c3c8897e7eb0 100644 |
--- a/runtime/vm/stub_code_x64.cc |
+++ b/runtime/vm/stub_code_x64.cc |
@@ -1769,7 +1769,11 @@ static void GenerateSubtypeNTestCacheStub(Assembler* assembler, int n) { |
__ SmiTag(R10); |
__ cmpq(R10, Immediate(Smi::RawValue(kClosureCid))); |
__ j(NOT_EQUAL, &loop, Assembler::kNearJump); |
- __ movq(R13, FieldAddress(RAX, Closure::instantiator_offset())); |
+ __ movq(R13, FieldAddress(RAX, Closure::function_type_arguments_offset())); |
+ __ cmpq(R13, R9); // Cache cannot be used for generic closures. |
+ __ j(NOT_EQUAL, ¬_found, Assembler::kNearJump); |
+ __ movq(R13, |
+ FieldAddress(RAX, Closure::instantiator_type_arguments_offset())); |
__ movq(R10, FieldAddress(RAX, Closure::function_offset())); |
// R10: instance class id as Smi or function. |
__ Bind(&loop); |