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 2461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2472 int64_t return_value; | 2472 int64_t return_value; |
2473 if (fp_return) { | 2473 if (fp_return) { |
2474 return_value = Utils::LowHighTo64Bits(get_fregister(F0), get_fregister(F1)); | 2474 return_value = Utils::LowHighTo64Bits(get_fregister(F0), get_fregister(F1)); |
2475 } else { | 2475 } else { |
2476 return_value = Utils::LowHighTo64Bits(get_register(V0), get_register(V1)); | 2476 return_value = Utils::LowHighTo64Bits(get_register(V0), get_register(V1)); |
2477 } | 2477 } |
2478 return return_value; | 2478 return return_value; |
2479 } | 2479 } |
2480 | 2480 |
2481 | 2481 |
2482 void Simulator::JumpToFrame(uword pc, uword sp, uword fp, Thread* thread) { | 2482 void Simulator::Longjmp(uword pc, |
| 2483 uword sp, |
| 2484 uword fp, |
| 2485 RawObject* raw_exception, |
| 2486 RawObject* raw_stacktrace, |
| 2487 Thread* thread) { |
2483 // Walk over all setjmp buffers (simulated --> C++ transitions) | 2488 // Walk over all setjmp buffers (simulated --> C++ transitions) |
2484 // and try to find the setjmp associated with the simulated stack pointer. | 2489 // and try to find the setjmp associated with the simulated stack pointer. |
2485 SimulatorSetjmpBuffer* buf = last_setjmp_buffer(); | 2490 SimulatorSetjmpBuffer* buf = last_setjmp_buffer(); |
2486 while (buf->link() != NULL && buf->link()->sp() <= sp) { | 2491 while (buf->link() != NULL && buf->link()->sp() <= sp) { |
2487 buf = buf->link(); | 2492 buf = buf->link(); |
2488 } | 2493 } |
2489 ASSERT(buf != NULL); | 2494 ASSERT(buf != NULL); |
2490 | 2495 |
2491 // The C++ caller has not cleaned up the stack memory of C++ frames. | 2496 // The C++ caller has not cleaned up the stack memory of C++ frames. |
2492 // Prepare for unwinding frames by destroying all the stack resources | 2497 // Prepare for unwinding frames by destroying all the stack resources |
2493 // in the previous C++ frames. | 2498 // in the previous C++ frames. |
2494 StackResource::Unwind(thread); | 2499 StackResource::Unwind(thread); |
2495 | 2500 |
2496 // Unwind the C++ stack and continue simulation in the target frame. | 2501 // Unwind the C++ stack and continue simulation in the target frame. |
2497 set_pc(static_cast<int32_t>(pc)); | 2502 set_pc(static_cast<int32_t>(pc)); |
2498 set_register(SP, static_cast<int32_t>(sp)); | 2503 set_register(SP, static_cast<int32_t>(sp)); |
2499 set_register(FP, static_cast<int32_t>(fp)); | 2504 set_register(FP, static_cast<int32_t>(fp)); |
2500 set_register(THR, reinterpret_cast<int32_t>(thread)); | 2505 set_register(THR, reinterpret_cast<int32_t>(thread)); |
2501 // Set the tag. | 2506 // Set the tag. |
2502 thread->set_vm_tag(VMTag::kDartTagId); | 2507 thread->set_vm_tag(VMTag::kDartTagId); |
2503 // Clear top exit frame. | 2508 // Clear top exit frame. |
2504 thread->set_top_exit_frame_info(0); | 2509 thread->set_top_exit_frame_info(0); |
| 2510 |
| 2511 ASSERT(raw_exception != Object::null()); |
| 2512 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception)); |
| 2513 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace)); |
2505 // Restore pool pointer. | 2514 // Restore pool pointer. |
2506 int32_t code = | 2515 int32_t code = |
2507 *reinterpret_cast<int32_t*>(fp + kPcMarkerSlotFromFp * kWordSize); | 2516 *reinterpret_cast<int32_t*>(fp + kPcMarkerSlotFromFp * kWordSize); |
2508 int32_t pp = *reinterpret_cast<int32_t*>(code + Code::object_pool_offset() - | 2517 int32_t pp = *reinterpret_cast<int32_t*>(code + Code::object_pool_offset() - |
2509 kHeapObjectTag); | 2518 kHeapObjectTag); |
2510 set_register(CODE_REG, code); | 2519 set_register(CODE_REG, code); |
2511 set_register(PP, pp); | 2520 set_register(PP, pp); |
2512 buf->Longjmp(); | 2521 buf->Longjmp(); |
2513 } | 2522 } |
2514 | 2523 |
2515 } // namespace dart | 2524 } // namespace dart |
2516 | 2525 |
2517 #endif // defined(USING_SIMULATOR) | 2526 #endif // defined(USING_SIMULATOR) |
2518 | 2527 |
2519 #endif // defined TARGET_ARCH_MIPS | 2528 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |