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

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

Issue 718393005: Enable the profiler on the simulator (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 | 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 768 matching lines...) Expand 10 before | Expand all | Expand 10 after
779 return new Redirection(external_function, call_kind, argument_count); 779 return new Redirection(external_function, call_kind, argument_count);
780 } 780 }
781 781
782 static Redirection* FromSvcInstruction(Instr* svc_instruction) { 782 static Redirection* FromSvcInstruction(Instr* svc_instruction) {
783 char* addr_of_svc = reinterpret_cast<char*>(svc_instruction); 783 char* addr_of_svc = reinterpret_cast<char*>(svc_instruction);
784 char* addr_of_redirection = 784 char* addr_of_redirection =
785 addr_of_svc - OFFSET_OF(Redirection, svc_instruction_); 785 addr_of_svc - OFFSET_OF(Redirection, svc_instruction_);
786 return reinterpret_cast<Redirection*>(addr_of_redirection); 786 return reinterpret_cast<Redirection*>(addr_of_redirection);
787 } 787 }
788 788
789 static uword FunctionForRedirect(uword address_of_svc) {
790 Redirection* current;
791 for (current = list_; current != NULL; current = current->next_) {
792 if (current->address_of_svc_instruction() == address_of_svc) {
793 return current->external_function_;
794 }
795 }
796 return 0;
797 }
798
789 private: 799 private:
790 static const int32_t kRedirectSvcInstruction = 800 static const int32_t kRedirectSvcInstruction =
791 ((AL << kConditionShift) | (0xf << 24) | kRedirectionSvcCode); 801 ((AL << kConditionShift) | (0xf << 24) | kRedirectionSvcCode);
792 Redirection(uword external_function, 802 Redirection(uword external_function,
793 Simulator::CallKind call_kind, 803 Simulator::CallKind call_kind,
794 int argument_count) 804 int argument_count)
795 : external_function_(external_function), 805 : external_function_(external_function),
796 call_kind_(call_kind), 806 call_kind_(call_kind),
797 argument_count_(argument_count), 807 argument_count_(argument_count),
798 svc_instruction_(kRedirectSvcInstruction), 808 svc_instruction_(kRedirectSvcInstruction),
(...skipping 15 matching lines...) Expand all
814 824
815 uword Simulator::RedirectExternalReference(uword function, 825 uword Simulator::RedirectExternalReference(uword function,
816 CallKind call_kind, 826 CallKind call_kind,
817 int argument_count) { 827 int argument_count) {
818 Redirection* redirection = 828 Redirection* redirection =
819 Redirection::Get(function, call_kind, argument_count); 829 Redirection::Get(function, call_kind, argument_count);
820 return redirection->address_of_svc_instruction(); 830 return redirection->address_of_svc_instruction();
821 } 831 }
822 832
823 833
834 uword Simulator::FunctionForRedirect(uword redirect) {
835 return Redirection::FunctionForRedirect(redirect);
836 }
837
838
824 // Get the active Simulator for the current isolate. 839 // Get the active Simulator for the current isolate.
825 Simulator* Simulator::Current() { 840 Simulator* Simulator::Current() {
826 Simulator* simulator = Isolate::Current()->simulator(); 841 Simulator* simulator = Isolate::Current()->simulator();
827 if (simulator == NULL) { 842 if (simulator == NULL) {
828 simulator = new Simulator(); 843 simulator = new Simulator();
829 Isolate::Current()->set_simulator(simulator); 844 Isolate::Current()->set_simulator(simulator);
830 } 845 }
831 return simulator; 846 return simulator;
832 } 847 }
833 848
(...skipping 3036 matching lines...) Expand 10 before | Expand all | Expand 10 after
3870 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception)); 3885 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception));
3871 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace)); 3886 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace));
3872 buf->Longjmp(); 3887 buf->Longjmp();
3873 } 3888 }
3874 3889
3875 } // namespace dart 3890 } // namespace dart
3876 3891
3877 #endif // !defined(HOST_ARCH_ARM) 3892 #endif // !defined(HOST_ARCH_ARM)
3878 3893
3879 #endif // defined TARGET_ARCH_ARM 3894 #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