Index: runtime/vm/stub_code_arm64.cc |
diff --git a/runtime/vm/stub_code_arm64.cc b/runtime/vm/stub_code_arm64.cc |
index 3f9663cac2dbbf399902a304b42b1375320e5aaf..f550777f342d2d3d90986871b092db5b0baae185 100644 |
--- a/runtime/vm/stub_code_arm64.cc |
+++ b/runtime/vm/stub_code_arm64.cc |
@@ -2183,6 +2183,50 @@ void StubCode::GenerateICCallThroughCodeStub(Assembler* assembler) { |
} |
+// Called from switchable IC calls. |
+// R0: receiver |
+// R5: SingleTargetCache |
+// Passed to target: |
+// CODE_REG: target Code object |
+void StubCode::GenerateSingleTargetCallStub(Assembler* assembler) { |
+ __ NoMonomorphicCheckedEntry(); |
+ |
+ Label miss; |
+ |
+ __ LoadClassIdMayBeSmi(R1, R0); |
+ __ ldr(R2, FieldAddress(R5, SingleTargetCache::lower_limit_offset()), |
+ kUnsignedWord); |
+ __ ldr(R3, FieldAddress(R5, SingleTargetCache::upper_limit_offset()), |
+ kUnsignedWord); |
+ |
+ __ cmp(R1, Operand(R2)); |
+ __ b(&miss, LT); |
+ __ cmp(R1, Operand(R3)); |
+ __ b(&miss, GT); |
+ |
+ __ ldr(R1, FieldAddress(R5, SingleTargetCache::entry_point_offset())); |
+ __ ldr(CODE_REG, FieldAddress(R5, SingleTargetCache::target_offset())); |
+ __ br(R1); |
+ |
+ __ Bind(&miss); |
+ __ EnterStubFrame(); |
+ __ Push(R0); // Preserve receiver. |
+ |
+ __ PushObject(Object::null_object()); // Result. |
+ __ Push(R0); // Arg0: Receiver |
+ __ CallRuntime(kSingleTargetMissRuntimeEntry, 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); |
+} |
+ |
+ |
// Called from the monomorphic checked entry. |
// R0: receiver |
void StubCode::GenerateMonomorphicMissStub(Assembler* assembler) { |