Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: runtime/vm/simulator_arm64.cc

Issue 2503653002: JumpToFrame refactor (Closed)
Patch Set: code review Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/simulator_arm64.h ('k') | runtime/vm/simulator_dbc.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 3584 matching lines...) Expand 10 before | Expand all | Expand 10 after
3595 int64_t return_value; 3595 int64_t return_value;
3596 if (fp_return) { 3596 if (fp_return) {
3597 return_value = get_vregisterd(V0, 0); 3597 return_value = get_vregisterd(V0, 0);
3598 } else { 3598 } else {
3599 return_value = get_register(R0); 3599 return_value = get_register(R0);
3600 } 3600 }
3601 return return_value; 3601 return return_value;
3602 } 3602 }
3603 3603
3604 3604
3605 void Simulator::Longjmp(uword pc, 3605 void Simulator::JumpToFrame(uword pc, uword sp, uword fp, Thread* thread) {
3606 uword sp,
3607 uword fp,
3608 RawObject* raw_exception,
3609 RawObject* raw_stacktrace,
3610 Thread* thread) {
3611 // Walk over all setjmp buffers (simulated --> C++ transitions) 3606 // Walk over all setjmp buffers (simulated --> C++ transitions)
3612 // and try to find the setjmp associated with the simulated stack pointer. 3607 // and try to find the setjmp associated with the simulated stack pointer.
3613 SimulatorSetjmpBuffer* buf = last_setjmp_buffer(); 3608 SimulatorSetjmpBuffer* buf = last_setjmp_buffer();
3614 while (buf->link() != NULL && buf->link()->sp() <= sp) { 3609 while (buf->link() != NULL && buf->link()->sp() <= sp) {
3615 buf = buf->link(); 3610 buf = buf->link();
3616 } 3611 }
3617 ASSERT(buf != NULL); 3612 ASSERT(buf != NULL);
3618 3613
3619 // The C++ caller has not cleaned up the stack memory of C++ frames. 3614 // The C++ caller has not cleaned up the stack memory of C++ frames.
3620 // Prepare for unwinding frames by destroying all the stack resources 3615 // Prepare for unwinding frames by destroying all the stack resources
3621 // in the previous C++ frames. 3616 // in the previous C++ frames.
3622 StackResource::Unwind(thread); 3617 StackResource::Unwind(thread);
3623 3618
3624 // Unwind the C++ stack and continue simulation in the target frame. 3619 // Unwind the C++ stack and continue simulation in the target frame.
3625 set_pc(static_cast<int64_t>(pc)); 3620 set_pc(static_cast<int64_t>(pc));
3626 set_register(NULL, SP, static_cast<int64_t>(sp)); 3621 set_register(NULL, SP, static_cast<int64_t>(sp));
3627 set_register(NULL, FP, static_cast<int64_t>(fp)); 3622 set_register(NULL, FP, static_cast<int64_t>(fp));
3628 set_register(NULL, THR, reinterpret_cast<int64_t>(thread)); 3623 set_register(NULL, THR, reinterpret_cast<int64_t>(thread));
3629 // Set the tag. 3624 // Set the tag.
3630 thread->set_vm_tag(VMTag::kDartTagId); 3625 thread->set_vm_tag(VMTag::kDartTagId);
3631 // Clear top exit frame. 3626 // Clear top exit frame.
3632 thread->set_top_exit_frame_info(0); 3627 thread->set_top_exit_frame_info(0);
3633
3634 ASSERT(raw_exception != Object::null());
3635 set_register(NULL, kExceptionObjectReg, bit_cast<int64_t>(raw_exception));
3636 set_register(NULL, kStackTraceObjectReg, bit_cast<int64_t>(raw_stacktrace));
3637 // Restore pool pointer. 3628 // Restore pool pointer.
3638 int64_t code = 3629 int64_t code =
3639 *reinterpret_cast<int64_t*>(fp + kPcMarkerSlotFromFp * kWordSize); 3630 *reinterpret_cast<int64_t*>(fp + kPcMarkerSlotFromFp * kWordSize);
3640 int64_t pp = *reinterpret_cast<int64_t*>(code + Code::object_pool_offset() - 3631 int64_t pp = *reinterpret_cast<int64_t*>(code + Code::object_pool_offset() -
3641 kHeapObjectTag); 3632 kHeapObjectTag);
3642 pp -= kHeapObjectTag; // In the PP register, the pool pointer is untagged. 3633 pp -= kHeapObjectTag; // In the PP register, the pool pointer is untagged.
3643 set_register(NULL, CODE_REG, code); 3634 set_register(NULL, CODE_REG, code);
3644 set_register(NULL, PP, pp); 3635 set_register(NULL, PP, pp);
3645 buf->Longjmp(); 3636 buf->Longjmp();
3646 } 3637 }
3647 3638
3648 } // namespace dart 3639 } // namespace dart
3649 3640
3650 #endif // !defined(USING_SIMULATOR) 3641 #endif // !defined(USING_SIMULATOR)
3651 3642
3652 #endif // defined TARGET_ARCH_ARM64 3643 #endif // defined TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « runtime/vm/simulator_arm64.h ('k') | runtime/vm/simulator_dbc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698