Index: runtime/vm/stub_code_x64.cc |
diff --git a/runtime/vm/stub_code_x64.cc b/runtime/vm/stub_code_x64.cc |
index 5cdfeda1ca219458b7b3e8c8b7ebbbb45e0e522b..7dafaf63bd3c216842373d13e31868aec10a1738 100644 |
--- a/runtime/vm/stub_code_x64.cc |
+++ b/runtime/vm/stub_code_x64.cc |
@@ -560,6 +560,39 @@ void StubCode::GenerateDeoptimizeStub(Assembler* assembler) { |
} |
+void StubCode::GenerateMegamorphicMissStub(Assembler* assembler) { |
+ const Immediate raw_null = |
+ Immediate(reinterpret_cast<intptr_t>(Instructions::null())); |
+ AssemblerMacros::EnterStubFrame(assembler); |
+ __ pushq(raw_null); // Space for the result of the runtime call. |
+ // Load the receiver into RAX. The argument count in the arguments |
+ // descriptor is a smi. |
+ __ movq(RAX, FieldAddress(R10, Array::data_offset())); |
+ // Three words in the stack above the last argument. |
+ __ movq(RAX, Address(RSP, RAX, TIMES_4, 3 * kWordSize)); |
+ __ pushq(RAX); // Receiver. |
+ __ pushq(RBX); // IC data. |
+ __ pushq(R10); // Arguments descriptor. |
+ __ CallRuntime(kMegamorphicCacheMissHandlerRuntimeEntry); |
+ __ popq(R10); // Arguments descriptor. |
+ __ popq(RBX); // IC data. |
+ __ popq(RAX); // Discard. |
+ __ popq(RAX); // Return value from the runtime call (instructions). |
+ __ LeaveFrame(); |
+ |
+ Label lookup; |
+ __ cmpq(RAX, raw_null); |
+ __ j(EQUAL, &lookup, Assembler::kNearJump); |
+ __ addq(RAX, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); |
+ __ jmp(RAX); |
+ |
+ __ Bind(&lookup); |
+ __ int3(); |
+ __ jmp(&StubCode::InstanceFunctionLookupLabel()); |
+} |
+ |
+ |
+ |
// Called for inline allocation of arrays. |
// Input parameters: |
// R10 : Array length as Smi. |