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

Side by Side Diff: runtime/vm/simulator_mips.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_mips.h ('k') | no next file » | 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_MIPS) 9 #if defined(TARGET_ARCH_MIPS)
10 10
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 return new Redirection(external_function, call_kind, argument_count); 649 return new Redirection(external_function, call_kind, argument_count);
650 } 650 }
651 651
652 static Redirection* FromBreakInstruction(Instr* break_instruction) { 652 static Redirection* FromBreakInstruction(Instr* break_instruction) {
653 char* addr_of_break = reinterpret_cast<char*>(break_instruction); 653 char* addr_of_break = reinterpret_cast<char*>(break_instruction);
654 char* addr_of_redirection = 654 char* addr_of_redirection =
655 addr_of_break - OFFSET_OF(Redirection, break_instruction_); 655 addr_of_break - OFFSET_OF(Redirection, break_instruction_);
656 return reinterpret_cast<Redirection*>(addr_of_redirection); 656 return reinterpret_cast<Redirection*>(addr_of_redirection);
657 } 657 }
658 658
659 static uword FunctionForRedirect(uword address_of_break) {
660 Redirection* current;
661 for (current = list_; current != NULL; current = current->next_) {
662 if (current->address_of_break_instruction() == address_of_break) {
663 return current->external_function_;
664 }
665 }
666 return 0;
667 }
668
659 private: 669 private:
660 static const int32_t kRedirectInstruction = 670 static const int32_t kRedirectInstruction =
661 Instr::kBreakPointInstruction | (Instr::kRedirectCode << kBreakCodeShift); 671 Instr::kBreakPointInstruction | (Instr::kRedirectCode << kBreakCodeShift);
662 672
663 Redirection(uword external_function, 673 Redirection(uword external_function,
664 Simulator::CallKind call_kind, 674 Simulator::CallKind call_kind,
665 int argument_count) 675 int argument_count)
666 : external_function_(external_function), 676 : external_function_(external_function),
667 call_kind_(call_kind), 677 call_kind_(call_kind),
668 argument_count_(argument_count), 678 argument_count_(argument_count),
(...skipping 16 matching lines...) Expand all
685 695
686 uword Simulator::RedirectExternalReference(uword function, 696 uword Simulator::RedirectExternalReference(uword function,
687 CallKind call_kind, 697 CallKind call_kind,
688 int argument_count) { 698 int argument_count) {
689 Redirection* redirection = 699 Redirection* redirection =
690 Redirection::Get(function, call_kind, argument_count); 700 Redirection::Get(function, call_kind, argument_count);
691 return redirection->address_of_break_instruction(); 701 return redirection->address_of_break_instruction();
692 } 702 }
693 703
694 704
705 uword Simulator::FunctionForRedirect(uword redirect) {
706 return Redirection::FunctionForRedirect(redirect);
707 }
708
709
695 // Get the active Simulator for the current isolate. 710 // Get the active Simulator for the current isolate.
696 Simulator* Simulator::Current() { 711 Simulator* Simulator::Current() {
697 Simulator* simulator = Isolate::Current()->simulator(); 712 Simulator* simulator = Isolate::Current()->simulator();
698 if (simulator == NULL) { 713 if (simulator == NULL) {
699 simulator = new Simulator(); 714 simulator = new Simulator();
700 Isolate::Current()->set_simulator(simulator); 715 Isolate::Current()->set_simulator(simulator);
701 } 716 }
702 return simulator; 717 return simulator;
703 } 718 }
704 719
(...skipping 1656 matching lines...) Expand 10 before | Expand all | Expand 10 after
2361 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception)); 2376 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception));
2362 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace)); 2377 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace));
2363 buf->Longjmp(); 2378 buf->Longjmp();
2364 } 2379 }
2365 2380
2366 } // namespace dart 2381 } // namespace dart
2367 2382
2368 #endif // !defined(HOST_ARCH_MIPS) 2383 #endif // !defined(HOST_ARCH_MIPS)
2369 2384
2370 #endif // defined TARGET_ARCH_MIPS 2385 #endif // defined TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « runtime/vm/simulator_mips.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698