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

Side by Side Diff: runtime/vm/simulator_mips.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_mips.h ('k') | runtime/vm/stub_code.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_MIPS) 9 #if defined(TARGET_ARCH_MIPS)
10 10
(...skipping 2461 matching lines...) Expand 10 before | Expand all | Expand 10 after
2472 int64_t return_value; 2472 int64_t return_value;
2473 if (fp_return) { 2473 if (fp_return) {
2474 return_value = Utils::LowHighTo64Bits(get_fregister(F0), get_fregister(F1)); 2474 return_value = Utils::LowHighTo64Bits(get_fregister(F0), get_fregister(F1));
2475 } else { 2475 } else {
2476 return_value = Utils::LowHighTo64Bits(get_register(V0), get_register(V1)); 2476 return_value = Utils::LowHighTo64Bits(get_register(V0), get_register(V1));
2477 } 2477 }
2478 return return_value; 2478 return return_value;
2479 } 2479 }
2480 2480
2481 2481
2482 void Simulator::Longjmp(uword pc, 2482 void Simulator::JumpToFrame(uword pc, uword sp, uword fp, Thread* thread) {
2483 uword sp,
2484 uword fp,
2485 RawObject* raw_exception,
2486 RawObject* raw_stacktrace,
2487 Thread* thread) {
2488 // Walk over all setjmp buffers (simulated --> C++ transitions) 2483 // Walk over all setjmp buffers (simulated --> C++ transitions)
2489 // and try to find the setjmp associated with the simulated stack pointer. 2484 // and try to find the setjmp associated with the simulated stack pointer.
2490 SimulatorSetjmpBuffer* buf = last_setjmp_buffer(); 2485 SimulatorSetjmpBuffer* buf = last_setjmp_buffer();
2491 while (buf->link() != NULL && buf->link()->sp() <= sp) { 2486 while (buf->link() != NULL && buf->link()->sp() <= sp) {
2492 buf = buf->link(); 2487 buf = buf->link();
2493 } 2488 }
2494 ASSERT(buf != NULL); 2489 ASSERT(buf != NULL);
2495 2490
2496 // The C++ caller has not cleaned up the stack memory of C++ frames. 2491 // The C++ caller has not cleaned up the stack memory of C++ frames.
2497 // Prepare for unwinding frames by destroying all the stack resources 2492 // Prepare for unwinding frames by destroying all the stack resources
2498 // in the previous C++ frames. 2493 // in the previous C++ frames.
2499 StackResource::Unwind(thread); 2494 StackResource::Unwind(thread);
2500 2495
2501 // Unwind the C++ stack and continue simulation in the target frame. 2496 // Unwind the C++ stack and continue simulation in the target frame.
2502 set_pc(static_cast<int32_t>(pc)); 2497 set_pc(static_cast<int32_t>(pc));
2503 set_register(SP, static_cast<int32_t>(sp)); 2498 set_register(SP, static_cast<int32_t>(sp));
2504 set_register(FP, static_cast<int32_t>(fp)); 2499 set_register(FP, static_cast<int32_t>(fp));
2505 set_register(THR, reinterpret_cast<int32_t>(thread)); 2500 set_register(THR, reinterpret_cast<int32_t>(thread));
2506 // Set the tag. 2501 // Set the tag.
2507 thread->set_vm_tag(VMTag::kDartTagId); 2502 thread->set_vm_tag(VMTag::kDartTagId);
2508 // Clear top exit frame. 2503 // Clear top exit frame.
2509 thread->set_top_exit_frame_info(0); 2504 thread->set_top_exit_frame_info(0);
2510
2511 ASSERT(raw_exception != Object::null());
2512 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception));
2513 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace));
2514 // Restore pool pointer. 2505 // Restore pool pointer.
2515 int32_t code = 2506 int32_t code =
2516 *reinterpret_cast<int32_t*>(fp + kPcMarkerSlotFromFp * kWordSize); 2507 *reinterpret_cast<int32_t*>(fp + kPcMarkerSlotFromFp * kWordSize);
2517 int32_t pp = *reinterpret_cast<int32_t*>(code + Code::object_pool_offset() - 2508 int32_t pp = *reinterpret_cast<int32_t*>(code + Code::object_pool_offset() -
2518 kHeapObjectTag); 2509 kHeapObjectTag);
2519 set_register(CODE_REG, code); 2510 set_register(CODE_REG, code);
2520 set_register(PP, pp); 2511 set_register(PP, pp);
2521 buf->Longjmp(); 2512 buf->Longjmp();
2522 } 2513 }
2523 2514
2524 } // namespace dart 2515 } // namespace dart
2525 2516
2526 #endif // defined(USING_SIMULATOR) 2517 #endif // defined(USING_SIMULATOR)
2527 2518
2528 #endif // defined TARGET_ARCH_MIPS 2519 #endif // defined TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « runtime/vm/simulator_mips.h ('k') | runtime/vm/stub_code.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698