Index: runtime/vm/stub_code_x64.cc |
diff --git a/runtime/vm/stub_code_x64.cc b/runtime/vm/stub_code_x64.cc |
index 39d8dc96b0b2c7e2d040fa48f1b89270e7cceed6..024fbfa4be61d723758bdb4783d2fa2acc4364bb 100644 |
--- a/runtime/vm/stub_code_x64.cc |
+++ b/runtime/vm/stub_code_x64.cc |
@@ -1841,8 +1841,14 @@ static void GenerateSubtypeNTestCacheStub(Assembler* assembler, int n) { |
// R13: instance type arguments. |
Label loop, found, not_found, next_iteration; |
__ SmiTag(R10); |
+ __ cmpq(R10, Immediate(Smi::RawValue(kClosureCid))); |
+ __ j(NOT_EQUAL, &loop, Assembler::kNearJump); |
+ __ movq(R10, FieldAddress(RAX, Closure::function_offset())); |
+ // R10: instance class id as Smi or function. |
__ Bind(&loop); |
- __ movq(RDI, Address(RDX, kWordSize * SubtypeTestCache::kInstanceClassId)); |
+ __ movq(RDI, |
+ Address(RDX, |
+ kWordSize * SubtypeTestCache::kInstanceClassIdOrFunction)); |
__ cmpq(RDI, R9); |
__ j(EQUAL, ¬_found, Assembler::kNearJump); |
__ cmpq(RDI, R10); |