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

Side by Side Diff: runtime/vm/simulator_arm.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_arm.h ('k') | runtime/vm/simulator_arm64.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) 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_ARM) 9 #if defined(TARGET_ARCH_ARM)
10 10
(...skipping 3873 matching lines...) Expand 10 before | Expand all | Expand 10 after
3884 if (fp_return) { 3884 if (fp_return) {
3885 ASSERT(TargetCPUFeatures::vfp_supported()); 3885 ASSERT(TargetCPUFeatures::vfp_supported());
3886 return_value = bit_cast<int64_t, double>(get_dregister(D0)); 3886 return_value = bit_cast<int64_t, double>(get_dregister(D0));
3887 } else { 3887 } else {
3888 return_value = Utils::LowHighTo64Bits(get_register(R0), get_register(R1)); 3888 return_value = Utils::LowHighTo64Bits(get_register(R0), get_register(R1));
3889 } 3889 }
3890 return return_value; 3890 return return_value;
3891 } 3891 }
3892 3892
3893 3893
3894 void Simulator::Longjmp(uword pc, 3894 void Simulator::JumpToFrame(uword pc, uword sp, uword fp, Thread* thread) {
3895 uword sp,
3896 uword fp,
3897 RawObject* raw_exception,
3898 RawObject* raw_stacktrace,
3899 Thread* thread) {
3900 // Walk over all setjmp buffers (simulated --> C++ transitions) 3895 // Walk over all setjmp buffers (simulated --> C++ transitions)
3901 // and try to find the setjmp associated with the simulated stack pointer. 3896 // and try to find the setjmp associated with the simulated stack pointer.
3902 SimulatorSetjmpBuffer* buf = last_setjmp_buffer(); 3897 SimulatorSetjmpBuffer* buf = last_setjmp_buffer();
3903 while (buf->link() != NULL && buf->link()->sp() <= sp) { 3898 while (buf->link() != NULL && buf->link()->sp() <= sp) {
3904 buf = buf->link(); 3899 buf = buf->link();
3905 } 3900 }
3906 ASSERT(buf != NULL); 3901 ASSERT(buf != NULL);
3907 3902
3908 // The C++ caller has not cleaned up the stack memory of C++ frames. 3903 // The C++ caller has not cleaned up the stack memory of C++ frames.
3909 // Prepare for unwinding frames by destroying all the stack resources 3904 // Prepare for unwinding frames by destroying all the stack resources
3910 // in the previous C++ frames. 3905 // in the previous C++ frames.
3911 StackResource::Unwind(thread); 3906 StackResource::Unwind(thread);
3912 3907
3913 // Unwind the C++ stack and continue simulation in the target frame. 3908 // Unwind the C++ stack and continue simulation in the target frame.
3914 set_register(PC, static_cast<int32_t>(pc)); 3909 set_register(PC, static_cast<int32_t>(pc));
3915 set_register(SP, static_cast<int32_t>(sp)); 3910 set_register(SP, static_cast<int32_t>(sp));
3916 set_register(FP, static_cast<int32_t>(fp)); 3911 set_register(FP, static_cast<int32_t>(fp));
3917 set_register(THR, reinterpret_cast<uword>(thread)); 3912 set_register(THR, reinterpret_cast<uword>(thread));
3918 // Set the tag. 3913 // Set the tag.
3919 thread->set_vm_tag(VMTag::kDartTagId); 3914 thread->set_vm_tag(VMTag::kDartTagId);
3920 // Clear top exit frame. 3915 // Clear top exit frame.
3921 thread->set_top_exit_frame_info(0); 3916 thread->set_top_exit_frame_info(0);
3922
3923 ASSERT(raw_exception != Object::null());
3924 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception));
3925 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace));
3926 // Restore pool pointer. 3917 // Restore pool pointer.
3927 int32_t code = 3918 int32_t code =
3928 *reinterpret_cast<int32_t*>(fp + kPcMarkerSlotFromFp * kWordSize); 3919 *reinterpret_cast<int32_t*>(fp + kPcMarkerSlotFromFp * kWordSize);
3929 int32_t pp = *reinterpret_cast<int32_t*>(code + Code::object_pool_offset() - 3920 int32_t pp = *reinterpret_cast<int32_t*>(code + Code::object_pool_offset() -
3930 kHeapObjectTag); 3921 kHeapObjectTag);
3931 set_register(CODE_REG, code); 3922 set_register(CODE_REG, code);
3932 set_register(PP, pp); 3923 set_register(PP, pp);
3933 buf->Longjmp(); 3924 buf->Longjmp();
3934 } 3925 }
3935 3926
3936 } // namespace dart 3927 } // namespace dart
3937 3928
3938 #endif // defined(USING_SIMULATOR) 3929 #endif // defined(USING_SIMULATOR)
3939 3930
3940 #endif // defined TARGET_ARCH_ARM 3931 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/vm/simulator_arm.h ('k') | runtime/vm/simulator_arm64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698