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_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 Loading... |
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 AssemblerMacros::EnterStubFrame(assembler); |
| 569 // Load the receiver into RAX. The argument count in the arguments |
| 570 // descriptor in R10 is a smi. |
| 571 __ movq(RAX, FieldAddress(R10, ArgumentsDescriptor::count_offset())); |
| 572 // Two words (return addres, saved fp) in the stack above the last argument. |
| 573 __ movq(RAX, Address(RSP, RAX, TIMES_4, 2 * kWordSize)); |
| 574 // Preserve IC data and arguments descriptor. |
| 575 __ pushq(RBX); |
| 576 __ pushq(R10); |
| 577 |
| 578 const Immediate raw_null = |
| 579 Immediate(reinterpret_cast<intptr_t>(Instructions::null())); |
| 580 __ pushq(raw_null); // Space for the result of the runtime call. |
| 581 __ pushq(RAX); // Receiver. |
| 582 __ pushq(RBX); // IC data. |
| 583 __ pushq(R10); // Arguments descriptor. |
| 584 __ CallRuntime(kMegamorphicCacheMissHandlerRuntimeEntry); |
| 585 // Discard arguments. |
| 586 __ popq(RAX); |
| 587 __ popq(RAX); |
| 588 __ popq(RAX); |
| 589 __ popq(RAX); // Return value from the runtime call (instructions). |
| 590 __ popq(R10); // Restore arguments descriptor. |
| 591 __ popq(RBX); // Restore IC data. |
| 592 __ LeaveFrame(); |
| 593 |
| 594 Label lookup; |
| 595 __ cmpq(RAX, raw_null); |
| 596 __ j(EQUAL, &lookup, Assembler::kNearJump); |
| 597 __ addq(RAX, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); |
| 598 __ jmp(RAX); |
| 599 |
| 600 __ Bind(&lookup); |
| 601 __ jmp(&StubCode::InstanceFunctionLookupLabel()); |
| 602 } |
| 603 |
| 604 |
| 605 |
567 // Called for inline allocation of arrays. | 606 // Called for inline allocation of arrays. |
568 // Input parameters: | 607 // Input parameters: |
569 // R10 : Array length as Smi. | 608 // R10 : Array length as Smi. |
570 // RBX : array element type (either NULL or an instantiated type). | 609 // 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. | 610 // NOTE: R10 cannot be clobbered here as the caller relies on it being saved. |
572 // The newly allocated object is returned in RAX. | 611 // The newly allocated object is returned in RAX. |
573 void StubCode::GenerateAllocateArrayStub(Assembler* assembler) { | 612 void StubCode::GenerateAllocateArrayStub(Assembler* assembler) { |
574 Label slow_case; | 613 Label slow_case; |
575 const Immediate raw_null = | 614 const Immediate raw_null = |
576 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 615 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
(...skipping 1590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2167 __ cmpq(left, right); | 2206 __ cmpq(left, right); |
2168 __ Bind(&done); | 2207 __ Bind(&done); |
2169 __ popq(right); | 2208 __ popq(right); |
2170 __ popq(left); | 2209 __ popq(left); |
2171 __ ret(); | 2210 __ ret(); |
2172 } | 2211 } |
2173 | 2212 |
2174 } // namespace dart | 2213 } // namespace dart |
2175 | 2214 |
2176 #endif // defined TARGET_ARCH_X64 | 2215 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |