Index: runtime/vm/stub_code_ia32.cc |
diff --git a/runtime/vm/stub_code_ia32.cc b/runtime/vm/stub_code_ia32.cc |
index b6302d333ff25bfec3077ecb3f2197a6af2d4cd5..e1e3fff0ed1fe14140148b286fa5cf6477fcabf0 100644 |
--- a/runtime/vm/stub_code_ia32.cc |
+++ b/runtime/vm/stub_code_ia32.cc |
@@ -1781,8 +1781,14 @@ static void GenerateSubtypeNTestCacheStub(Assembler* assembler, int n) { |
// ECX: instance class id. |
// EBX: instance type arguments. |
__ SmiTag(ECX); |
+ __ cmpl(ECX, Immediate(Smi::RawValue(kClosureCid))); |
+ __ j(NOT_EQUAL, &loop, Assembler::kNearJump); |
+ __ movl(ECX, FieldAddress(EAX, Closure::function_offset())); |
+ // ECX: instance class id as Smi or function. |
__ Bind(&loop); |
- __ movl(EDI, Address(EDX, kWordSize * SubtypeTestCache::kInstanceClassId)); |
+ __ movl(EDI, |
+ Address(EDX, |
+ kWordSize * SubtypeTestCache::kInstanceClassIdOrFunction)); |
__ cmpl(EDI, raw_null); |
__ j(EQUAL, ¬_found, Assembler::kNearJump); |
__ cmpl(EDI, ECX); |