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