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

Side by Side Diff: src/platform-cygwin.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/log.cc ('k') | src/platform-freebsd.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 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 } 680 }
681 681
682 void SampleContext(Sampler* sampler) { 682 void SampleContext(Sampler* sampler) {
683 HANDLE profiled_thread = sampler->platform_data()->profiled_thread(); 683 HANDLE profiled_thread = sampler->platform_data()->profiled_thread();
684 if (profiled_thread == NULL) return; 684 if (profiled_thread == NULL) return;
685 685
686 // Context used for sampling the register state of the profiled thread. 686 // Context used for sampling the register state of the profiled thread.
687 CONTEXT context; 687 CONTEXT context;
688 memset(&context, 0, sizeof(context)); 688 memset(&context, 0, sizeof(context));
689 689
690 Isolate* isolate = sampler->isolate();
690 TickSample sample_obj; 691 TickSample sample_obj;
691 TickSample* sample = CpuProfiler::TickSampleEvent(sampler->isolate()); 692 TickSample* sample = isolate->cpu_profiler()->TickSampleEvent();
692 if (sample == NULL) sample = &sample_obj; 693 if (sample == NULL) sample = &sample_obj;
693 694
694 static const DWORD kSuspendFailed = static_cast<DWORD>(-1); 695 static const DWORD kSuspendFailed = static_cast<DWORD>(-1);
695 if (SuspendThread(profiled_thread) == kSuspendFailed) return; 696 if (SuspendThread(profiled_thread) == kSuspendFailed) return;
696 sample->state = sampler->isolate()->current_vm_state(); 697 sample->state = isolate->current_vm_state();
697 698
698 context.ContextFlags = CONTEXT_FULL; 699 context.ContextFlags = CONTEXT_FULL;
699 if (GetThreadContext(profiled_thread, &context) != 0) { 700 if (GetThreadContext(profiled_thread, &context) != 0) {
700 #if V8_HOST_ARCH_X64 701 #if V8_HOST_ARCH_X64
701 sample->pc = reinterpret_cast<Address>(context.Rip); 702 sample->pc = reinterpret_cast<Address>(context.Rip);
702 sample->sp = reinterpret_cast<Address>(context.Rsp); 703 sample->sp = reinterpret_cast<Address>(context.Rsp);
703 sample->fp = reinterpret_cast<Address>(context.Rbp); 704 sample->fp = reinterpret_cast<Address>(context.Rbp);
704 #else 705 #else
705 sample->pc = reinterpret_cast<Address>(context.Eip); 706 sample->pc = reinterpret_cast<Address>(context.Eip);
706 sample->sp = reinterpret_cast<Address>(context.Esp); 707 sample->sp = reinterpret_cast<Address>(context.Esp);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 771
771 772
772 void Sampler::Stop() { 773 void Sampler::Stop() {
773 ASSERT(IsActive()); 774 ASSERT(IsActive());
774 SamplerThread::RemoveActiveSampler(this); 775 SamplerThread::RemoveActiveSampler(this);
775 SetActive(false); 776 SetActive(false);
776 } 777 }
777 778
778 779
779 } } // namespace v8::internal 780 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/log.cc ('k') | src/platform-freebsd.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698