| 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 1567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1578 // If profiling, we record the pc and sp of the profiled thread. | 1578 // If profiling, we record the pc and sp of the profiled thread. |
| 1579 if (sampler_->IsProfiling()) { | 1579 if (sampler_->IsProfiling()) { |
| 1580 // Pause the profiled thread and get its context. | 1580 // Pause the profiled thread and get its context. |
| 1581 SuspendThread(profiled_thread_); | 1581 SuspendThread(profiled_thread_); |
| 1582 context.ContextFlags = CONTEXT_FULL; | 1582 context.ContextFlags = CONTEXT_FULL; |
| 1583 GetThreadContext(profiled_thread_, &context); | 1583 GetThreadContext(profiled_thread_, &context); |
| 1584 ResumeThread(profiled_thread_); | 1584 ResumeThread(profiled_thread_); |
| 1585 // Invoke tick handler with program counter and stack pointer. | 1585 // Invoke tick handler with program counter and stack pointer. |
| 1586 sample.pc = context.Eip; | 1586 sample.pc = context.Eip; |
| 1587 sample.sp = context.Esp; | 1587 sample.sp = context.Esp; |
| 1588 sample.fp = context.Ebp; |
| 1588 } | 1589 } |
| 1589 | 1590 |
| 1590 // We always sample the VM state. | 1591 // We always sample the VM state. |
| 1591 sample.state = Logger::state(); | 1592 sample.state = Logger::state(); |
| 1592 sampler_->Tick(&sample); | 1593 sampler_->Tick(&sample); |
| 1593 | 1594 |
| 1594 // Wait until next sampling. | 1595 // Wait until next sampling. |
| 1595 Sleep(sampler_->interval_); | 1596 Sleep(sampler_->interval_); |
| 1596 } | 1597 } |
| 1597 } | 1598 } |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1656 | 1657 |
| 1657 // Release the thread handles | 1658 // Release the thread handles |
| 1658 CloseHandle(data_->sampler_thread_); | 1659 CloseHandle(data_->sampler_thread_); |
| 1659 CloseHandle(data_->profiled_thread_); | 1660 CloseHandle(data_->profiled_thread_); |
| 1660 } | 1661 } |
| 1661 | 1662 |
| 1662 | 1663 |
| 1663 #endif // ENABLE_LOGGING_AND_PROFILING | 1664 #endif // ENABLE_LOGGING_AND_PROFILING |
| 1664 | 1665 |
| 1665 } } // namespace v8::internal | 1666 } } // namespace v8::internal |
| OLD | NEW |