Index: runtime/vm/stub_code_ia32.cc |
diff --git a/runtime/vm/stub_code_ia32.cc b/runtime/vm/stub_code_ia32.cc |
index efa7b9171a21538b5cf8a830e368ca1575c690d0..5a1ed20d669e9036799f9d1705c19f9611af31b4 100644 |
--- a/runtime/vm/stub_code_ia32.cc |
+++ b/runtime/vm/stub_code_ia32.cc |
@@ -1181,6 +1181,38 @@ void StubCode::GenerateAllocationStubForClass(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); |
+ __ movl(EAX, Address(EBP, 2 * kWordSize)); |
+ __ pushl(EAX); // Push receiver. |
+ |
+ __ LoadClass(ECX, EAX, EBX); |
+ // Compute instance type arguments into EBX. |
+ Label has_no_type_arguments; |
+ __ movl(EBX, raw_null); |
+ __ movl(EDI, FieldAddress(ECX, |
+ Class::type_arguments_field_offset_in_words_offset())); |
+ __ cmpl(EDI, Immediate(Class::kNoTypeArguments)); |
+ __ j(EQUAL, &has_no_type_arguments, Assembler::kNearJump); |
+ __ movl(EBX, FieldAddress(EAX, EDI, TIMES_4, 0)); |
+ __ Bind(&has_no_type_arguments); |
+ __ pushl(EBX); // 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 closures. |
// Input parameters: |
// ESP + 8 : receiver (null if not an implicit instance closure). |