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

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: One change I forgot. 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
« no previous file with comments | « runtime/vm/stub_code_ia32.cc ('k') | runtime/vm/symbols.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/stub_code_x64.cc
diff --git a/runtime/vm/stub_code_x64.cc b/runtime/vm/stub_code_x64.cc
index e754305d336ee6891339d04b4c116b24234ab9b7..6bb3b6d2134c41ec8f4a916bd3fd4a9dc96c0de6 100644
--- a/runtime/vm/stub_code_x64.cc
+++ b/runtime/vm/stub_code_x64.cc
@@ -564,6 +564,45 @@ void StubCode::GenerateDeoptimizeStub(Assembler* assembler) {
}
+void StubCode::GenerateMegamorphicMissStub(Assembler* assembler) {
+ AssemblerMacros::EnterStubFrame(assembler);
+ // Load the receiver into RAX. The argument count in the arguments
+ // descriptor in R10 is a smi.
+ __ movq(RAX, FieldAddress(R10, ArgumentsDescriptor::count_offset()));
+ // Two words (return addres, saved fp) in the stack above the last argument.
+ __ movq(RAX, Address(RSP, RAX, TIMES_4, 2 * kWordSize));
+ // Preserve IC data and arguments descriptor.
+ __ pushq(RBX);
+ __ pushq(R10);
+
+ const Immediate raw_null =
+ Immediate(reinterpret_cast<intptr_t>(Instructions::null()));
+ __ pushq(raw_null); // Space for the result of the runtime call.
+ __ pushq(RAX); // Receiver.
+ __ pushq(RBX); // IC data.
+ __ pushq(R10); // Arguments descriptor.
+ __ CallRuntime(kMegamorphicCacheMissHandlerRuntimeEntry);
+ // Discard arguments.
+ __ popq(RAX);
+ __ popq(RAX);
+ __ popq(RAX);
+ __ popq(RAX); // Return value from the runtime call (instructions).
+ __ popq(R10); // Restore arguments descriptor.
+ __ popq(RBX); // Restore IC data.
+ __ LeaveFrame();
+
+ Label lookup;
+ __ cmpq(RAX, raw_null);
+ __ j(EQUAL, &lookup, Assembler::kNearJump);
+ __ addq(RAX, Immediate(Instructions::HeaderSize() - kHeapObjectTag));
+ __ jmp(RAX);
+
+ __ Bind(&lookup);
+ __ jmp(&StubCode::InstanceFunctionLookupLabel());
+}
+
+
+
// Called for inline allocation of arrays.
// Input parameters:
// R10 : Array length as Smi.
« no previous file with comments | « runtime/vm/stub_code_ia32.cc ('k') | runtime/vm/symbols.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698