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

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: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/stub_code.h ('k') | runtime/vm/stub_code_x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 AssemblerMacros::EnterStubFrame(assembler);
573 // Load the receiver into EAX. The argument count in the arguments
574 // descriptor in EDX is a smi.
575 __ movl(EAX, FieldAddress(EDX, ArgumentsDescriptor::count_offset()));
576 // Two words (return addres, saved fp) in the stack above the last argument.
577 __ movl(EAX, Address(ESP, EAX, TIMES_2, 2 * kWordSize));
578 // Preserve IC data and arguments descriptor.
579 __ pushl(ECX);
580 __ pushl(EDX);
581
582 const Immediate raw_null =
583 Immediate(reinterpret_cast<intptr_t>(Instructions::null()));
584 __ pushl(raw_null); // Space for the result of the runtime call.
585 __ pushl(EAX); // Pass receiver.
586 __ pushl(ECX); // Pass IC data.
587 __ pushl(EDX); // Pass rguments descriptor.
588 __ CallRuntime(kMegamorphicCacheMissHandlerRuntimeEntry);
589 // Discard arguments.
590 __ popl(EAX);
591 __ popl(EAX);
592 __ popl(EAX);
593 __ popl(EAX); // Return value from the runtime call (instructions).
594 __ popl(EDX); // Restore arguments descriptor.
595 __ popl(ECX); // Restore IC data.
596 __ LeaveFrame();
597
598 Label lookup;
599 __ cmpl(EAX, raw_null);
600 __ j(EQUAL, &lookup, Assembler::kNearJump);
601 __ addl(EAX, Immediate(Instructions::HeaderSize() - kHeapObjectTag));
602 __ jmp(EAX);
603
604 __ Bind(&lookup);
605 __ jmp(&StubCode::InstanceFunctionLookupLabel());
606 }
607
608
571 // Called for inline allocation of arrays. 609 // Called for inline allocation of arrays.
572 // Input parameters: 610 // Input parameters:
573 // EDX : Array length as Smi. 611 // EDX : Array length as Smi.
574 // ECX : array element type (either NULL or an instantiated type). 612 // ECX : array element type (either NULL or an instantiated type).
575 // Uses EAX, EBX, ECX, EDI as temporary registers. 613 // Uses EAX, EBX, ECX, EDI as temporary registers.
576 // NOTE: EDX cannot be clobbered here as the caller relies on it being saved. 614 // NOTE: EDX cannot be clobbered here as the caller relies on it being saved.
577 // The newly allocated object is returned in EAX. 615 // The newly allocated object is returned in EAX.
578 void StubCode::GenerateAllocateArrayStub(Assembler* assembler) { 616 void StubCode::GenerateAllocateArrayStub(Assembler* assembler) {
579 Label slow_case; 617 Label slow_case;
580 const Immediate raw_null = 618 const Immediate raw_null =
(...skipping 1635 matching lines...) Expand 10 before | Expand all | Expand 10 after
2216 __ Bind(&done); 2254 __ Bind(&done);
2217 __ popl(temp); 2255 __ popl(temp);
2218 __ popl(right); 2256 __ popl(right);
2219 __ popl(left); 2257 __ popl(left);
2220 __ ret(); 2258 __ ret();
2221 } 2259 }
2222 2260
2223 } // namespace dart 2261 } // namespace dart
2224 2262
2225 #endif // defined TARGET_ARCH_IA32 2263 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/stub_code.h ('k') | runtime/vm/stub_code_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698