OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
661 // returning here. | 661 // returning here. |
662 // If no call method exists, throw a NoSuchMethodError. | 662 // If no call method exists, throw a NoSuchMethodError. |
663 // R13: non-closure object. | 663 // R13: non-closure object. |
664 // R10: arguments descriptor array. | 664 // R10: arguments descriptor array. |
665 | 665 |
666 // Create a stub frame as we are pushing some objects on the stack before | 666 // Create a stub frame as we are pushing some objects on the stack before |
667 // calling into the runtime. | 667 // calling into the runtime. |
668 AssemblerMacros::EnterStubFrame(assembler); | 668 AssemblerMacros::EnterStubFrame(assembler); |
669 | 669 |
670 __ pushq(raw_null); // Setup space on stack for result from call. | 670 __ pushq(raw_null); // Setup space on stack for result from call. |
671 __ pushq(R13); // Non-closure object. | |
672 __ pushq(R10); // Arguments descriptor. | 671 __ pushq(R10); // Arguments descriptor. |
673 // Load smi-tagged arguments array length, including the non-closure. | 672 // Load smi-tagged arguments array length, including the non-closure. |
674 __ movq(R10, FieldAddress(R10, ArgumentsDescriptor::count_offset())); | 673 __ movq(R10, FieldAddress(R10, ArgumentsDescriptor::count_offset())); |
675 // See stack layout below explaining "wordSize * 6" offset. | 674 // See stack layout below explaining "wordSize * 5" offset. |
676 PushArgumentsArray(assembler, (kWordSize * 6)); | 675 PushArgumentsArray(assembler, (kWordSize * 5)); |
677 | 676 |
678 // Stack: | 677 // Stack: |
679 // TOS + 0: Argument array. | 678 // TOS + 0: Argument array. |
680 // TOS + 1: Arguments descriptor array. | 679 // TOS + 1: Arguments descriptor array. |
681 // TOS + 2: Non-closure object. | 680 // TOS + 2: Place for result from the call. |
682 // TOS + 3: Place for result from the call. | 681 // TOS + 3: PC marker => RawInstruction object. |
683 // TOS + 4: PC marker => RawInstruction object. | 682 // TOS + 4: Saved RBP of previous frame. <== RBP |
684 // TOS + 5: Saved RBP of previous frame. <== RBP | 683 // TOS + 5: Dart code return address |
685 // TOS + 6: Dart code return address | 684 // TOS + 6: Last argument of caller. |
686 // TOS + 7: Last argument of caller. | |
687 // .... | 685 // .... |
688 __ CallRuntime(kInvokeNonClosureRuntimeEntry); | 686 __ CallRuntime(kInvokeNonClosureRuntimeEntry); |
689 // Remove arguments. | 687 // Remove arguments. |
690 __ popq(RAX); | 688 __ popq(RAX); |
691 __ popq(RAX); | 689 __ popq(RAX); |
692 __ popq(RAX); | |
693 __ popq(RAX); // Get result into RAX. | 690 __ popq(RAX); // Get result into RAX. |
694 | 691 |
695 // Remove the stub frame as we are about to return. | 692 // Remove the stub frame as we are about to return. |
696 __ LeaveFrame(); | 693 __ LeaveFrame(); |
697 __ ret(); | 694 __ ret(); |
698 } | 695 } |
699 | 696 |
700 | 697 |
701 // Called when invoking Dart code from C++ (VM code). | 698 // Called when invoking Dart code from C++ (VM code). |
702 // Input parameters: | 699 // Input parameters: |
(...skipping 1375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2078 __ cmpq(left, right); | 2075 __ cmpq(left, right); |
2079 __ Bind(&done); | 2076 __ Bind(&done); |
2080 __ popq(right); | 2077 __ popq(right); |
2081 __ popq(left); | 2078 __ popq(left); |
2082 __ ret(); | 2079 __ ret(); |
2083 } | 2080 } |
2084 | 2081 |
2085 } // namespace dart | 2082 } // namespace dart |
2086 | 2083 |
2087 #endif // defined TARGET_ARCH_X64 | 2084 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |