Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Side by Side Diff: src/platform-win32.cc

Issue 11193020: Revert recent CPU profiler changes because they broke --prof. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/platform-solaris.cc ('k') | test/cctest/test-cpu-profiler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 2020 matching lines...) Expand 10 before | Expand all | Expand 10 after
2031 } 2031 }
2032 2032
2033 void SampleContext(Sampler* sampler) { 2033 void SampleContext(Sampler* sampler) {
2034 HANDLE profiled_thread = sampler->platform_data()->profiled_thread(); 2034 HANDLE profiled_thread = sampler->platform_data()->profiled_thread();
2035 if (profiled_thread == NULL) return; 2035 if (profiled_thread == NULL) return;
2036 2036
2037 // Context used for sampling the register state of the profiled thread. 2037 // Context used for sampling the register state of the profiled thread.
2038 CONTEXT context; 2038 CONTEXT context;
2039 memset(&context, 0, sizeof(context)); 2039 memset(&context, 0, sizeof(context));
2040 2040
2041 TickSample* sample = CpuProfiler::StartTickSampleEvent(sampler->isolate()); 2041 TickSample sample_obj;
2042 if (sample == NULL) return; 2042 TickSample* sample = CpuProfiler::TickSampleEvent(sampler->isolate());
2043 if (sample == NULL) sample = &sample_obj;
2043 2044
2044 static const DWORD kSuspendFailed = static_cast<DWORD>(-1); 2045 static const DWORD kSuspendFailed = static_cast<DWORD>(-1);
2045 if (SuspendThread(profiled_thread) == kSuspendFailed) return; 2046 if (SuspendThread(profiled_thread) == kSuspendFailed) return;
2046 sample->state = sampler->isolate()->current_vm_state(); 2047 sample->state = sampler->isolate()->current_vm_state();
2047 2048
2048 context.ContextFlags = CONTEXT_FULL; 2049 context.ContextFlags = CONTEXT_FULL;
2049 if (GetThreadContext(profiled_thread, &context) != 0) { 2050 if (GetThreadContext(profiled_thread, &context) != 0) {
2050 #if V8_HOST_ARCH_X64 2051 #if V8_HOST_ARCH_X64
2051 sample->pc = reinterpret_cast<Address>(context.Rip); 2052 sample->pc = reinterpret_cast<Address>(context.Rip);
2052 sample->sp = reinterpret_cast<Address>(context.Rsp); 2053 sample->sp = reinterpret_cast<Address>(context.Rsp);
2053 sample->fp = reinterpret_cast<Address>(context.Rbp); 2054 sample->fp = reinterpret_cast<Address>(context.Rbp);
2054 #else 2055 #else
2055 sample->pc = reinterpret_cast<Address>(context.Eip); 2056 sample->pc = reinterpret_cast<Address>(context.Eip);
2056 sample->sp = reinterpret_cast<Address>(context.Esp); 2057 sample->sp = reinterpret_cast<Address>(context.Esp);
2057 sample->fp = reinterpret_cast<Address>(context.Ebp); 2058 sample->fp = reinterpret_cast<Address>(context.Ebp);
2058 #endif 2059 #endif
2059 sampler->SampleStack(sample); 2060 sampler->SampleStack(sample);
2060 sampler->Tick(sample); 2061 sampler->Tick(sample);
2061 } 2062 }
2062 CpuProfiler::FinishTickSampleEvent(sampler->isolate());
2063 ResumeThread(profiled_thread); 2063 ResumeThread(profiled_thread);
2064 } 2064 }
2065 2065
2066 const int interval_; 2066 const int interval_;
2067 RuntimeProfilerRateLimiter rate_limiter_; 2067 RuntimeProfilerRateLimiter rate_limiter_;
2068 2068
2069 // Protects the process wide state below. 2069 // Protects the process wide state below.
2070 static Mutex* mutex_; 2070 static Mutex* mutex_;
2071 static SamplerThread* instance_; 2071 static SamplerThread* instance_;
2072 2072
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
2107 data_ = new PlatformData; 2107 data_ = new PlatformData;
2108 } 2108 }
2109 2109
2110 2110
2111 Sampler::~Sampler() { 2111 Sampler::~Sampler() {
2112 ASSERT(!IsActive()); 2112 ASSERT(!IsActive());
2113 delete data_; 2113 delete data_;
2114 } 2114 }
2115 2115
2116 2116
2117 void Sampler::DoSample() {
2118 // TODO(rogulenko): implement
2119 }
2120
2121
2122 void Sampler::Start() { 2117 void Sampler::Start() {
2123 ASSERT(!IsActive()); 2118 ASSERT(!IsActive());
2124 SetActive(true); 2119 SetActive(true);
2125 SamplerThread::AddActiveSampler(this); 2120 SamplerThread::AddActiveSampler(this);
2126 } 2121 }
2127 2122
2128 2123
2129 void Sampler::Stop() { 2124 void Sampler::Stop() {
2130 ASSERT(IsActive()); 2125 ASSERT(IsActive());
2131 SamplerThread::RemoveActiveSampler(this); 2126 SamplerThread::RemoveActiveSampler(this);
2132 SetActive(false); 2127 SetActive(false);
2133 } 2128 }
2134 2129
2135 2130
2136 } } // namespace v8::internal 2131 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/platform-solaris.cc ('k') | test/cctest/test-cpu-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698