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

Side by Side 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: 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" 5 #include "vm/globals.h"
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/assembler_macros.h" 9 #include "vm/assembler_macros.h"
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 __ pushq(RBX); 557 __ pushq(RBX);
558 GenerateDeoptimizationSequence(assembler, true); // Preserve RAX. 558 GenerateDeoptimizationSequence(assembler, true); // Preserve RAX.
559 } 559 }
560 560
561 561
562 void StubCode::GenerateDeoptimizeStub(Assembler* assembler) { 562 void StubCode::GenerateDeoptimizeStub(Assembler* assembler) {
563 GenerateDeoptimizationSequence(assembler, false); // Don't preserve RAX. 563 GenerateDeoptimizationSequence(assembler, false); // Don't preserve RAX.
564 } 564 }
565 565
566 566
567 void StubCode::GenerateMegamorphicMissStub(Assembler* assembler) {
568 const Immediate raw_null =
569 Immediate(reinterpret_cast<intptr_t>(Instructions::null()));
570 AssemblerMacros::EnterStubFrame(assembler);
571 __ pushq(raw_null); // Space for the result of the runtime call.
572 // Load the receiver into RAX. The argument count in the arguments
573 // descriptor in R10 is a smi.
574 __ movq(RAX, FieldAddress(R10, ArgumentsDescriptor::count_offset()));
575 // Three words in the stack above the last argument.
576 __ movq(RAX, Address(RSP, RAX, TIMES_4, 3 * kWordSize));
577 __ pushq(RAX); // Receiver.
578 __ pushq(RBX); // IC data.
579 __ pushq(R10); // Arguments descriptor.
580 __ CallRuntime(kMegamorphicCacheMissHandlerRuntimeEntry);
581 __ popq(R10); // Arguments descriptor.
582 __ popq(RBX); // IC data.
583 __ popq(RAX); // Discard.
584 __ popq(RAX); // Return value from the runtime call (instructions).
585 __ LeaveFrame();
586
587 Label lookup;
588 __ cmpq(RAX, raw_null);
589 __ j(EQUAL, &lookup, Assembler::kNearJump);
590 __ addq(RAX, Immediate(Instructions::HeaderSize() - kHeapObjectTag));
591 __ jmp(RAX);
592
593 __ Bind(&lookup);
594 __ jmp(&StubCode::InstanceFunctionLookupLabel());
595 }
596
597
598
567 // Called for inline allocation of arrays. 599 // Called for inline allocation of arrays.
568 // Input parameters: 600 // Input parameters:
569 // R10 : Array length as Smi. 601 // R10 : Array length as Smi.
570 // RBX : array element type (either NULL or an instantiated type). 602 // RBX : array element type (either NULL or an instantiated type).
571 // NOTE: R10 cannot be clobbered here as the caller relies on it being saved. 603 // NOTE: R10 cannot be clobbered here as the caller relies on it being saved.
572 // The newly allocated object is returned in RAX. 604 // The newly allocated object is returned in RAX.
573 void StubCode::GenerateAllocateArrayStub(Assembler* assembler) { 605 void StubCode::GenerateAllocateArrayStub(Assembler* assembler) {
574 Label slow_case; 606 Label slow_case;
575 const Immediate raw_null = 607 const Immediate raw_null =
576 Immediate(reinterpret_cast<intptr_t>(Object::null())); 608 Immediate(reinterpret_cast<intptr_t>(Object::null()));
(...skipping 1590 matching lines...) Expand 10 before | Expand all | Expand 10 after
2167 __ cmpq(left, right); 2199 __ cmpq(left, right);
2168 __ Bind(&done); 2200 __ Bind(&done);
2169 __ popq(right); 2201 __ popq(right);
2170 __ popq(left); 2202 __ popq(left);
2171 __ ret(); 2203 __ ret();
2172 } 2204 }
2173 2205
2174 } // namespace dart 2206 } // namespace dart
2175 2207
2176 #endif // defined TARGET_ARCH_X64 2208 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698