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

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

Issue 396463003: 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_arm64.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) 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> 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_ARM64) 9 #if defined(TARGET_ARCH_ARM64)
10 10
(...skipping 3007 matching lines...) Expand 10 before | Expand all | Expand 10 after
3018 return_value = get_register(R0); 3018 return_value = get_register(R0);
3019 } 3019 }
3020 return return_value; 3020 return return_value;
3021 } 3021 }
3022 3022
3023 3023
3024 void Simulator::Longjmp(uword pc, 3024 void Simulator::Longjmp(uword pc,
3025 uword sp, 3025 uword sp,
3026 uword fp, 3026 uword fp,
3027 RawObject* raw_exception, 3027 RawObject* raw_exception,
3028 RawObject* raw_stacktrace) { 3028 RawObject* raw_stacktrace,
3029 Isolate* isolate) {
3029 // Walk over all setjmp buffers (simulated --> C++ transitions) 3030 // Walk over all setjmp buffers (simulated --> C++ transitions)
3030 // and try to find the setjmp associated with the simulated stack pointer. 3031 // and try to find the setjmp associated with the simulated stack pointer.
3031 SimulatorSetjmpBuffer* buf = last_setjmp_buffer(); 3032 SimulatorSetjmpBuffer* buf = last_setjmp_buffer();
3032 while (buf->link() != NULL && buf->link()->sp() <= sp) { 3033 while (buf->link() != NULL && buf->link()->sp() <= sp) {
3033 buf = buf->link(); 3034 buf = buf->link();
3034 } 3035 }
3035 ASSERT(buf != NULL); 3036 ASSERT(buf != NULL);
3036 3037
3037 // The C++ caller has not cleaned up the stack memory of C++ frames. 3038 // The C++ caller has not cleaned up the stack memory of C++ frames.
3038 // Prepare for unwinding frames by destroying all the stack resources 3039 // Prepare for unwinding frames by destroying all the stack resources
3039 // in the previous C++ frames. 3040 // in the previous C++ frames.
3040 uword native_sp = buf->native_sp(); 3041 uword native_sp = buf->native_sp();
3041 Isolate* isolate = Isolate::Current();
3042 while (isolate->top_resource() != NULL && 3042 while (isolate->top_resource() != NULL &&
3043 (reinterpret_cast<uword>(isolate->top_resource()) < native_sp)) { 3043 (reinterpret_cast<uword>(isolate->top_resource()) < native_sp)) {
3044 isolate->top_resource()->~StackResource(); 3044 isolate->top_resource()->~StackResource();
3045 } 3045 }
3046 3046
3047 // Unwind the C++ stack and continue simulation in the target frame. 3047 // Unwind the C++ stack and continue simulation in the target frame.
3048 set_pc(static_cast<int64_t>(pc)); 3048 set_pc(static_cast<int64_t>(pc));
3049 set_register(NULL, SP, static_cast<int64_t>(sp)); 3049 set_register(NULL, SP, static_cast<int64_t>(sp));
3050 set_register(NULL, FP, static_cast<int64_t>(fp)); 3050 set_register(NULL, FP, static_cast<int64_t>(fp));
3051 // Set the tag.
3052 isolate->set_vm_tag(VMTag::kScriptTagId);
3053 // Clear top exit frame.
3054 isolate->set_top_exit_frame_info(0);
3051 3055
3052 ASSERT(raw_exception != Object::null()); 3056 ASSERT(raw_exception != Object::null());
3053 set_register(NULL, kExceptionObjectReg, bit_cast<int64_t>(raw_exception)); 3057 set_register(NULL, kExceptionObjectReg, bit_cast<int64_t>(raw_exception));
3054 set_register(NULL, kStackTraceObjectReg, bit_cast<int64_t>(raw_stacktrace)); 3058 set_register(NULL, kStackTraceObjectReg, bit_cast<int64_t>(raw_stacktrace));
3055 buf->Longjmp(); 3059 buf->Longjmp();
3056 } 3060 }
3057 3061
3058 } // namespace dart 3062 } // namespace dart
3059 3063
3060 #endif // !defined(HOST_ARCH_ARM64) 3064 #endif // !defined(HOST_ARCH_ARM64)
3061 3065
3062 #endif // defined TARGET_ARCH_ARM64 3066 #endif // defined TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « runtime/vm/simulator_arm64.h ('k') | runtime/vm/simulator_mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698