OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 63 |
64 #include "v8.h" | 64 #include "v8.h" |
65 | 65 |
66 #include "cpu-profiler.h" | 66 #include "cpu-profiler.h" |
67 #include "flags.h" | 67 #include "flags.h" |
68 #include "frames-inl.h" | 68 #include "frames-inl.h" |
69 #include "log.h" | 69 #include "log.h" |
70 #include "platform.h" | 70 #include "platform.h" |
71 #include "simulator.h" | 71 #include "simulator.h" |
72 #include "v8threads.h" | 72 #include "v8threads.h" |
| 73 #include "vm-state-inl.h" |
73 | 74 |
74 | 75 |
75 #if defined(__ANDROID__) && !defined(__BIONIC_HAVE_UCONTEXT_T) | 76 #if defined(__ANDROID__) && !defined(__BIONIC_HAVE_UCONTEXT_T) |
76 | 77 |
77 // Not all versions of Android's C library provide ucontext_t. | 78 // Not all versions of Android's C library provide ucontext_t. |
78 // Detect this and provide custom but compatible definitions. Note that these | 79 // Detect this and provide custom but compatible definitions. Note that these |
79 // follow the GLibc naming convention to access register values from | 80 // follow the GLibc naming convention to access register values from |
80 // mcontext_t. | 81 // mcontext_t. |
81 // | 82 // |
82 // See http://code.google.com/p/android/issues/detail?id=34784 | 83 // See http://code.google.com/p/android/issues/detail?id=34784 |
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 // Avoid collecting traces while doing GC. | 652 // Avoid collecting traces while doing GC. |
652 if (state == GC) return; | 653 if (state == GC) return; |
653 | 654 |
654 const Address js_entry_sp = | 655 const Address js_entry_sp = |
655 Isolate::js_entry_sp(isolate->thread_local_top()); | 656 Isolate::js_entry_sp(isolate->thread_local_top()); |
656 if (js_entry_sp == 0) { | 657 if (js_entry_sp == 0) { |
657 // Not executing JS now. | 658 // Not executing JS now. |
658 return; | 659 return; |
659 } | 660 } |
660 | 661 |
661 const Address callback = isolate->external_callback(); | 662 ExternalCallbackScope* scope = isolate->external_callback_scope(); |
662 if (callback != NULL) { | 663 Address handler = Isolate::handler(isolate->thread_local_top()); |
663 external_callback = callback; | 664 // If there is a handler on top of the external callback scope then |
| 665 // we have already entrered JavaScript again and the external callback |
| 666 // is not the top function. |
| 667 if (scope && scope->scope_address() < handler) { |
| 668 external_callback = scope->callback(); |
664 has_external_callback = true; | 669 has_external_callback = true; |
665 } else { | 670 } else { |
666 // Sample potential return address value for frameless invocation of | 671 // Sample potential return address value for frameless invocation of |
667 // stubs (we'll figure out later, if this value makes sense). | 672 // stubs (we'll figure out later, if this value makes sense). |
668 tos = Memory::Address_at(regs.sp); | 673 tos = Memory::Address_at(regs.sp); |
669 has_external_callback = false; | 674 has_external_callback = false; |
670 } | 675 } |
671 | 676 |
672 SafeStackFrameIterator it(isolate, regs.fp, regs.sp, js_entry_sp); | 677 SafeStackFrameIterator it(isolate, regs.fp, regs.sp, js_entry_sp); |
673 top_frame_type = it.top_frame_type(); | 678 top_frame_type = it.top_frame_type(); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 sample->Init(isolate_, state); | 733 sample->Init(isolate_, state); |
729 if (is_counting_samples_) { | 734 if (is_counting_samples_) { |
730 if (sample->state == JS || sample->state == EXTERNAL) { | 735 if (sample->state == JS || sample->state == EXTERNAL) { |
731 ++js_and_external_sample_count_; | 736 ++js_and_external_sample_count_; |
732 } | 737 } |
733 } | 738 } |
734 Tick(sample); | 739 Tick(sample); |
735 } | 740 } |
736 | 741 |
737 } } // namespace v8::internal | 742 } } // namespace v8::internal |
OLD | NEW |