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

Unified Diff: runtime/vm/stub_code_x64.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: 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 5cdfeda1ca219458b7b3e8c8b7ebbbb45e0e522b..7dafaf63bd3c216842373d13e31868aec10a1738 100644
--- a/runtime/vm/stub_code_x64.cc
+++ b/runtime/vm/stub_code_x64.cc
@@ -560,6 +560,39 @@ void StubCode::GenerateDeoptimizeStub(Assembler* assembler) {
}
+void StubCode::GenerateMegamorphicMissStub(Assembler* assembler) {
+ const Immediate raw_null =
+ Immediate(reinterpret_cast<intptr_t>(Instructions::null()));
+ AssemblerMacros::EnterStubFrame(assembler);
+ __ pushq(raw_null); // Space for the result of the runtime call.
+ // Load the receiver into RAX. The argument count in the arguments
+ // descriptor is a smi.
+ __ movq(RAX, FieldAddress(R10, Array::data_offset()));
+ // Three words in the stack above the last argument.
+ __ movq(RAX, Address(RSP, RAX, TIMES_4, 3 * kWordSize));
+ __ pushq(RAX); // Receiver.
+ __ pushq(RBX); // IC data.
+ __ pushq(R10); // Arguments descriptor.
+ __ CallRuntime(kMegamorphicCacheMissHandlerRuntimeEntry);
+ __ popq(R10); // Arguments descriptor.
+ __ popq(RBX); // IC data.
+ __ popq(RAX); // Discard.
+ __ popq(RAX); // Return value from the runtime call (instructions).
+ __ LeaveFrame();
+
+ Label lookup;
+ __ cmpq(RAX, raw_null);
+ __ j(EQUAL, &lookup, Assembler::kNearJump);
+ __ addq(RAX, Immediate(Instructions::HeaderSize() - kHeapObjectTag));
+ __ jmp(RAX);
+
+ __ Bind(&lookup);
+ __ int3();
+ __ jmp(&StubCode::InstanceFunctionLookupLabel());
+}
+
+
+
// Called for inline allocation of arrays.
// Input parameters:
// R10 : Array length as Smi.

Powered by Google App Engine
This is Rietveld 408576698