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

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

Issue 2506503002: Revert "Revert "JumpToFrame refactor"" + Fix (Closed)
Patch Set: new client 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_dbc.h ('k') | runtime/vm/simulator_mips.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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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_DBC) 9 #if defined(TARGET_ARCH_DBC)
10 10
(...skipping 3673 matching lines...) Expand 10 before | Expand all | Expand 10 after
3684 { 3684 {
3685 DispatchAfterException: 3685 DispatchAfterException:
3686 DISPATCH(); 3686 DISPATCH();
3687 } 3687 }
3688 3688
3689 UNREACHABLE(); 3689 UNREACHABLE();
3690 return 0; 3690 return 0;
3691 } 3691 }
3692 3692
3693 3693
3694 void Simulator::Longjmp(uword pc, 3694 void Simulator::JumpToFrame(uword pc, uword sp, uword fp, Thread* thread) {
3695 uword sp,
3696 uword fp,
3697 RawObject* raw_exception,
3698 RawObject* raw_stacktrace,
3699 Thread* thread) {
3700 // Walk over all setjmp buffers (simulated --> C++ transitions) 3695 // Walk over all setjmp buffers (simulated --> C++ transitions)
3701 // and try to find the setjmp associated with the simulated stack pointer. 3696 // and try to find the setjmp associated with the simulated stack pointer.
3702 SimulatorSetjmpBuffer* buf = last_setjmp_buffer(); 3697 SimulatorSetjmpBuffer* buf = last_setjmp_buffer();
3703 while ((buf->link() != NULL) && (buf->link()->fp() > fp)) { 3698 while ((buf->link() != NULL) && (buf->link()->fp() > fp)) {
3704 buf = buf->link(); 3699 buf = buf->link();
3705 } 3700 }
3706 ASSERT(buf != NULL); 3701 ASSERT(buf != NULL);
3707 ASSERT(last_setjmp_buffer() == buf); 3702 ASSERT(last_setjmp_buffer() == buf);
3708 3703
3709 // The C++ caller has not cleaned up the stack memory of C++ frames. 3704 // The C++ caller has not cleaned up the stack memory of C++ frames.
3710 // Prepare for unwinding frames by destroying all the stack resources 3705 // Prepare for unwinding frames by destroying all the stack resources
3711 // in the previous C++ frames. 3706 // in the previous C++ frames.
3712 StackResource::Unwind(thread); 3707 StackResource::Unwind(thread);
3713 3708
3714 // Set the tag. 3709 // Set the tag.
3715 thread->set_vm_tag(VMTag::kDartTagId); 3710 thread->set_vm_tag(VMTag::kDartTagId);
3716 // Clear top exit frame. 3711 // Clear top exit frame.
3717 thread->set_top_exit_frame_info(0); 3712 thread->set_top_exit_frame_info(0);
3718 3713
3719 ASSERT(raw_exception != Object::null());
3720 sp_ = reinterpret_cast<RawObject**>(sp); 3714 sp_ = reinterpret_cast<RawObject**>(sp);
3721 fp_ = reinterpret_cast<RawObject**>(fp); 3715 fp_ = reinterpret_cast<RawObject**>(fp);
3722 pc_ = pc; 3716
3723 special_[kExceptionSpecialIndex] = raw_exception; 3717 if (pc == StubCode::RunExceptionHandler_entry()->EntryPoint()) {
3724 special_[kStacktraceSpecialIndex] = raw_stacktrace; 3718 // Instead of executing the RunException stub, we implement its
3719 // behavior here.
3720 RawObject* raw_exception = thread->active_exception();
3721 RawObject* raw_stacktrace = thread->active_stacktrace();
3722 ASSERT(raw_exception != Object::null());
3723 special_[kExceptionSpecialIndex] = raw_exception;
3724 special_[kStacktraceSpecialIndex] = raw_stacktrace;
3725 pc_ = thread->resume_pc();
3726 } else {
3727 pc_ = pc;
3728 }
3729
3725 buf->Longjmp(); 3730 buf->Longjmp();
3726 UNREACHABLE(); 3731 UNREACHABLE();
3727 } 3732 }
3728 3733
3729 } // namespace dart 3734 } // namespace dart
3730 3735
3731 #endif // defined TARGET_ARCH_DBC 3736 #endif // defined TARGET_ARCH_DBC
OLDNEW
« no previous file with comments | « runtime/vm/simulator_dbc.h ('k') | runtime/vm/simulator_mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698