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 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 __ pushq(RBX); | 553 __ pushq(RBX); |
554 GenerateDeoptimizationSequence(assembler, true); // Preserve RAX. | 554 GenerateDeoptimizationSequence(assembler, true); // Preserve RAX. |
555 } | 555 } |
556 | 556 |
557 | 557 |
558 void StubCode::GenerateDeoptimizeStub(Assembler* assembler) { | 558 void StubCode::GenerateDeoptimizeStub(Assembler* assembler) { |
559 GenerateDeoptimizationSequence(assembler, false); // Don't preserve RAX. | 559 GenerateDeoptimizationSequence(assembler, false); // Don't preserve RAX. |
560 } | 560 } |
561 | 561 |
562 | 562 |
| 563 void StubCode::GenerateMegamorphicMissStub(Assembler* assembler) { |
| 564 const Immediate raw_null = |
| 565 Immediate(reinterpret_cast<intptr_t>(Instructions::null())); |
| 566 AssemblerMacros::EnterStubFrame(assembler); |
| 567 __ pushq(raw_null); // Space for the result of the runtime call. |
| 568 // Load the receiver into RAX. The argument count in the arguments |
| 569 // descriptor is a smi. |
| 570 __ movq(RAX, FieldAddress(R10, Array::data_offset())); |
| 571 // Three words in the stack above the last argument. |
| 572 __ movq(RAX, Address(RSP, RAX, TIMES_4, 3 * kWordSize)); |
| 573 __ pushq(RAX); // Receiver. |
| 574 __ pushq(RBX); // IC data. |
| 575 __ pushq(R10); // Arguments descriptor. |
| 576 __ CallRuntime(kMegamorphicCacheMissHandlerRuntimeEntry); |
| 577 __ popq(R10); // Arguments descriptor. |
| 578 __ popq(RBX); // IC data. |
| 579 __ popq(RAX); // Discard. |
| 580 __ popq(RAX); // Return value from the runtime call (instructions). |
| 581 __ LeaveFrame(); |
| 582 |
| 583 Label lookup; |
| 584 __ cmpq(RAX, raw_null); |
| 585 __ j(EQUAL, &lookup, Assembler::kNearJump); |
| 586 __ addq(RAX, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); |
| 587 __ jmp(RAX); |
| 588 |
| 589 __ Bind(&lookup); |
| 590 __ int3(); |
| 591 __ jmp(&StubCode::InstanceFunctionLookupLabel()); |
| 592 } |
| 593 |
| 594 |
| 595 |
563 // Called for inline allocation of arrays. | 596 // Called for inline allocation of arrays. |
564 // Input parameters: | 597 // Input parameters: |
565 // R10 : Array length as Smi. | 598 // R10 : Array length as Smi. |
566 // RBX : array element type (either NULL or an instantiated type). | 599 // RBX : array element type (either NULL or an instantiated type). |
567 // NOTE: R10 cannot be clobbered here as the caller relies on it being saved. | 600 // NOTE: R10 cannot be clobbered here as the caller relies on it being saved. |
568 // The newly allocated object is returned in RAX. | 601 // The newly allocated object is returned in RAX. |
569 void StubCode::GenerateAllocateArrayStub(Assembler* assembler) { | 602 void StubCode::GenerateAllocateArrayStub(Assembler* assembler) { |
570 Label slow_case; | 603 Label slow_case; |
571 const Immediate raw_null = | 604 const Immediate raw_null = |
572 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 605 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
(...skipping 1590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2163 __ cmpq(left, right); | 2196 __ cmpq(left, right); |
2164 __ Bind(&done); | 2197 __ Bind(&done); |
2165 __ popq(right); | 2198 __ popq(right); |
2166 __ popq(left); | 2199 __ popq(left); |
2167 __ ret(); | 2200 __ ret(); |
2168 } | 2201 } |
2169 | 2202 |
2170 } // namespace dart | 2203 } // namespace dart |
2171 | 2204 |
2172 #endif // defined TARGET_ARCH_X64 | 2205 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |