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

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

Issue 1156143003: Refactor Isolate -> Thread in NativeArguments and exception handler jump. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Fix comment; remove unused accessor. Created 5 years, 7 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
« 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 1508 matching lines...) Expand 10 before | Expand all | Expand 10 after
1519 1519
1520 if ((redirection->call_kind() == kRuntimeCall) || 1520 if ((redirection->call_kind() == kRuntimeCall) ||
1521 (redirection->call_kind() == kBootstrapNativeCall) || 1521 (redirection->call_kind() == kBootstrapNativeCall) ||
1522 (redirection->call_kind() == kNativeCall)) { 1522 (redirection->call_kind() == kNativeCall)) {
1523 // Set the top_exit_frame_info of this simulator to the native stack. 1523 // Set the top_exit_frame_info of this simulator to the native stack.
1524 set_top_exit_frame_info(Isolate::GetCurrentStackPointer()); 1524 set_top_exit_frame_info(Isolate::GetCurrentStackPointer());
1525 } 1525 }
1526 if (redirection->call_kind() == kRuntimeCall) { 1526 if (redirection->call_kind() == kRuntimeCall) {
1527 NativeArguments arguments; 1527 NativeArguments arguments;
1528 ASSERT(sizeof(NativeArguments) == 4*kWordSize); 1528 ASSERT(sizeof(NativeArguments) == 4*kWordSize);
1529 arguments.isolate_ = reinterpret_cast<Isolate*>(get_register(R0)); 1529 arguments.thread_ = reinterpret_cast<Thread*>(get_register(R0));
1530 arguments.argc_tag_ = get_register(R1); 1530 arguments.argc_tag_ = get_register(R1);
1531 arguments.argv_ = reinterpret_cast<RawObject*(*)[]>(get_register(R2)); 1531 arguments.argv_ = reinterpret_cast<RawObject*(*)[]>(get_register(R2));
1532 arguments.retval_ = reinterpret_cast<RawObject**>(get_register(R3)); 1532 arguments.retval_ = reinterpret_cast<RawObject**>(get_register(R3));
1533 SimulatorRuntimeCall target = 1533 SimulatorRuntimeCall target =
1534 reinterpret_cast<SimulatorRuntimeCall>(external); 1534 reinterpret_cast<SimulatorRuntimeCall>(external);
1535 target(arguments); 1535 target(arguments);
1536 set_register(R0, icount_); // Zap result register from void function. 1536 set_register(R0, icount_); // Zap result register from void function.
1537 set_register(R1, icount_); 1537 set_register(R1, icount_);
1538 } else if (redirection->call_kind() == kLeafRuntimeCall) { 1538 } else if (redirection->call_kind() == kLeafRuntimeCall) {
1539 ASSERT((0 <= redirection->argument_count()) && 1539 ASSERT((0 <= redirection->argument_count()) &&
(...skipping 2299 matching lines...) Expand 10 before | Expand all | Expand 10 after
3839 } 3839 }
3840 return return_value; 3840 return return_value;
3841 } 3841 }
3842 3842
3843 3843
3844 void Simulator::Longjmp(uword pc, 3844 void Simulator::Longjmp(uword pc,
3845 uword sp, 3845 uword sp,
3846 uword fp, 3846 uword fp,
3847 RawObject* raw_exception, 3847 RawObject* raw_exception,
3848 RawObject* raw_stacktrace, 3848 RawObject* raw_stacktrace,
3849 Isolate* isolate) { 3849 Thread* thread) {
3850 // Walk over all setjmp buffers (simulated --> C++ transitions) 3850 // Walk over all setjmp buffers (simulated --> C++ transitions)
3851 // and try to find the setjmp associated with the simulated stack pointer. 3851 // and try to find the setjmp associated with the simulated stack pointer.
3852 SimulatorSetjmpBuffer* buf = last_setjmp_buffer(); 3852 SimulatorSetjmpBuffer* buf = last_setjmp_buffer();
3853 while (buf->link() != NULL && buf->link()->sp() <= sp) { 3853 while (buf->link() != NULL && buf->link()->sp() <= sp) {
3854 buf = buf->link(); 3854 buf = buf->link();
3855 } 3855 }
3856 ASSERT(buf != NULL); 3856 ASSERT(buf != NULL);
3857 3857
3858 // The C++ caller has not cleaned up the stack memory of C++ frames. 3858 // The C++ caller has not cleaned up the stack memory of C++ frames.
3859 // Prepare for unwinding frames by destroying all the stack resources 3859 // Prepare for unwinding frames by destroying all the stack resources
3860 // in the previous C++ frames. 3860 // in the previous C++ frames.
3861 Isolate* isolate = thread->isolate();
3861 StackResource::Unwind(isolate); 3862 StackResource::Unwind(isolate);
3862 3863
3863 // Unwind the C++ stack and continue simulation in the target frame. 3864 // Unwind the C++ stack and continue simulation in the target frame.
3864 set_register(PC, static_cast<int32_t>(pc)); 3865 set_register(PC, static_cast<int32_t>(pc));
3865 set_register(SP, static_cast<int32_t>(sp)); 3866 set_register(SP, static_cast<int32_t>(sp));
3866 set_register(FP, static_cast<int32_t>(fp)); 3867 set_register(FP, static_cast<int32_t>(fp));
3868 set_register(THR, reinterpret_cast<uword>(thread));
3867 // Set the tag. 3869 // Set the tag.
3868 isolate->set_vm_tag(VMTag::kDartTagId); 3870 isolate->set_vm_tag(VMTag::kDartTagId);
3869 // Clear top exit frame. 3871 // Clear top exit frame.
3870 isolate->set_top_exit_frame_info(0); 3872 isolate->set_top_exit_frame_info(0);
3871 3873
3872 ASSERT(raw_exception != Object::null()); 3874 ASSERT(raw_exception != Object::null());
3873 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception)); 3875 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception));
3874 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace)); 3876 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace));
3875 buf->Longjmp(); 3877 buf->Longjmp();
3876 } 3878 }
3877 3879
3878 } // namespace dart 3880 } // namespace dart
3879 3881
3880 #endif // !defined(HOST_ARCH_ARM) 3882 #endif // !defined(HOST_ARCH_ARM)
3881 3883
3882 #endif // defined TARGET_ARCH_ARM 3884 #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