OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 1795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1806 // Loop until the sampler is disengaged. | 1806 // Loop until the sampler is disengaged. |
1807 while (sampler_->IsActive()) { | 1807 while (sampler_->IsActive()) { |
1808 TickSample sample; | 1808 TickSample sample; |
1809 | 1809 |
1810 // If profiling, we record the pc and sp of the profiled thread. | 1810 // If profiling, we record the pc and sp of the profiled thread. |
1811 if (sampler_->IsProfiling() | 1811 if (sampler_->IsProfiling() |
1812 && SuspendThread(profiled_thread_) != (DWORD)-1) { | 1812 && SuspendThread(profiled_thread_) != (DWORD)-1) { |
1813 context.ContextFlags = CONTEXT_FULL; | 1813 context.ContextFlags = CONTEXT_FULL; |
1814 if (GetThreadContext(profiled_thread_, &context) != 0) { | 1814 if (GetThreadContext(profiled_thread_, &context) != 0) { |
1815 #if V8_HOST_ARCH_X64 | 1815 #if V8_HOST_ARCH_X64 |
1816 sample.pc = context.Rip; | 1816 sample.pc = reinterpret_cast<Address>(context.Rip); |
1817 sample.sp = context.Rsp; | 1817 sample.sp = reinterpret_cast<Address>(context.Rsp); |
1818 sample.fp = context.Rbp; | 1818 sample.fp = reinterpret_cast<Address>(context.Rbp); |
1819 #else | 1819 #else |
1820 sample.pc = context.Eip; | 1820 sample.pc = reinterpret_cast<Address>(context.Eip); |
1821 sample.sp = context.Esp; | 1821 sample.sp = reinterpret_cast<Address>(context.Esp); |
1822 sample.fp = context.Ebp; | 1822 sample.fp = reinterpret_cast<Address>(context.Ebp); |
1823 #endif | 1823 #endif |
1824 sampler_->SampleStack(&sample); | 1824 sampler_->SampleStack(&sample); |
1825 } | 1825 } |
1826 ResumeThread(profiled_thread_); | 1826 ResumeThread(profiled_thread_); |
1827 } | 1827 } |
1828 | 1828 |
1829 // We always sample the VM state. | 1829 // We always sample the VM state. |
1830 sample.state = Logger::state(); | 1830 sample.state = Logger::state(); |
1831 // Invoke tick handler with program counter and stack pointer. | 1831 // Invoke tick handler with program counter and stack pointer. |
1832 sampler_->Tick(&sample); | 1832 sampler_->Tick(&sample); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1899 | 1899 |
1900 // Release the thread handles | 1900 // Release the thread handles |
1901 CloseHandle(data_->sampler_thread_); | 1901 CloseHandle(data_->sampler_thread_); |
1902 CloseHandle(data_->profiled_thread_); | 1902 CloseHandle(data_->profiled_thread_); |
1903 } | 1903 } |
1904 | 1904 |
1905 | 1905 |
1906 #endif // ENABLE_LOGGING_AND_PROFILING | 1906 #endif // ENABLE_LOGGING_AND_PROFILING |
1907 | 1907 |
1908 } } // namespace v8::internal | 1908 } } // namespace v8::internal |
OLD | NEW |