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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 | 62 |
63 #include "v8.h" | 63 #include "v8.h" |
64 | 64 |
65 #include "cpu-profiler.h" | 65 #include "cpu-profiler.h" |
66 #include "flags.h" | 66 #include "flags.h" |
67 #include "frames-inl.h" | 67 #include "frames-inl.h" |
68 #include "log.h" | 68 #include "log.h" |
69 #include "platform.h" | 69 #include "platform.h" |
70 #include "simulator.h" | 70 #include "simulator.h" |
71 #include "v8threads.h" | 71 #include "v8threads.h" |
| 72 #include "vm-state-inl.h" |
72 | 73 |
73 | 74 |
74 #if defined(__ANDROID__) && !defined(__BIONIC_HAVE_UCONTEXT_T) | 75 #if defined(__ANDROID__) && !defined(__BIONIC_HAVE_UCONTEXT_T) |
75 | 76 |
76 // Not all versions of Android's C library provide ucontext_t. | 77 // Not all versions of Android's C library provide ucontext_t. |
77 // Detect this and provide custom but compatible definitions. Note that these | 78 // Detect this and provide custom but compatible definitions. Note that these |
78 // follow the GLibc naming convention to access register values from | 79 // follow the GLibc naming convention to access register values from |
79 // mcontext_t. | 80 // mcontext_t. |
80 // | 81 // |
81 // See http://code.google.com/p/android/issues/detail?id=34784 | 82 // See http://code.google.com/p/android/issues/detail?id=34784 |
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 // Avoid collecting traces while doing GC. | 615 // Avoid collecting traces while doing GC. |
615 if (state == GC) return; | 616 if (state == GC) return; |
616 | 617 |
617 const Address js_entry_sp = | 618 const Address js_entry_sp = |
618 Isolate::js_entry_sp(isolate->thread_local_top()); | 619 Isolate::js_entry_sp(isolate->thread_local_top()); |
619 if (js_entry_sp == 0) { | 620 if (js_entry_sp == 0) { |
620 // Not executing JS now. | 621 // Not executing JS now. |
621 return; | 622 return; |
622 } | 623 } |
623 | 624 |
624 const Address callback = isolate->external_callback(); | 625 ExternalCallbackScope* scope = isolate->external_callback_scope(); |
625 if (callback != NULL) { | 626 Address handler = Isolate::handler(isolate->thread_local_top()); |
626 external_callback = callback; | 627 // If there is a handler on top of the external callback scope then |
| 628 // we have already entrered JavaScript again and the external callback |
| 629 // is not the top function. |
| 630 if (scope && scope->scope_address() < handler) { |
| 631 external_callback = scope->callback(); |
627 has_external_callback = true; | 632 has_external_callback = true; |
628 } else { | 633 } else { |
629 // Sample potential return address value for frameless invocation of | 634 // Sample potential return address value for frameless invocation of |
630 // stubs (we'll figure out later, if this value makes sense). | 635 // stubs (we'll figure out later, if this value makes sense). |
631 tos = Memory::Address_at(regs.sp); | 636 tos = Memory::Address_at(regs.sp); |
632 has_external_callback = false; | 637 has_external_callback = false; |
633 } | 638 } |
634 | 639 |
635 SafeStackFrameIterator it(isolate, regs.fp, regs.sp, js_entry_sp); | 640 SafeStackFrameIterator it(isolate, regs.fp, regs.sp, js_entry_sp); |
636 top_frame_type = it.top_frame_type(); | 641 top_frame_type = it.top_frame_type(); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
691 sample->Init(isolate_, state); | 696 sample->Init(isolate_, state); |
692 if (is_counting_samples_) { | 697 if (is_counting_samples_) { |
693 if (sample->state == JS || sample->state == EXTERNAL) { | 698 if (sample->state == JS || sample->state == EXTERNAL) { |
694 ++js_and_external_sample_count_; | 699 ++js_and_external_sample_count_; |
695 } | 700 } |
696 } | 701 } |
697 Tick(sample); | 702 Tick(sample); |
698 } | 703 } |
699 | 704 |
700 } } // namespace v8::internal | 705 } } // namespace v8::internal |
OLD | NEW |