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

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

Issue 12706020: Isolatify CPU profiler (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments Created 7 years, 9 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') | src/runtime.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 2046 matching lines...) Expand 10 before | Expand all | Expand 10 after
2057 } 2057 }
2058 2058
2059 void SampleContext(Sampler* sampler) { 2059 void SampleContext(Sampler* sampler) {
2060 HANDLE profiled_thread = sampler->platform_data()->profiled_thread(); 2060 HANDLE profiled_thread = sampler->platform_data()->profiled_thread();
2061 if (profiled_thread == NULL) return; 2061 if (profiled_thread == NULL) return;
2062 2062
2063 // Context used for sampling the register state of the profiled thread. 2063 // Context used for sampling the register state of the profiled thread.
2064 CONTEXT context; 2064 CONTEXT context;
2065 memset(&context, 0, sizeof(context)); 2065 memset(&context, 0, sizeof(context));
2066 2066
2067 Isolate* isolate = sampler->isolate();
2067 TickSample sample_obj; 2068 TickSample sample_obj;
2068 TickSample* sample = CpuProfiler::TickSampleEvent(sampler->isolate()); 2069 TickSample* sample = isolate->cpu_profiler()->TickSampleEvent();
2069 if (sample == NULL) sample = &sample_obj; 2070 if (sample == NULL) sample = &sample_obj;
2070 2071
2071 static const DWORD kSuspendFailed = static_cast<DWORD>(-1); 2072 static const DWORD kSuspendFailed = static_cast<DWORD>(-1);
2072 if (SuspendThread(profiled_thread) == kSuspendFailed) return; 2073 if (SuspendThread(profiled_thread) == kSuspendFailed) return;
2073 sample->state = sampler->isolate()->current_vm_state(); 2074 sample->state = isolate->current_vm_state();
2074 2075
2075 context.ContextFlags = CONTEXT_FULL; 2076 context.ContextFlags = CONTEXT_FULL;
2076 if (GetThreadContext(profiled_thread, &context) != 0) { 2077 if (GetThreadContext(profiled_thread, &context) != 0) {
2077 #if V8_HOST_ARCH_X64 2078 #if V8_HOST_ARCH_X64
2078 sample->pc = reinterpret_cast<Address>(context.Rip); 2079 sample->pc = reinterpret_cast<Address>(context.Rip);
2079 sample->sp = reinterpret_cast<Address>(context.Rsp); 2080 sample->sp = reinterpret_cast<Address>(context.Rsp);
2080 sample->fp = reinterpret_cast<Address>(context.Rbp); 2081 sample->fp = reinterpret_cast<Address>(context.Rbp);
2081 #else 2082 #else
2082 sample->pc = reinterpret_cast<Address>(context.Eip); 2083 sample->pc = reinterpret_cast<Address>(context.Eip);
2083 sample->sp = reinterpret_cast<Address>(context.Esp); 2084 sample->sp = reinterpret_cast<Address>(context.Esp);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
2147 2148
2148 2149
2149 void Sampler::Stop() { 2150 void Sampler::Stop() {
2150 ASSERT(IsActive()); 2151 ASSERT(IsActive());
2151 SamplerThread::RemoveActiveSampler(this); 2152 SamplerThread::RemoveActiveSampler(this);
2152 SetActive(false); 2153 SetActive(false);
2153 } 2154 }
2154 2155
2155 2156
2156 } } // namespace v8::internal 2157 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/platform-solaris.cc ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698