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> | 5 #include <setjmp.h> |
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 2198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2209 return_value = Utils::LowHighTo64Bits(get_register(V0), get_register(V1)); | 2209 return_value = Utils::LowHighTo64Bits(get_register(V0), get_register(V1)); |
2210 } | 2210 } |
2211 return return_value; | 2211 return return_value; |
2212 } | 2212 } |
2213 | 2213 |
2214 | 2214 |
2215 void Simulator::Longjmp(uword pc, | 2215 void Simulator::Longjmp(uword pc, |
2216 uword sp, | 2216 uword sp, |
2217 uword fp, | 2217 uword fp, |
2218 RawObject* raw_exception, | 2218 RawObject* raw_exception, |
2219 RawObject* raw_stacktrace) { | 2219 RawObject* raw_stacktrace, |
| 2220 Isolate* isolate) { |
2220 // Walk over all setjmp buffers (simulated --> C++ transitions) | 2221 // Walk over all setjmp buffers (simulated --> C++ transitions) |
2221 // and try to find the setjmp associated with the simulated stack pointer. | 2222 // and try to find the setjmp associated with the simulated stack pointer. |
2222 SimulatorSetjmpBuffer* buf = last_setjmp_buffer(); | 2223 SimulatorSetjmpBuffer* buf = last_setjmp_buffer(); |
2223 while (buf->link() != NULL && buf->link()->sp() <= sp) { | 2224 while (buf->link() != NULL && buf->link()->sp() <= sp) { |
2224 buf = buf->link(); | 2225 buf = buf->link(); |
2225 } | 2226 } |
2226 ASSERT(buf != NULL); | 2227 ASSERT(buf != NULL); |
2227 | 2228 |
2228 // The C++ caller has not cleaned up the stack memory of C++ frames. | 2229 // The C++ caller has not cleaned up the stack memory of C++ frames. |
2229 // Prepare for unwinding frames by destroying all the stack resources | 2230 // Prepare for unwinding frames by destroying all the stack resources |
2230 // in the previous C++ frames. | 2231 // in the previous C++ frames. |
2231 uword native_sp = buf->native_sp(); | 2232 uword native_sp = buf->native_sp(); |
2232 Isolate* isolate = Isolate::Current(); | |
2233 while (isolate->top_resource() != NULL && | 2233 while (isolate->top_resource() != NULL && |
2234 (reinterpret_cast<uword>(isolate->top_resource()) < native_sp)) { | 2234 (reinterpret_cast<uword>(isolate->top_resource()) < native_sp)) { |
2235 isolate->top_resource()->~StackResource(); | 2235 isolate->top_resource()->~StackResource(); |
2236 } | 2236 } |
2237 | 2237 |
2238 // Unwind the C++ stack and continue simulation in the target frame. | 2238 // Unwind the C++ stack and continue simulation in the target frame. |
2239 set_pc(static_cast<int32_t>(pc)); | 2239 set_pc(static_cast<int32_t>(pc)); |
2240 set_register(SP, static_cast<int32_t>(sp)); | 2240 set_register(SP, static_cast<int32_t>(sp)); |
2241 set_register(FP, static_cast<int32_t>(fp)); | 2241 set_register(FP, static_cast<int32_t>(fp)); |
| 2242 // Set the tag. |
| 2243 isolate->set_vm_tag(VMTag::kScriptTagId); |
| 2244 // Clear top exit frame. |
| 2245 isolate->set_top_exit_frame_info(0); |
2242 | 2246 |
2243 ASSERT(raw_exception != Object::null()); | 2247 ASSERT(raw_exception != Object::null()); |
2244 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception)); | 2248 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception)); |
2245 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace)); | 2249 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace)); |
2246 buf->Longjmp(); | 2250 buf->Longjmp(); |
2247 } | 2251 } |
2248 | 2252 |
2249 } // namespace dart | 2253 } // namespace dart |
2250 | 2254 |
2251 #endif // !defined(HOST_ARCH_MIPS) | 2255 #endif // !defined(HOST_ARCH_MIPS) |
2252 | 2256 |
2253 #endif // defined TARGET_ARCH_MIPS | 2257 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |