| 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_MIPS) | 9 #if defined(TARGET_ARCH_MIPS) |
| 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(SP)); | 57 sp_ = static_cast<uword>(sim->get_register(SP)); |
| 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 1165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1234 Redirection* redirection = Redirection::FromBreakInstruction(instr); | 1234 Redirection* redirection = Redirection::FromBreakInstruction(instr); |
| 1235 uword external = redirection->external_function(); | 1235 uword external = redirection->external_function(); |
| 1236 if (IsTracingExecution()) { | 1236 if (IsTracingExecution()) { |
| 1237 OS::Print("Call to host function at 0x%" Pd "\n", external); | 1237 OS::Print("Call to host function at 0x%" Pd "\n", external); |
| 1238 } | 1238 } |
| 1239 | 1239 |
| 1240 if ((redirection->call_kind() == kRuntimeCall) || | 1240 if ((redirection->call_kind() == kRuntimeCall) || |
| 1241 (redirection->call_kind() == kBootstrapNativeCall) || | 1241 (redirection->call_kind() == kBootstrapNativeCall) || |
| 1242 (redirection->call_kind() == kNativeCall)) { | 1242 (redirection->call_kind() == kNativeCall)) { |
| 1243 // Set the top_exit_frame_info of this simulator to the native stack. | 1243 // Set the top_exit_frame_info of this simulator to the native stack. |
| 1244 set_top_exit_frame_info(reinterpret_cast<uword>(&buffer)); | 1244 set_top_exit_frame_info(Isolate::GetCurrentStackPointer()); |
| 1245 } | 1245 } |
| 1246 if (redirection->call_kind() == kRuntimeCall) { | 1246 if (redirection->call_kind() == kRuntimeCall) { |
| 1247 NativeArguments arguments; | 1247 NativeArguments arguments; |
| 1248 ASSERT(sizeof(NativeArguments) == 4*kWordSize); | 1248 ASSERT(sizeof(NativeArguments) == 4*kWordSize); |
| 1249 arguments.isolate_ = reinterpret_cast<Isolate*>(get_register(A0)); | 1249 arguments.isolate_ = reinterpret_cast<Isolate*>(get_register(A0)); |
| 1250 arguments.argc_tag_ = get_register(A1); | 1250 arguments.argc_tag_ = get_register(A1); |
| 1251 arguments.argv_ = reinterpret_cast<RawObject*(*)[]>(get_register(A2)); | 1251 arguments.argv_ = reinterpret_cast<RawObject*(*)[]>(get_register(A2)); |
| 1252 arguments.retval_ = reinterpret_cast<RawObject**>(get_register(A3)); | 1252 arguments.retval_ = reinterpret_cast<RawObject**>(get_register(A3)); |
| 1253 SimulatorRuntimeCall target = | 1253 SimulatorRuntimeCall target = |
| 1254 reinterpret_cast<SimulatorRuntimeCall>(external); | 1254 reinterpret_cast<SimulatorRuntimeCall>(external); |
| (...skipping 1236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2491 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception)); | 2491 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception)); |
| 2492 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace)); | 2492 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace)); |
| 2493 buf->Longjmp(); | 2493 buf->Longjmp(); |
| 2494 } | 2494 } |
| 2495 | 2495 |
| 2496 } // namespace dart | 2496 } // namespace dart |
| 2497 | 2497 |
| 2498 #endif // !defined(HOST_ARCH_MIPS) | 2498 #endif // !defined(HOST_ARCH_MIPS) |
| 2499 | 2499 |
| 2500 #endif // defined TARGET_ARCH_MIPS | 2500 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |