| 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 1798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1809 TickSample* sample = CpuProfiler::TickSampleEvent(); | 1809 TickSample* sample = CpuProfiler::TickSampleEvent(); |
| 1810 if (sample == NULL) continue; | 1810 if (sample == NULL) continue; |
| 1811 sample->pc = NULL; // Impossible value if sampling succeeds. | 1811 sample->pc = NULL; // Impossible value if sampling succeeds. |
| 1812 sample->frames_count = 0; | 1812 sample->frames_count = 0; |
| 1813 #else | 1813 #else |
| 1814 TickSample sample_obj; | 1814 TickSample sample_obj; |
| 1815 TickSample* sample = &sample_obj; | 1815 TickSample* sample = &sample_obj; |
| 1816 #endif // ENABLE_CPP_PROFILES_PROCESSOR | 1816 #endif // ENABLE_CPP_PROFILES_PROCESSOR |
| 1817 | 1817 |
| 1818 // We always sample the VM state. | 1818 // We always sample the VM state. |
| 1819 sample->state = Logger::state(); | 1819 sample->state = VMState::current_state(); |
| 1820 // If profiling, we record the pc and sp of the profiled thread. | 1820 // If profiling, we record the pc and sp of the profiled thread. |
| 1821 if (sampler_->IsProfiling() | 1821 if (sampler_->IsProfiling() |
| 1822 && SuspendThread(profiled_thread_) != (DWORD)-1) { | 1822 && SuspendThread(profiled_thread_) != (DWORD)-1) { |
| 1823 context.ContextFlags = CONTEXT_FULL; | 1823 context.ContextFlags = CONTEXT_FULL; |
| 1824 if (GetThreadContext(profiled_thread_, &context) != 0) { | 1824 if (GetThreadContext(profiled_thread_, &context) != 0) { |
| 1825 #if V8_HOST_ARCH_X64 | 1825 #if V8_HOST_ARCH_X64 |
| 1826 sample->pc = reinterpret_cast<Address>(context.Rip); | 1826 sample->pc = reinterpret_cast<Address>(context.Rip); |
| 1827 sample->sp = reinterpret_cast<Address>(context.Rsp); | 1827 sample->sp = reinterpret_cast<Address>(context.Rsp); |
| 1828 sample->fp = reinterpret_cast<Address>(context.Rbp); | 1828 sample->fp = reinterpret_cast<Address>(context.Rbp); |
| 1829 #else | 1829 #else |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1906 | 1906 |
| 1907 // Release the thread handles | 1907 // Release the thread handles |
| 1908 CloseHandle(data_->sampler_thread_); | 1908 CloseHandle(data_->sampler_thread_); |
| 1909 CloseHandle(data_->profiled_thread_); | 1909 CloseHandle(data_->profiled_thread_); |
| 1910 } | 1910 } |
| 1911 | 1911 |
| 1912 | 1912 |
| 1913 #endif // ENABLE_LOGGING_AND_PROFILING | 1913 #endif // ENABLE_LOGGING_AND_PROFILING |
| 1914 | 1914 |
| 1915 } } // namespace v8::internal | 1915 } } // namespace v8::internal |
| OLD | NEW |