Index: runtime/vm/stub_code_x64.cc |
diff --git a/runtime/vm/stub_code_x64.cc b/runtime/vm/stub_code_x64.cc |
index 823558f8acac4e92c81702e4e51c502ebc934eca..265e545bd67e37c1dbb7cd884b9408e6f7516126 100644 |
--- a/runtime/vm/stub_code_x64.cc |
+++ b/runtime/vm/stub_code_x64.cc |
@@ -990,6 +990,38 @@ void StubCode::GenerateUpdateStoreBufferStub(Assembler* assembler) { |
} |
+void StubCode::GenerateMethodExtractor(Assembler* assembler, |
+ const Function& closure_function) { |
+ const Immediate raw_null = |
+ Immediate(reinterpret_cast<intptr_t>(Object::null())); |
+ |
+ AssemblerMacros::EnterStubFrame(assembler); |
+ __ movq(RAX, Address(RBP, 2 * kWordSize)); |
+ __ pushq(RAX); // Push receiver. |
+ |
+ __ LoadClass(R10, RAX); |
+ // Compute instance type arguments into R13. |
+ Label has_no_type_arguments; |
+ __ movq(R13, raw_null); |
+ __ movq(RDI, FieldAddress(R10, |
+ Class::type_arguments_field_offset_in_words_offset())); |
+ __ cmpq(RDI, Immediate(Class::kNoTypeArguments)); |
+ __ j(EQUAL, &has_no_type_arguments, Assembler::kNearJump); |
+ __ movq(R13, FieldAddress(RAX, RDI, TIMES_8, 0)); |
+ __ Bind(&has_no_type_arguments); |
+ __ pushq(R13); // Push type arguments. |
+ |
+ const Code& stub = Code::Handle( |
+ GetAllocationStubForClosure( |
+ Function::ZoneHandle(closure_function.raw()))); |
+ const ExternalLabel label(closure_function.ToCString(), stub.EntryPoint()); |
+ __ call(&label); |
+ __ Drop(2); // Drop receiver and type arguments. |
+ __ LeaveFrame(); |
+ __ ret(); |
+} |
+ |
+ |
// Called for inline allocation of objects. |
// Input parameters: |
// RSP + 16 : type arguments object (only if class is parameterized). |