OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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_ARM64) | 9 #if defined(TARGET_ARCH_ARM64) |
10 | 10 |
(...skipping 3584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3595 int64_t return_value; | 3595 int64_t return_value; |
3596 if (fp_return) { | 3596 if (fp_return) { |
3597 return_value = get_vregisterd(V0, 0); | 3597 return_value = get_vregisterd(V0, 0); |
3598 } else { | 3598 } else { |
3599 return_value = get_register(R0); | 3599 return_value = get_register(R0); |
3600 } | 3600 } |
3601 return return_value; | 3601 return return_value; |
3602 } | 3602 } |
3603 | 3603 |
3604 | 3604 |
3605 void Simulator::JumpToFrame(uword pc, uword sp, uword fp, Thread* thread) { | 3605 void Simulator::Longjmp(uword pc, |
| 3606 uword sp, |
| 3607 uword fp, |
| 3608 RawObject* raw_exception, |
| 3609 RawObject* raw_stacktrace, |
| 3610 Thread* thread) { |
3606 // Walk over all setjmp buffers (simulated --> C++ transitions) | 3611 // Walk over all setjmp buffers (simulated --> C++ transitions) |
3607 // and try to find the setjmp associated with the simulated stack pointer. | 3612 // and try to find the setjmp associated with the simulated stack pointer. |
3608 SimulatorSetjmpBuffer* buf = last_setjmp_buffer(); | 3613 SimulatorSetjmpBuffer* buf = last_setjmp_buffer(); |
3609 while (buf->link() != NULL && buf->link()->sp() <= sp) { | 3614 while (buf->link() != NULL && buf->link()->sp() <= sp) { |
3610 buf = buf->link(); | 3615 buf = buf->link(); |
3611 } | 3616 } |
3612 ASSERT(buf != NULL); | 3617 ASSERT(buf != NULL); |
3613 | 3618 |
3614 // The C++ caller has not cleaned up the stack memory of C++ frames. | 3619 // The C++ caller has not cleaned up the stack memory of C++ frames. |
3615 // Prepare for unwinding frames by destroying all the stack resources | 3620 // Prepare for unwinding frames by destroying all the stack resources |
3616 // in the previous C++ frames. | 3621 // in the previous C++ frames. |
3617 StackResource::Unwind(thread); | 3622 StackResource::Unwind(thread); |
3618 | 3623 |
3619 // Unwind the C++ stack and continue simulation in the target frame. | 3624 // Unwind the C++ stack and continue simulation in the target frame. |
3620 set_pc(static_cast<int64_t>(pc)); | 3625 set_pc(static_cast<int64_t>(pc)); |
3621 set_register(NULL, SP, static_cast<int64_t>(sp)); | 3626 set_register(NULL, SP, static_cast<int64_t>(sp)); |
3622 set_register(NULL, FP, static_cast<int64_t>(fp)); | 3627 set_register(NULL, FP, static_cast<int64_t>(fp)); |
3623 set_register(NULL, THR, reinterpret_cast<int64_t>(thread)); | 3628 set_register(NULL, THR, reinterpret_cast<int64_t>(thread)); |
3624 // Set the tag. | 3629 // Set the tag. |
3625 thread->set_vm_tag(VMTag::kDartTagId); | 3630 thread->set_vm_tag(VMTag::kDartTagId); |
3626 // Clear top exit frame. | 3631 // Clear top exit frame. |
3627 thread->set_top_exit_frame_info(0); | 3632 thread->set_top_exit_frame_info(0); |
| 3633 |
| 3634 ASSERT(raw_exception != Object::null()); |
| 3635 set_register(NULL, kExceptionObjectReg, bit_cast<int64_t>(raw_exception)); |
| 3636 set_register(NULL, kStackTraceObjectReg, bit_cast<int64_t>(raw_stacktrace)); |
3628 // Restore pool pointer. | 3637 // Restore pool pointer. |
3629 int64_t code = | 3638 int64_t code = |
3630 *reinterpret_cast<int64_t*>(fp + kPcMarkerSlotFromFp * kWordSize); | 3639 *reinterpret_cast<int64_t*>(fp + kPcMarkerSlotFromFp * kWordSize); |
3631 int64_t pp = *reinterpret_cast<int64_t*>(code + Code::object_pool_offset() - | 3640 int64_t pp = *reinterpret_cast<int64_t*>(code + Code::object_pool_offset() - |
3632 kHeapObjectTag); | 3641 kHeapObjectTag); |
3633 pp -= kHeapObjectTag; // In the PP register, the pool pointer is untagged. | 3642 pp -= kHeapObjectTag; // In the PP register, the pool pointer is untagged. |
3634 set_register(NULL, CODE_REG, code); | 3643 set_register(NULL, CODE_REG, code); |
3635 set_register(NULL, PP, pp); | 3644 set_register(NULL, PP, pp); |
3636 buf->Longjmp(); | 3645 buf->Longjmp(); |
3637 } | 3646 } |
3638 | 3647 |
3639 } // namespace dart | 3648 } // namespace dart |
3640 | 3649 |
3641 #endif // !defined(USING_SIMULATOR) | 3650 #endif // !defined(USING_SIMULATOR) |
3642 | 3651 |
3643 #endif // defined TARGET_ARCH_ARM64 | 3652 #endif // defined TARGET_ARCH_ARM64 |
OLD | NEW |