Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Unified Diff: runtime/vm/stub_code_x64.cc

Issue 1799793002: Precompilation: Have instances calls load the entry point and Code object from the ic data array in… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/stub_code_mips.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « runtime/vm/stub_code_mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698