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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 // "This" is now the last setjmp buffer. | 48 // "This" is now the last setjmp buffer. |
49 simulator_->set_last_setjmp_buffer(this); | 49 simulator_->set_last_setjmp_buffer(this); |
50 longjmp(buffer_, 1); | 50 longjmp(buffer_, 1); |
51 } | 51 } |
52 | 52 |
53 explicit SimulatorSetjmpBuffer(Simulator* sim) { | 53 explicit SimulatorSetjmpBuffer(Simulator* sim) { |
54 simulator_ = sim; | 54 simulator_ = sim; |
55 link_ = sim->last_setjmp_buffer(); | 55 link_ = sim->last_setjmp_buffer(); |
56 sim->set_last_setjmp_buffer(this); | 56 sim->set_last_setjmp_buffer(this); |
57 sp_ = static_cast<uword>(sim->get_register(R31, R31IsSP)); | 57 sp_ = static_cast<uword>(sim->get_register(R31, R31IsSP)); |
58 native_sp_ = reinterpret_cast<uword>(&sim); // Current C++ stack pointer. | 58 native_sp_ = Isolate::GetCurrentStackPointer(); |
59 } | 59 } |
60 | 60 |
61 ~SimulatorSetjmpBuffer() { | 61 ~SimulatorSetjmpBuffer() { |
62 ASSERT(simulator_->last_setjmp_buffer() == this); | 62 ASSERT(simulator_->last_setjmp_buffer() == this); |
63 simulator_->set_last_setjmp_buffer(link_); | 63 simulator_->set_last_setjmp_buffer(link_); |
64 } | 64 } |
65 | 65 |
66 SimulatorSetjmpBuffer* link() { return link_; } | 66 SimulatorSetjmpBuffer* link() { return link_; } |
67 | 67 |
68 uword sp() { return sp_; } | 68 uword sp() { return sp_; } |
(...skipping 1510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1579 Redirection* redirection = Redirection::FromHltInstruction(instr); | 1579 Redirection* redirection = Redirection::FromHltInstruction(instr); |
1580 uword external = redirection->external_function(); | 1580 uword external = redirection->external_function(); |
1581 if (IsTracingExecution()) { | 1581 if (IsTracingExecution()) { |
1582 OS::Print("Call to host function at 0x%" Pd "\n", external); | 1582 OS::Print("Call to host function at 0x%" Pd "\n", external); |
1583 } | 1583 } |
1584 | 1584 |
1585 if ((redirection->call_kind() == kRuntimeCall) || | 1585 if ((redirection->call_kind() == kRuntimeCall) || |
1586 (redirection->call_kind() == kBootstrapNativeCall) || | 1586 (redirection->call_kind() == kBootstrapNativeCall) || |
1587 (redirection->call_kind() == kNativeCall)) { | 1587 (redirection->call_kind() == kNativeCall)) { |
1588 // Set the top_exit_frame_info of this simulator to the native stack. | 1588 // Set the top_exit_frame_info of this simulator to the native stack. |
1589 set_top_exit_frame_info(reinterpret_cast<uword>(&buffer)); | 1589 set_top_exit_frame_info(Isolate::GetCurrentStackPointer()); |
1590 } | 1590 } |
1591 if (redirection->call_kind() == kRuntimeCall) { | 1591 if (redirection->call_kind() == kRuntimeCall) { |
1592 NativeArguments* arguments = | 1592 NativeArguments* arguments = |
1593 reinterpret_cast<NativeArguments*>(get_register(R0)); | 1593 reinterpret_cast<NativeArguments*>(get_register(R0)); |
1594 SimulatorRuntimeCall target = | 1594 SimulatorRuntimeCall target = |
1595 reinterpret_cast<SimulatorRuntimeCall>(external); | 1595 reinterpret_cast<SimulatorRuntimeCall>(external); |
1596 target(*arguments); | 1596 target(*arguments); |
1597 // Zap result register from void function. | 1597 // Zap result register from void function. |
1598 set_register(instr, R0, icount_); | 1598 set_register(instr, R0, icount_); |
1599 set_register(instr, R1, icount_); | 1599 set_register(instr, R1, icount_); |
(...skipping 1898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3498 set_register(NULL, kExceptionObjectReg, bit_cast<int64_t>(raw_exception)); | 3498 set_register(NULL, kExceptionObjectReg, bit_cast<int64_t>(raw_exception)); |
3499 set_register(NULL, kStackTraceObjectReg, bit_cast<int64_t>(raw_stacktrace)); | 3499 set_register(NULL, kStackTraceObjectReg, bit_cast<int64_t>(raw_stacktrace)); |
3500 buf->Longjmp(); | 3500 buf->Longjmp(); |
3501 } | 3501 } |
3502 | 3502 |
3503 } // namespace dart | 3503 } // namespace dart |
3504 | 3504 |
3505 #endif // !defined(HOST_ARCH_ARM64) | 3505 #endif // !defined(HOST_ARCH_ARM64) |
3506 | 3506 |
3507 #endif // defined TARGET_ARCH_ARM64 | 3507 #endif // defined TARGET_ARCH_ARM64 |
OLD | NEW |