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

Unified Diff: runtime/vm/stub_code_ia32.cc

Issue 11642003: Create and cache method extraction stub in the ICData. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: ready for review. Created 8 years 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
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).

Powered by Google App Engine
This is Rietveld 408576698