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

Unified Diff: runtime/vm/stub_code_ia32.cc

Issue 11299298: Cache lookups at megamorphic call sites in optimized code. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Incorporate review comments, add no such method test. 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 c56dc4b6f47a2ba73bc444bb35d32772c11d4391..22740d691aaac50b7737bb6fe4ed9107473a3d6e 100644
--- a/runtime/vm/stub_code_ia32.cc
+++ b/runtime/vm/stub_code_ia32.cc
@@ -568,6 +568,37 @@ void StubCode::GenerateDeoptimizeStub(Assembler* assembler) {
}
+void StubCode::GenerateMegamorphicMissStub(Assembler* assembler) {
+ const Immediate raw_null =
+ Immediate(reinterpret_cast<intptr_t>(Instructions::null()));
+ AssemblerMacros::EnterStubFrame(assembler);
+ __ pushl(raw_null); // Space for the result of the runtime call.
+ // Load the receiver into EAX. The argument count in the arguments
+ // descriptor in EDX is a smi.
+ __ movl(EAX, FieldAddress(EDX, ArgumentsDescriptor::count_offset()));
+ // Three words in the stack above the last argument.
+ __ movl(EAX, Address(ESP, EAX, TIMES_2, 3 * kWordSize));
+ __ pushl(EAX); // Receiver.
+ __ pushl(ECX); // IC data.
+ __ pushl(EDX); // Arguments descriptor.
+ __ CallRuntime(kMegamorphicCacheMissHandlerRuntimeEntry);
+ __ popl(EDX); // Arguments descriptor.
+ __ popl(ECX); // IC data.
+ __ popl(EAX); // Discard.
+ __ popl(EAX); // Return value from the runtime call (instructions).
+ __ LeaveFrame();
+
+ Label lookup;
+ __ cmpl(EAX, raw_null);
+ __ j(EQUAL, &lookup, Assembler::kNearJump);
+ __ addl(EAX, Immediate(Instructions::HeaderSize() - kHeapObjectTag));
+ __ jmp(EAX);
+
+ __ Bind(&lookup);
+ __ jmp(&StubCode::InstanceFunctionLookupLabel());
+}
+
+
// Called for inline allocation of arrays.
// Input parameters:
// EDX : Array length as Smi.

Powered by Google App Engine
This is Rietveld 408576698