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

Side by Side 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 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_IA32) 6 #if defined(TARGET_ARCH_IA32)
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 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 __ pushl(EBX); 561 __ pushl(EBX);
562 GenerateDeoptimizationSequence(assembler, true); // Preserve EAX. 562 GenerateDeoptimizationSequence(assembler, true); // Preserve EAX.
563 } 563 }
564 564
565 565
566 void StubCode::GenerateDeoptimizeStub(Assembler* assembler) { 566 void StubCode::GenerateDeoptimizeStub(Assembler* assembler) {
567 GenerateDeoptimizationSequence(assembler, false); // Don't preserve EAX. 567 GenerateDeoptimizationSequence(assembler, false); // Don't preserve EAX.
568 } 568 }
569 569
570 570
571 void StubCode::GenerateMegamorphicMissStub(Assembler* assembler) {
572 const Immediate raw_null =
573 Immediate(reinterpret_cast<intptr_t>(Instructions::null()));
574 AssemblerMacros::EnterStubFrame(assembler);
575 __ pushl(raw_null); // Space for the result of the runtime call.
576 // Load the receiver into EAX. The argument count in the arguments
577 // descriptor in EDX is a smi.
578 __ movl(EAX, FieldAddress(EDX, ArgumentsDescriptor::count_offset()));
579 // Three words in the stack above the last argument.
580 __ movl(EAX, Address(ESP, EAX, TIMES_2, 3 * kWordSize));
581 __ pushl(EAX); // Receiver.
582 __ pushl(ECX); // IC data.
583 __ pushl(EDX); // Arguments descriptor.
584 __ CallRuntime(kMegamorphicCacheMissHandlerRuntimeEntry);
585 __ popl(EDX); // Arguments descriptor.
586 __ popl(ECX); // IC data.
587 __ popl(EAX); // Discard.
588 __ popl(EAX); // Return value from the runtime call (instructions).
589 __ LeaveFrame();
590
591 Label lookup;
592 __ cmpl(EAX, raw_null);
593 __ j(EQUAL, &lookup, Assembler::kNearJump);
594 __ addl(EAX, Immediate(Instructions::HeaderSize() - kHeapObjectTag));
595 __ jmp(EAX);
596
597 __ Bind(&lookup);
598 __ jmp(&StubCode::InstanceFunctionLookupLabel());
599 }
600
601
571 // Called for inline allocation of arrays. 602 // Called for inline allocation of arrays.
572 // Input parameters: 603 // Input parameters:
573 // EDX : Array length as Smi. 604 // EDX : Array length as Smi.
574 // ECX : array element type (either NULL or an instantiated type). 605 // ECX : array element type (either NULL or an instantiated type).
575 // Uses EAX, EBX, ECX, EDI as temporary registers. 606 // Uses EAX, EBX, ECX, EDI as temporary registers.
576 // NOTE: EDX cannot be clobbered here as the caller relies on it being saved. 607 // NOTE: EDX cannot be clobbered here as the caller relies on it being saved.
577 // The newly allocated object is returned in EAX. 608 // The newly allocated object is returned in EAX.
578 void StubCode::GenerateAllocateArrayStub(Assembler* assembler) { 609 void StubCode::GenerateAllocateArrayStub(Assembler* assembler) {
579 Label slow_case; 610 Label slow_case;
580 const Immediate raw_null = 611 const Immediate raw_null =
(...skipping 1635 matching lines...) Expand 10 before | Expand all | Expand 10 after
2216 __ Bind(&done); 2247 __ Bind(&done);
2217 __ popl(temp); 2248 __ popl(temp);
2218 __ popl(right); 2249 __ popl(right);
2219 __ popl(left); 2250 __ popl(left);
2220 __ ret(); 2251 __ ret();
2221 } 2252 }
2222 2253
2223 } // namespace dart 2254 } // namespace dart
2224 2255
2225 #endif // defined TARGET_ARCH_IA32 2256 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698