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

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

Issue 12475016: Maintain API compatibility with older versions of V8. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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-linux.cc ('k') | src/platform-openbsd.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 800 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 static void DoCpuProfile(Sampler* sampler, void* raw_sampler_thread) { 811 static void DoCpuProfile(Sampler* sampler, void* raw_sampler_thread) {
812 if (!sampler->isolate()->IsInitialized()) return; 812 if (!sampler->isolate()->IsInitialized()) return;
813 if (!sampler->IsProfiling()) return; 813 if (!sampler->IsProfiling()) return;
814 SamplerThread* sampler_thread = 814 SamplerThread* sampler_thread =
815 reinterpret_cast<SamplerThread*>(raw_sampler_thread); 815 reinterpret_cast<SamplerThread*>(raw_sampler_thread);
816 sampler_thread->SampleContext(sampler); 816 sampler_thread->SampleContext(sampler);
817 } 817 }
818 818
819 void SampleContext(Sampler* sampler) { 819 void SampleContext(Sampler* sampler) {
820 thread_act_t profiled_thread = sampler->platform_data()->profiled_thread(); 820 thread_act_t profiled_thread = sampler->platform_data()->profiled_thread();
821 Isolate* isolate = sampler->isolate();
822 TickSample sample_obj; 821 TickSample sample_obj;
823 TickSample* sample = isolate->cpu_profiler()->TickSampleEvent(); 822 TickSample* sample = CpuProfiler::TickSampleEvent(sampler->isolate());
824 if (sample == NULL) sample = &sample_obj; 823 if (sample == NULL) sample = &sample_obj;
825 824
826 if (KERN_SUCCESS != thread_suspend(profiled_thread)) return; 825 if (KERN_SUCCESS != thread_suspend(profiled_thread)) return;
827 826
828 #if V8_HOST_ARCH_X64 827 #if V8_HOST_ARCH_X64
829 thread_state_flavor_t flavor = x86_THREAD_STATE64; 828 thread_state_flavor_t flavor = x86_THREAD_STATE64;
830 x86_thread_state64_t state; 829 x86_thread_state64_t state;
831 mach_msg_type_number_t count = x86_THREAD_STATE64_COUNT; 830 mach_msg_type_number_t count = x86_THREAD_STATE64_COUNT;
832 #if __DARWIN_UNIX03 831 #if __DARWIN_UNIX03
833 #define REGISTER_FIELD(name) __r ## name 832 #define REGISTER_FIELD(name) __r ## name
(...skipping 10 matching lines...) Expand all
844 #define REGISTER_FIELD(name) e ## name 843 #define REGISTER_FIELD(name) e ## name
845 #endif // __DARWIN_UNIX03 844 #endif // __DARWIN_UNIX03
846 #else 845 #else
847 #error Unsupported Mac OS X host architecture. 846 #error Unsupported Mac OS X host architecture.
848 #endif // V8_HOST_ARCH 847 #endif // V8_HOST_ARCH
849 848
850 if (thread_get_state(profiled_thread, 849 if (thread_get_state(profiled_thread,
851 flavor, 850 flavor,
852 reinterpret_cast<natural_t*>(&state), 851 reinterpret_cast<natural_t*>(&state),
853 &count) == KERN_SUCCESS) { 852 &count) == KERN_SUCCESS) {
854 sample->state = isolate->current_vm_state(); 853 sample->state = sampler->isolate()->current_vm_state();
855 sample->pc = reinterpret_cast<Address>(state.REGISTER_FIELD(ip)); 854 sample->pc = reinterpret_cast<Address>(state.REGISTER_FIELD(ip));
856 sample->sp = reinterpret_cast<Address>(state.REGISTER_FIELD(sp)); 855 sample->sp = reinterpret_cast<Address>(state.REGISTER_FIELD(sp));
857 sample->fp = reinterpret_cast<Address>(state.REGISTER_FIELD(bp)); 856 sample->fp = reinterpret_cast<Address>(state.REGISTER_FIELD(bp));
858 sampler->SampleStack(sample); 857 sampler->SampleStack(sample);
859 sampler->Tick(sample); 858 sampler->Tick(sample);
860 } 859 }
861 thread_resume(profiled_thread); 860 thread_resume(profiled_thread);
862 } 861 }
863 862
864 const int interval_; 863 const int interval_;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
917 916
918 917
919 void Sampler::Stop() { 918 void Sampler::Stop() {
920 ASSERT(IsActive()); 919 ASSERT(IsActive());
921 SamplerThread::RemoveActiveSampler(this); 920 SamplerThread::RemoveActiveSampler(this);
922 SetActive(false); 921 SetActive(false);
923 } 922 }
924 923
925 924
926 } } // namespace v8::internal 925 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/platform-linux.cc ('k') | src/platform-openbsd.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698