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 <setjmp.h> // NOLINT | 5 #include <setjmp.h> // NOLINT |
6 #include <stdlib.h> | 6 #include <stdlib.h> |
7 | 7 |
8 #include "vm/globals.h" | 8 #include "vm/globals.h" |
9 #if defined(TARGET_ARCH_ARM) | 9 #if defined(TARGET_ARCH_ARM) |
10 | 10 |
(...skipping 3741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3752 set_register(LR, kEndSimulatingPC); | 3752 set_register(LR, kEndSimulatingPC); |
3753 | 3753 |
3754 // Remember the values of callee-saved registers. | 3754 // Remember the values of callee-saved registers. |
3755 // The code below assumes that r9 is not used as sb (static base) in | 3755 // The code below assumes that r9 is not used as sb (static base) in |
3756 // simulator code and therefore is regarded as a callee-saved register. | 3756 // simulator code and therefore is regarded as a callee-saved register. |
3757 int32_t r4_val = get_register(R4); | 3757 int32_t r4_val = get_register(R4); |
3758 int32_t r5_val = get_register(R5); | 3758 int32_t r5_val = get_register(R5); |
3759 int32_t r6_val = get_register(R6); | 3759 int32_t r6_val = get_register(R6); |
3760 int32_t r7_val = get_register(R7); | 3760 int32_t r7_val = get_register(R7); |
3761 int32_t r8_val = get_register(R8); | 3761 int32_t r8_val = get_register(R8); |
3762 #if !defined(TARGET_OS_MACOS) | 3762 #if defined(TARGET_ABI_EABI) |
3763 int32_t r9_val = get_register(R9); | 3763 int32_t r9_val = get_register(R9); |
3764 #endif | 3764 #endif |
3765 int32_t r10_val = get_register(R10); | 3765 int32_t r10_val = get_register(R10); |
3766 int32_t r11_val = get_register(R11); | 3766 int32_t r11_val = get_register(R11); |
3767 | 3767 |
3768 double d8_val = 0.0; | 3768 double d8_val = 0.0; |
3769 double d9_val = 0.0; | 3769 double d9_val = 0.0; |
3770 double d10_val = 0.0; | 3770 double d10_val = 0.0; |
3771 double d11_val = 0.0; | 3771 double d11_val = 0.0; |
3772 double d12_val = 0.0; | 3772 double d12_val = 0.0; |
(...skipping 13 matching lines...) Expand all Loading... |
3786 } | 3786 } |
3787 | 3787 |
3788 // Setup the callee-saved registers with a known value. To be able to check | 3788 // Setup the callee-saved registers with a known value. To be able to check |
3789 // that they are preserved properly across dart execution. | 3789 // that they are preserved properly across dart execution. |
3790 int32_t callee_saved_value = icount_; | 3790 int32_t callee_saved_value = icount_; |
3791 set_register(R4, callee_saved_value); | 3791 set_register(R4, callee_saved_value); |
3792 set_register(R5, callee_saved_value); | 3792 set_register(R5, callee_saved_value); |
3793 set_register(R6, callee_saved_value); | 3793 set_register(R6, callee_saved_value); |
3794 set_register(R7, callee_saved_value); | 3794 set_register(R7, callee_saved_value); |
3795 set_register(R8, callee_saved_value); | 3795 set_register(R8, callee_saved_value); |
3796 #if !defined(TARGET_OS_MACOS) | 3796 #if defined(TARGET_ABI_EABI) |
3797 set_register(R9, callee_saved_value); | 3797 set_register(R9, callee_saved_value); |
3798 #endif | 3798 #endif |
3799 set_register(R10, callee_saved_value); | 3799 set_register(R10, callee_saved_value); |
3800 set_register(R11, callee_saved_value); | 3800 set_register(R11, callee_saved_value); |
3801 | 3801 |
3802 double callee_saved_dvalue = 0.0; | 3802 double callee_saved_dvalue = 0.0; |
3803 if (TargetCPUFeatures::vfp_supported()) { | 3803 if (TargetCPUFeatures::vfp_supported()) { |
3804 callee_saved_dvalue = static_cast<double>(icount_); | 3804 callee_saved_dvalue = static_cast<double>(icount_); |
3805 set_dregister(D8, callee_saved_dvalue); | 3805 set_dregister(D8, callee_saved_dvalue); |
3806 set_dregister(D9, callee_saved_dvalue); | 3806 set_dregister(D9, callee_saved_dvalue); |
3807 set_dregister(D10, callee_saved_dvalue); | 3807 set_dregister(D10, callee_saved_dvalue); |
3808 set_dregister(D11, callee_saved_dvalue); | 3808 set_dregister(D11, callee_saved_dvalue); |
3809 set_dregister(D12, callee_saved_dvalue); | 3809 set_dregister(D12, callee_saved_dvalue); |
3810 set_dregister(D13, callee_saved_dvalue); | 3810 set_dregister(D13, callee_saved_dvalue); |
3811 set_dregister(D14, callee_saved_dvalue); | 3811 set_dregister(D14, callee_saved_dvalue); |
3812 set_dregister(D15, callee_saved_dvalue); | 3812 set_dregister(D15, callee_saved_dvalue); |
3813 } | 3813 } |
3814 | 3814 |
3815 // Start the simulation | 3815 // Start the simulation |
3816 Execute(); | 3816 Execute(); |
3817 | 3817 |
3818 // Check that the callee-saved registers have been preserved. | 3818 // Check that the callee-saved registers have been preserved. |
3819 ASSERT(callee_saved_value == get_register(R4)); | 3819 ASSERT(callee_saved_value == get_register(R4)); |
3820 ASSERT(callee_saved_value == get_register(R5)); | 3820 ASSERT(callee_saved_value == get_register(R5)); |
3821 ASSERT(callee_saved_value == get_register(R6)); | 3821 ASSERT(callee_saved_value == get_register(R6)); |
3822 ASSERT(callee_saved_value == get_register(R7)); | 3822 ASSERT(callee_saved_value == get_register(R7)); |
3823 ASSERT(callee_saved_value == get_register(R8)); | 3823 ASSERT(callee_saved_value == get_register(R8)); |
3824 #if !defined(TARGET_OS_MACOS) | 3824 #if defined(TARGET_ABI_EABI) |
3825 ASSERT(callee_saved_value == get_register(R9)); | 3825 ASSERT(callee_saved_value == get_register(R9)); |
3826 #endif | 3826 #endif |
3827 ASSERT(callee_saved_value == get_register(R10)); | 3827 ASSERT(callee_saved_value == get_register(R10)); |
3828 ASSERT(callee_saved_value == get_register(R11)); | 3828 ASSERT(callee_saved_value == get_register(R11)); |
3829 | 3829 |
3830 if (TargetCPUFeatures::vfp_supported()) { | 3830 if (TargetCPUFeatures::vfp_supported()) { |
3831 ASSERT(callee_saved_dvalue == get_dregister(D8)); | 3831 ASSERT(callee_saved_dvalue == get_dregister(D8)); |
3832 ASSERT(callee_saved_dvalue == get_dregister(D9)); | 3832 ASSERT(callee_saved_dvalue == get_dregister(D9)); |
3833 ASSERT(callee_saved_dvalue == get_dregister(D10)); | 3833 ASSERT(callee_saved_dvalue == get_dregister(D10)); |
3834 ASSERT(callee_saved_dvalue == get_dregister(D11)); | 3834 ASSERT(callee_saved_dvalue == get_dregister(D11)); |
3835 ASSERT(callee_saved_dvalue == get_dregister(D12)); | 3835 ASSERT(callee_saved_dvalue == get_dregister(D12)); |
3836 ASSERT(callee_saved_dvalue == get_dregister(D13)); | 3836 ASSERT(callee_saved_dvalue == get_dregister(D13)); |
3837 ASSERT(callee_saved_dvalue == get_dregister(D14)); | 3837 ASSERT(callee_saved_dvalue == get_dregister(D14)); |
3838 ASSERT(callee_saved_dvalue == get_dregister(D15)); | 3838 ASSERT(callee_saved_dvalue == get_dregister(D15)); |
3839 } | 3839 } |
3840 | 3840 |
3841 // Restore callee-saved registers with the original value. | 3841 // Restore callee-saved registers with the original value. |
3842 set_register(R4, r4_val); | 3842 set_register(R4, r4_val); |
3843 set_register(R5, r5_val); | 3843 set_register(R5, r5_val); |
3844 set_register(R6, r6_val); | 3844 set_register(R6, r6_val); |
3845 set_register(R7, r7_val); | 3845 set_register(R7, r7_val); |
3846 set_register(R8, r8_val); | 3846 set_register(R8, r8_val); |
3847 #if !defined(TARGET_OS_MACOS) | 3847 #if defined(TARGET_ABI_EABI) |
3848 set_register(R9, r9_val); | 3848 set_register(R9, r9_val); |
3849 #endif | 3849 #endif |
3850 set_register(R10, r10_val); | 3850 set_register(R10, r10_val); |
3851 set_register(R11, r11_val); | 3851 set_register(R11, r11_val); |
3852 | 3852 |
3853 if (TargetCPUFeatures::vfp_supported()) { | 3853 if (TargetCPUFeatures::vfp_supported()) { |
3854 set_dregister(D8, d8_val); | 3854 set_dregister(D8, d8_val); |
3855 set_dregister(D9, d9_val); | 3855 set_dregister(D9, d9_val); |
3856 set_dregister(D10, d10_val); | 3856 set_dregister(D10, d10_val); |
3857 set_dregister(D11, d11_val); | 3857 set_dregister(D11, d11_val); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3907 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception)); | 3907 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception)); |
3908 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace)); | 3908 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace)); |
3909 buf->Longjmp(); | 3909 buf->Longjmp(); |
3910 } | 3910 } |
3911 | 3911 |
3912 } // namespace dart | 3912 } // namespace dart |
3913 | 3913 |
3914 #endif // defined(USING_SIMULATOR) | 3914 #endif // defined(USING_SIMULATOR) |
3915 | 3915 |
3916 #endif // defined TARGET_ARCH_ARM | 3916 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |