| 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 3488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3499 } | 3499 } |
| 3500 return return_value; | 3500 return return_value; |
| 3501 } | 3501 } |
| 3502 | 3502 |
| 3503 | 3503 |
| 3504 void Simulator::Longjmp(uword pc, | 3504 void Simulator::Longjmp(uword pc, |
| 3505 uword sp, | 3505 uword sp, |
| 3506 uword fp, | 3506 uword fp, |
| 3507 RawObject* raw_exception, | 3507 RawObject* raw_exception, |
| 3508 RawObject* raw_stacktrace, | 3508 RawObject* raw_stacktrace, |
| 3509 Isolate* isolate) { | 3509 Thread* thread) { |
| 3510 // Walk over all setjmp buffers (simulated --> C++ transitions) | 3510 // Walk over all setjmp buffers (simulated --> C++ transitions) |
| 3511 // and try to find the setjmp associated with the simulated stack pointer. | 3511 // and try to find the setjmp associated with the simulated stack pointer. |
| 3512 SimulatorSetjmpBuffer* buf = last_setjmp_buffer(); | 3512 SimulatorSetjmpBuffer* buf = last_setjmp_buffer(); |
| 3513 while (buf->link() != NULL && buf->link()->sp() <= sp) { | 3513 while (buf->link() != NULL && buf->link()->sp() <= sp) { |
| 3514 buf = buf->link(); | 3514 buf = buf->link(); |
| 3515 } | 3515 } |
| 3516 ASSERT(buf != NULL); | 3516 ASSERT(buf != NULL); |
| 3517 | 3517 |
| 3518 // The C++ caller has not cleaned up the stack memory of C++ frames. | 3518 // The C++ caller has not cleaned up the stack memory of C++ frames. |
| 3519 // Prepare for unwinding frames by destroying all the stack resources | 3519 // Prepare for unwinding frames by destroying all the stack resources |
| 3520 // in the previous C++ frames. | 3520 // in the previous C++ frames. |
| 3521 Isolate* isolate = thread->isolate(); |
| 3521 StackResource::Unwind(isolate); | 3522 StackResource::Unwind(isolate); |
| 3522 | 3523 |
| 3523 // Unwind the C++ stack and continue simulation in the target frame. | 3524 // Unwind the C++ stack and continue simulation in the target frame. |
| 3524 set_pc(static_cast<int64_t>(pc)); | 3525 set_pc(static_cast<int64_t>(pc)); |
| 3525 set_register(NULL, SP, static_cast<int64_t>(sp)); | 3526 set_register(NULL, SP, static_cast<int64_t>(sp)); |
| 3526 set_register(NULL, FP, static_cast<int64_t>(fp)); | 3527 set_register(NULL, FP, static_cast<int64_t>(fp)); |
| 3528 set_register(NULL, THR, reinterpret_cast<int64_t>(thread)); |
| 3527 // Set the tag. | 3529 // Set the tag. |
| 3528 isolate->set_vm_tag(VMTag::kDartTagId); | 3530 isolate->set_vm_tag(VMTag::kDartTagId); |
| 3529 // Clear top exit frame. | 3531 // Clear top exit frame. |
| 3530 isolate->set_top_exit_frame_info(0); | 3532 isolate->set_top_exit_frame_info(0); |
| 3531 | 3533 |
| 3532 ASSERT(raw_exception != Object::null()); | 3534 ASSERT(raw_exception != Object::null()); |
| 3533 set_register(NULL, kExceptionObjectReg, bit_cast<int64_t>(raw_exception)); | 3535 set_register(NULL, kExceptionObjectReg, bit_cast<int64_t>(raw_exception)); |
| 3534 set_register(NULL, kStackTraceObjectReg, bit_cast<int64_t>(raw_stacktrace)); | 3536 set_register(NULL, kStackTraceObjectReg, bit_cast<int64_t>(raw_stacktrace)); |
| 3535 buf->Longjmp(); | 3537 buf->Longjmp(); |
| 3536 } | 3538 } |
| 3537 | 3539 |
| 3538 } // namespace dart | 3540 } // namespace dart |
| 3539 | 3541 |
| 3540 #endif // !defined(HOST_ARCH_ARM64) | 3542 #endif // !defined(HOST_ARCH_ARM64) |
| 3541 | 3543 |
| 3542 #endif // defined TARGET_ARCH_ARM64 | 3544 #endif // defined TARGET_ARCH_ARM64 |
| OLD | NEW |