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 3859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3870 } else { | 3870 } else { |
3871 return_value = Utils::LowHighTo64Bits(get_register(R0), get_register(R1)); | 3871 return_value = Utils::LowHighTo64Bits(get_register(R0), get_register(R1)); |
3872 } | 3872 } |
3873 return return_value; | 3873 return return_value; |
3874 } | 3874 } |
3875 | 3875 |
3876 | 3876 |
3877 void Simulator::Longjmp(uword pc, | 3877 void Simulator::Longjmp(uword pc, |
3878 uword sp, | 3878 uword sp, |
3879 uword fp, | 3879 uword fp, |
3880 uword pp, | |
3881 RawObject* raw_exception, | 3880 RawObject* raw_exception, |
3882 RawObject* raw_stacktrace, | 3881 RawObject* raw_stacktrace, |
3883 Thread* thread) { | 3882 Thread* thread) { |
3884 // Walk over all setjmp buffers (simulated --> C++ transitions) | 3883 // Walk over all setjmp buffers (simulated --> C++ transitions) |
3885 // and try to find the setjmp associated with the simulated stack pointer. | 3884 // and try to find the setjmp associated with the simulated stack pointer. |
3886 SimulatorSetjmpBuffer* buf = last_setjmp_buffer(); | 3885 SimulatorSetjmpBuffer* buf = last_setjmp_buffer(); |
3887 while (buf->link() != NULL && buf->link()->sp() <= sp) { | 3886 while (buf->link() != NULL && buf->link()->sp() <= sp) { |
3888 buf = buf->link(); | 3887 buf = buf->link(); |
3889 } | 3888 } |
3890 ASSERT(buf != NULL); | 3889 ASSERT(buf != NULL); |
3891 | 3890 |
3892 // The C++ caller has not cleaned up the stack memory of C++ frames. | 3891 // The C++ caller has not cleaned up the stack memory of C++ frames. |
3893 // Prepare for unwinding frames by destroying all the stack resources | 3892 // Prepare for unwinding frames by destroying all the stack resources |
3894 // in the previous C++ frames. | 3893 // in the previous C++ frames. |
3895 StackResource::Unwind(thread); | 3894 StackResource::Unwind(thread); |
3896 | 3895 |
3897 // Unwind the C++ stack and continue simulation in the target frame. | 3896 // Unwind the C++ stack and continue simulation in the target frame. |
3898 set_register(PC, static_cast<int32_t>(pc)); | 3897 set_register(PC, static_cast<int32_t>(pc)); |
3899 set_register(SP, static_cast<int32_t>(sp)); | 3898 set_register(SP, static_cast<int32_t>(sp)); |
3900 set_register(FP, static_cast<int32_t>(fp)); | 3899 set_register(FP, static_cast<int32_t>(fp)); |
3901 set_register(PP, static_cast<int32_t>(pp)); | |
3902 set_register(THR, reinterpret_cast<uword>(thread)); | 3900 set_register(THR, reinterpret_cast<uword>(thread)); |
3903 // Set the tag. | 3901 // Set the tag. |
3904 thread->set_vm_tag(VMTag::kDartTagId); | 3902 thread->set_vm_tag(VMTag::kDartTagId); |
3905 // Clear top exit frame. | 3903 // Clear top exit frame. |
3906 thread->set_top_exit_frame_info(0); | 3904 thread->set_top_exit_frame_info(0); |
3907 | 3905 |
3908 ASSERT(raw_exception != Object::null()); | 3906 ASSERT(raw_exception != Object::null()); |
3909 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception)); | 3907 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception)); |
3910 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace)); | 3908 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace)); |
| 3909 // Restore pool pointer. |
| 3910 int32_t code = *reinterpret_cast<int32_t*>( |
| 3911 fp + kPcMarkerSlotFromFp * kWordSize); |
| 3912 int32_t pp = *reinterpret_cast<int32_t*>( |
| 3913 code + Code::object_pool_offset() - kHeapObjectTag); |
| 3914 set_register(CODE_REG, code); |
| 3915 set_register(PP, pp); |
3911 buf->Longjmp(); | 3916 buf->Longjmp(); |
3912 } | 3917 } |
3913 | 3918 |
3914 } // namespace dart | 3919 } // namespace dart |
3915 | 3920 |
3916 #endif // defined(USING_SIMULATOR) | 3921 #endif // defined(USING_SIMULATOR) |
3917 | 3922 |
3918 #endif // defined TARGET_ARCH_ARM | 3923 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |