Index: runtime/vm/stub_code_x64.cc |
diff --git a/runtime/vm/stub_code_x64.cc b/runtime/vm/stub_code_x64.cc |
index b33ee0198bf6545dd8bc14998b367d5f6119498e..a8ed6ef68de339f02a56dd1629c1026871839fe7 100644 |
--- a/runtime/vm/stub_code_x64.cc |
+++ b/runtime/vm/stub_code_x64.cc |
@@ -2144,7 +2144,7 @@ void StubCode::GenerateMegamorphicLookupStub(Assembler* assembler) { |
// RCX: target entry point |
// CODE_REG: target Code object |
// R10: arguments descriptor |
-void StubCode::GenerateICLookupStub(Assembler* assembler) { |
+void StubCode::GenerateICLookupThroughFunctionStub(Assembler* assembler) { |
Label loop, found, miss; |
__ movq(R13, FieldAddress(RBX, ICData::ic_data_offset())); |
@@ -2181,6 +2181,44 @@ void StubCode::GenerateICLookupStub(Assembler* assembler) { |
__ ret(); |
} |
+ |
+void StubCode::GenerateICLookupThroughCodeStub(Assembler* assembler) { |
+ Label loop, found, miss; |
+ |
+ __ movq(R13, FieldAddress(RBX, ICData::ic_data_offset())); |
+ __ movq(R10, FieldAddress(RBX, ICData::arguments_descriptor_offset())); |
+ __ leaq(R13, FieldAddress(R13, Array::data_offset())); |
+ // R13: first IC entry |
+ __ LoadTaggedClassIdMayBeSmi(RAX, RDI); |
+ // RAX: receiver cid as Smi |
+ |
+ __ Bind(&loop); |
+ __ movq(R9, Address(R13, 0)); |
+ __ cmpq(RAX, R9); |
+ __ j(EQUAL, &found, Assembler::kNearJump); |
+ |
+ ASSERT(Smi::RawValue(kIllegalCid) == 0); |
+ __ testq(R9, R9); |
+ __ j(ZERO, &miss, Assembler::kNearJump); |
+ |
+ const intptr_t entry_length = ICData::TestEntryLengthFor(1) * kWordSize; |
+ __ addq(R13, Immediate(entry_length)); // Next entry. |
+ __ jmp(&loop); |
+ |
+ __ Bind(&found); |
+ const intptr_t code_offset = ICData::CodeIndexFor(1) * kWordSize; |
+ const intptr_t entry_offset = ICData::EntryPointIndexFor(1) * kWordSize; |
+ __ movq(RCX, Address(R13, entry_offset)); |
+ __ movq(CODE_REG, Address(R13, code_offset)); |
+ __ ret(); |
+ |
+ __ Bind(&miss); |
+ __ LoadIsolate(RAX); |
+ __ movq(CODE_REG, Address(RAX, Isolate::ic_miss_code_offset())); |
+ __ movq(RCX, FieldAddress(CODE_REG, Code::entry_point_offset())); |
+ __ ret(); |
+} |
+ |
} // namespace dart |
#endif // defined TARGET_ARCH_X64 |