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

Unified Diff: runtime/vm/stub_code_x64.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_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).

Powered by Google App Engine
This is Rietveld 408576698