OLD | NEW |
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_MIPS) | 9 #if defined(TARGET_ARCH_MIPS) |
10 | 10 |
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 return new Redirection(external_function, call_kind, argument_count); | 635 return new Redirection(external_function, call_kind, argument_count); |
636 } | 636 } |
637 | 637 |
638 static Redirection* FromBreakInstruction(Instr* break_instruction) { | 638 static Redirection* FromBreakInstruction(Instr* break_instruction) { |
639 char* addr_of_break = reinterpret_cast<char*>(break_instruction); | 639 char* addr_of_break = reinterpret_cast<char*>(break_instruction); |
640 char* addr_of_redirection = | 640 char* addr_of_redirection = |
641 addr_of_break - OFFSET_OF(Redirection, break_instruction_); | 641 addr_of_break - OFFSET_OF(Redirection, break_instruction_); |
642 return reinterpret_cast<Redirection*>(addr_of_redirection); | 642 return reinterpret_cast<Redirection*>(addr_of_redirection); |
643 } | 643 } |
644 | 644 |
| 645 static uword FunctionForRedirect(uword address_of_break) { |
| 646 Redirection* current; |
| 647 for (current = list_; current != NULL; current = current->next_) { |
| 648 if (current->address_of_break_instruction() == address_of_break) { |
| 649 return current->external_function_; |
| 650 } |
| 651 } |
| 652 return 0; |
| 653 } |
| 654 |
645 private: | 655 private: |
646 static const int32_t kRedirectInstruction = | 656 static const int32_t kRedirectInstruction = |
647 Instr::kBreakPointInstruction | (Instr::kRedirectCode << kBreakCodeShift); | 657 Instr::kBreakPointInstruction | (Instr::kRedirectCode << kBreakCodeShift); |
648 | 658 |
649 Redirection(uword external_function, | 659 Redirection(uword external_function, |
650 Simulator::CallKind call_kind, | 660 Simulator::CallKind call_kind, |
651 int argument_count) | 661 int argument_count) |
652 : external_function_(external_function), | 662 : external_function_(external_function), |
653 call_kind_(call_kind), | 663 call_kind_(call_kind), |
654 argument_count_(argument_count), | 664 argument_count_(argument_count), |
(...skipping 16 matching lines...) Expand all Loading... |
671 | 681 |
672 uword Simulator::RedirectExternalReference(uword function, | 682 uword Simulator::RedirectExternalReference(uword function, |
673 CallKind call_kind, | 683 CallKind call_kind, |
674 int argument_count) { | 684 int argument_count) { |
675 Redirection* redirection = | 685 Redirection* redirection = |
676 Redirection::Get(function, call_kind, argument_count); | 686 Redirection::Get(function, call_kind, argument_count); |
677 return redirection->address_of_break_instruction(); | 687 return redirection->address_of_break_instruction(); |
678 } | 688 } |
679 | 689 |
680 | 690 |
| 691 uword Simulator::FunctionForRedirect(uword redirect) { |
| 692 return Redirection::FunctionForRedirect(redirect); |
| 693 } |
| 694 |
| 695 |
681 // Get the active Simulator for the current isolate. | 696 // Get the active Simulator for the current isolate. |
682 Simulator* Simulator::Current() { | 697 Simulator* Simulator::Current() { |
683 Simulator* simulator = Isolate::Current()->simulator(); | 698 Simulator* simulator = Isolate::Current()->simulator(); |
684 if (simulator == NULL) { | 699 if (simulator == NULL) { |
685 simulator = new Simulator(); | 700 simulator = new Simulator(); |
686 Isolate::Current()->set_simulator(simulator); | 701 Isolate::Current()->set_simulator(simulator); |
687 } | 702 } |
688 return simulator; | 703 return simulator; |
689 } | 704 } |
690 | 705 |
(...skipping 1557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2248 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception)); | 2263 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception)); |
2249 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace)); | 2264 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace)); |
2250 buf->Longjmp(); | 2265 buf->Longjmp(); |
2251 } | 2266 } |
2252 | 2267 |
2253 } // namespace dart | 2268 } // namespace dart |
2254 | 2269 |
2255 #endif // !defined(HOST_ARCH_MIPS) | 2270 #endif // !defined(HOST_ARCH_MIPS) |
2256 | 2271 |
2257 #endif // defined TARGET_ARCH_MIPS | 2272 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |