OLD | NEW |
---|---|
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 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
557 __ pushl(EBX); | 557 __ pushl(EBX); |
558 GenerateDeoptimizationSequence(assembler, true); // Preserve EAX. | 558 GenerateDeoptimizationSequence(assembler, true); // Preserve EAX. |
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 EAX. | 563 GenerateDeoptimizationSequence(assembler, false); // Don't preserve EAX. |
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 __ pushl(raw_null); // Space for the result of the runtime call. | |
572 // Load the receiver into EAX. The argument count in the arguments | |
573 // descriptor is a smi. | |
srdjan
2012/12/03 19:10:46
Please document that EDX contains argument descrip
Kevin Millikin (Google)
2012/12/06 14:03:11
OK.
| |
574 __ movl(EAX, FieldAddress(EDX, Array::data_offset())); | |
575 // Three words in the stack above the last argument. | |
576 __ movl(EAX, Address(ESP, EAX, TIMES_2, 3 * kWordSize)); | |
577 __ pushl(EAX); // Receiver. | |
578 __ pushl(ECX); // IC data. | |
579 __ pushl(EDX); // Arguments descriptor. | |
580 __ CallRuntime(kMegamorphicCacheMissHandlerRuntimeEntry); | |
581 __ popl(EDX); // Arguments descriptor. | |
srdjan
2012/12/03 19:10:46
You need to preserve/restore argument descriptor a
Kevin Millikin (Google)
2012/12/06 14:03:11
Thank you, good catch.
| |
582 __ popl(ECX); // IC data. | |
583 __ popl(EAX); // Discard. | |
584 __ popl(EAX); // Return value from the runtime call (instructions). | |
585 __ LeaveFrame(); | |
srdjan
2012/12/03 19:10:46
null as result should not be possible, should it?
Kevin Millikin (Google)
2012/12/06 14:03:11
No such method, implicit closures.
| |
586 | |
587 Label lookup; | |
588 __ cmpl(EAX, raw_null); | |
589 __ j(EQUAL, &lookup, Assembler::kNearJump); | |
590 __ addl(EAX, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); | |
591 __ jmp(EAX); | |
592 | |
593 __ Bind(&lookup); | |
594 __ int3(); | |
Vyacheslav Egorov (Google)
2012/12/03 14:55:22
What's up with this int3?
If it can not be reache
Kevin Millikin (Google)
2012/12/06 14:03:11
Thanks for catching it. It's a reminder to myself
| |
595 __ jmp(&StubCode::InstanceFunctionLookupLabel()); | |
596 } | |
597 | |
598 | |
567 // Called for inline allocation of arrays. | 599 // Called for inline allocation of arrays. |
568 // Input parameters: | 600 // Input parameters: |
569 // EDX : Array length as Smi. | 601 // EDX : Array length as Smi. |
570 // ECX : array element type (either NULL or an instantiated type). | 602 // ECX : array element type (either NULL or an instantiated type). |
571 // Uses EAX, EBX, ECX, EDI as temporary registers. | 603 // Uses EAX, EBX, ECX, EDI as temporary registers. |
572 // NOTE: EDX cannot be clobbered here as the caller relies on it being saved. | 604 // NOTE: EDX cannot be clobbered here as the caller relies on it being saved. |
573 // The newly allocated object is returned in EAX. | 605 // The newly allocated object is returned in EAX. |
574 void StubCode::GenerateAllocateArrayStub(Assembler* assembler) { | 606 void StubCode::GenerateAllocateArrayStub(Assembler* assembler) { |
575 Label slow_case; | 607 Label slow_case; |
576 const Immediate raw_null = | 608 const Immediate raw_null = |
(...skipping 1635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2212 __ Bind(&done); | 2244 __ Bind(&done); |
2213 __ popl(temp); | 2245 __ popl(temp); |
2214 __ popl(right); | 2246 __ popl(right); |
2215 __ popl(left); | 2247 __ popl(left); |
2216 __ ret(); | 2248 __ ret(); |
2217 } | 2249 } |
2218 | 2250 |
2219 } // namespace dart | 2251 } // namespace dart |
2220 | 2252 |
2221 #endif // defined TARGET_ARCH_IA32 | 2253 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |