| 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 <math.h> // for isnan. | 5 #include <math.h> // for isnan. |
| 6 #include <setjmp.h> | 6 #include <setjmp.h> |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 | 8 |
| 9 #include "vm/globals.h" | 9 #include "vm/globals.h" |
| 10 #if defined(TARGET_ARCH_ARM) | 10 #if defined(TARGET_ARCH_ARM) |
| (...skipping 2723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2734 program_counter = get_pc(); | 2734 program_counter = get_pc(); |
| 2735 } | 2735 } |
| 2736 } | 2736 } |
| 2737 } | 2737 } |
| 2738 | 2738 |
| 2739 | 2739 |
| 2740 int64_t Simulator::Call(int32_t entry, | 2740 int64_t Simulator::Call(int32_t entry, |
| 2741 int32_t parameter0, | 2741 int32_t parameter0, |
| 2742 int32_t parameter1, | 2742 int32_t parameter1, |
| 2743 int32_t parameter2, | 2743 int32_t parameter2, |
| 2744 int32_t parameter3, | 2744 int32_t parameter3) { |
| 2745 int32_t parameter4) { | |
| 2746 // Save the SP register before the call so we can restore it. | 2745 // Save the SP register before the call so we can restore it. |
| 2747 int32_t sp_before_call = get_register(SP); | 2746 int32_t sp_before_call = get_register(SP); |
| 2748 | 2747 |
| 2749 // Setup parameters. | 2748 // Setup parameters. |
| 2750 set_register(R0, parameter0); | 2749 set_register(R0, parameter0); |
| 2751 set_register(R1, parameter1); | 2750 set_register(R1, parameter1); |
| 2752 set_register(R2, parameter2); | 2751 set_register(R2, parameter2); |
| 2753 set_register(R3, parameter3); | 2752 set_register(R3, parameter3); |
| 2754 | 2753 |
| 2755 // Reserve room for one stack parameter. | 2754 // Make sure the activation frames are properly aligned. |
| 2756 int32_t stack_pointer = sp_before_call; | 2755 int32_t stack_pointer = sp_before_call; |
| 2757 stack_pointer -= kWordSize; | |
| 2758 | |
| 2759 // Make sure the activation frames are properly aligned. | |
| 2760 static const int kFrameAlignment = OS::ActivationFrameAlignment(); | 2756 static const int kFrameAlignment = OS::ActivationFrameAlignment(); |
| 2761 if (kFrameAlignment > 0) { | 2757 if (kFrameAlignment > 0) { |
| 2762 stack_pointer = Utils::RoundDown(stack_pointer, kFrameAlignment); | 2758 stack_pointer = Utils::RoundDown(stack_pointer, kFrameAlignment); |
| 2763 } | 2759 } |
| 2764 | |
| 2765 // Write the fourth parameter to the stack and update register SP. | |
| 2766 *reinterpret_cast<int32_t*>(stack_pointer) = parameter4; | |
| 2767 set_register(SP, stack_pointer); | 2760 set_register(SP, stack_pointer); |
| 2768 | 2761 |
| 2769 // Prepare to execute the code at entry. | 2762 // Prepare to execute the code at entry. |
| 2770 set_register(PC, entry); | 2763 set_register(PC, entry); |
| 2771 // Put down marker for end of simulation. The simulator will stop simulation | 2764 // Put down marker for end of simulation. The simulator will stop simulation |
| 2772 // when the PC reaches this value. By saving the "end simulation" value into | 2765 // when the PC reaches this value. By saving the "end simulation" value into |
| 2773 // the LR the simulation stops when returning to this call point. | 2766 // the LR the simulation stops when returning to this call point. |
| 2774 set_register(LR, kEndSimulatingPC); | 2767 set_register(LR, kEndSimulatingPC); |
| 2775 | 2768 |
| 2776 // Remember the values of callee-saved registers. | 2769 // Remember the values of callee-saved registers. |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2846 // isolate->ChangeStateToGeneratedCode(); | 2839 // isolate->ChangeStateToGeneratedCode(); |
| 2847 set_register(kExceptionObjectReg, bit_cast<int32_t>(object.raw())); | 2840 set_register(kExceptionObjectReg, bit_cast<int32_t>(object.raw())); |
| 2848 buf->Longjmp(); | 2841 buf->Longjmp(); |
| 2849 } | 2842 } |
| 2850 | 2843 |
| 2851 } // namespace dart | 2844 } // namespace dart |
| 2852 | 2845 |
| 2853 #endif // !defined(HOST_ARCH_ARM) | 2846 #endif // !defined(HOST_ARCH_ARM) |
| 2854 | 2847 |
| 2855 #endif // defined TARGET_ARCH_ARM | 2848 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |