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

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

Issue 395233002: Move some isolate state setup from C++ code to JumpToExceptionHandler stub (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 5 months 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 | Annotate | Revision Log
« 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> 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_ARM) 9 #if defined(TARGET_ARCH_ARM)
10 10
(...skipping 3673 matching lines...) Expand 10 before | Expand all | Expand 10 after
3684 return_value = Utils::LowHighTo64Bits(get_register(R0), get_register(R1)); 3684 return_value = Utils::LowHighTo64Bits(get_register(R0), get_register(R1));
3685 } 3685 }
3686 return return_value; 3686 return return_value;
3687 } 3687 }
3688 3688
3689 3689
3690 void Simulator::Longjmp(uword pc, 3690 void Simulator::Longjmp(uword pc,
3691 uword sp, 3691 uword sp,
3692 uword fp, 3692 uword fp,
3693 RawObject* raw_exception, 3693 RawObject* raw_exception,
3694 RawObject* raw_stacktrace) { 3694 RawObject* raw_stacktrace,
3695 Isolate* isolate) {
3695 // Walk over all setjmp buffers (simulated --> C++ transitions) 3696 // Walk over all setjmp buffers (simulated --> C++ transitions)
3696 // and try to find the setjmp associated with the simulated stack pointer. 3697 // and try to find the setjmp associated with the simulated stack pointer.
3697 SimulatorSetjmpBuffer* buf = last_setjmp_buffer(); 3698 SimulatorSetjmpBuffer* buf = last_setjmp_buffer();
3698 while (buf->link() != NULL && buf->link()->sp() <= sp) { 3699 while (buf->link() != NULL && buf->link()->sp() <= sp) {
3699 buf = buf->link(); 3700 buf = buf->link();
3700 } 3701 }
3701 ASSERT(buf != NULL); 3702 ASSERT(buf != NULL);
3702 3703
3703 // 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.
3704 // Prepare for unwinding frames by destroying all the stack resources 3705 // Prepare for unwinding frames by destroying all the stack resources
3705 // in the previous C++ frames. 3706 // in the previous C++ frames.
3706 uword native_sp = buf->native_sp(); 3707 uword native_sp = buf->native_sp();
3707 Isolate* isolate = Isolate::Current();
3708 while (isolate->top_resource() != NULL && 3708 while (isolate->top_resource() != NULL &&
3709 (reinterpret_cast<uword>(isolate->top_resource()) < native_sp)) { 3709 (reinterpret_cast<uword>(isolate->top_resource()) < native_sp)) {
3710 isolate->top_resource()->~StackResource(); 3710 isolate->top_resource()->~StackResource();
3711 } 3711 }
3712 3712
3713 // Unwind the C++ stack and continue simulation in the target frame. 3713 // Unwind the C++ stack and continue simulation in the target frame.
3714 set_register(PC, static_cast<int32_t>(pc)); 3714 set_register(PC, static_cast<int32_t>(pc));
3715 set_register(SP, static_cast<int32_t>(sp)); 3715 set_register(SP, static_cast<int32_t>(sp));
3716 set_register(FP, static_cast<int32_t>(fp)); 3716 set_register(FP, static_cast<int32_t>(fp));
3717 // Set the tag.
3718 isolate->set_vm_tag(VMTag::kScriptTagId);
3719 // Clear top exit frame.
3720 isolate->set_top_exit_frame_info(0);
3717 3721
3718 ASSERT(raw_exception != Object::null()); 3722 ASSERT(raw_exception != Object::null());
3719 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception)); 3723 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception));
3720 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace)); 3724 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace));
3721 buf->Longjmp(); 3725 buf->Longjmp();
3722 } 3726 }
3723 3727
3724 } // namespace dart 3728 } // namespace dart
3725 3729
3726 #endif // !defined(HOST_ARCH_ARM) 3730 #endif // !defined(HOST_ARCH_ARM)
3727 3731
3728 #endif // defined TARGET_ARCH_ARM 3732 #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