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

Unified Diff: runtime/vm/stub_code_arm64.cc

Issue 2226893002: Optimize AOT's switchable calls for the monomorphic case. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: sync Created 4 years, 4 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_arm.cc ('k') | runtime/vm/stub_code_ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/stub_code_arm64.cc
diff --git a/runtime/vm/stub_code_arm64.cc b/runtime/vm/stub_code_arm64.cc
index 9034730ce1e8222099062762239991b2287d8fad..fc092bd34dc2418b82d3f3b53a1752709460afac 100644
--- a/runtime/vm/stub_code_arm64.cc
+++ b/runtime/vm/stub_code_arm64.cc
@@ -2032,10 +2032,11 @@ void StubCode::GenerateOptimizedIdenticalWithNumberCheckStub(
// R0: receiver
// R5: MegamorphicCache (preserved)
// Result:
-// R1: target entry point
// CODE_REG: target Code
// R4: arguments descriptor
void StubCode::GenerateMegamorphicLookupStub(Assembler* assembler) {
+ __ NoMonomorphicCheckedEntry();
+
// Jump if receiver is a smi.
Label smi_case;
__ TestImmediate(R0, kSmiTagMask);
@@ -2083,7 +2084,7 @@ void StubCode::GenerateMegamorphicLookupStub(Assembler* assembler) {
__ ldr(R4, FieldAddress(R5, MegamorphicCache::arguments_descriptor_offset()));
__ ldr(R1, FieldAddress(R0, Function::entry_point_offset()));
__ ldr(CODE_REG, FieldAddress(R0, Function::code_offset()));
- __ ret();
+ __ br(R1);
// Probe failed, check if it is a miss.
__ Bind(&probe_failed);
@@ -2106,10 +2107,11 @@ void StubCode::GenerateMegamorphicLookupStub(Assembler* assembler) {
// R0: receiver
// R5: ICData (preserved)
// Result:
-// R1: target entry point
// CODE_REG: target Code object
// R4: arguments descriptor
void StubCode::GenerateICLookupThroughFunctionStub(Assembler* assembler) {
+ __ NoMonomorphicCheckedEntry();
+
Label loop, found, miss;
__ ldr(R4, FieldAddress(R5, ICData::arguments_descriptor_offset()));
__ ldr(R8, FieldAddress(R5, ICData::ic_data_offset()));
@@ -2134,17 +2136,19 @@ void StubCode::GenerateICLookupThroughFunctionStub(Assembler* assembler) {
__ ldr(R0, Address(R8, target_offset));
__ ldr(R1, FieldAddress(R0, Function::entry_point_offset()));
__ ldr(CODE_REG, FieldAddress(R0, Function::code_offset()));
- __ ret();
+ __ br(R1);
__ Bind(&miss);
__ LoadIsolate(R2);
__ ldr(CODE_REG, Address(R2, Isolate::ic_miss_code_offset()));
__ ldr(R1, FieldAddress(CODE_REG, Code::entry_point_offset()));
- __ ret();
+ __ br(R1);
}
void StubCode::GenerateICLookupThroughCodeStub(Assembler* assembler) {
+ __ NoMonomorphicCheckedEntry();
+
Label loop, found, miss;
__ ldr(R4, FieldAddress(R5, ICData::arguments_descriptor_offset()));
__ ldr(R8, FieldAddress(R5, ICData::ic_data_offset()));
@@ -2169,13 +2173,34 @@ void StubCode::GenerateICLookupThroughCodeStub(Assembler* assembler) {
const intptr_t entry_offset = ICData::EntryPointIndexFor(1) * kWordSize;
__ ldr(R1, Address(R8, entry_offset));
__ ldr(CODE_REG, Address(R8, code_offset));
- __ ret();
+ __ br(R1);
__ Bind(&miss);
__ LoadIsolate(R2);
__ ldr(CODE_REG, Address(R2, Isolate::ic_miss_code_offset()));
__ ldr(R1, FieldAddress(CODE_REG, Code::entry_point_offset()));
- __ ret();
+ __ br(R1);
+}
+
+
+// Called from the monomorphic checked entry.
+// R0: receiver
+void StubCode::GenerateMonomorphicMissStub(Assembler* assembler) {
+ __ EnterStubFrame();
+ __ Push(R0); // Preserve receiver.
+
+ __ PushObject(Object::null_object()); // Result.
+ __ Push(R0); // Arg0: Receiver
+ __ CallRuntime(kMonomorphicMissRuntimeEntry, 1);
+ __ Drop(1);
+ __ Pop(R5); // result = IC
+
+ __ Pop(R0); // Restore receiver.
+ __ LeaveStubFrame();
+
+ __ ldr(CODE_REG, Address(THR, Thread::ic_lookup_through_code_stub_offset()));
+ __ ldr(R1, FieldAddress(CODE_REG, Code::checked_entry_point_offset()));
+ __ br(R1);
}
« no previous file with comments | « runtime/vm/stub_code_arm.cc ('k') | runtime/vm/stub_code_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698