OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
957 // Glibc doesn't provide a wrapper for gettid(2). | 957 // Glibc doesn't provide a wrapper for gettid(2). |
958 #if defined(ANDROID) | 958 #if defined(ANDROID) |
959 return syscall(__NR_gettid); | 959 return syscall(__NR_gettid); |
960 #else | 960 #else |
961 return syscall(SYS_gettid); | 961 return syscall(SYS_gettid); |
962 #endif | 962 #endif |
963 } | 963 } |
964 | 964 |
965 | 965 |
966 static void ProfilerSignalHandler(int signal, siginfo_t* info, void* context) { | 966 static void ProfilerSignalHandler(int signal, siginfo_t* info, void* context) { |
967 #ifndef V8_HOST_ARCH_MIPS | |
968 USE(info); | 967 USE(info); |
969 if (signal != SIGPROF) return; | 968 if (signal != SIGPROF) return; |
970 Isolate* isolate = Isolate::UncheckedCurrent(); | 969 Isolate* isolate = Isolate::UncheckedCurrent(); |
971 if (isolate == NULL || !isolate->IsInitialized() || !isolate->IsInUse()) { | 970 if (isolate == NULL || !isolate->IsInitialized() || !isolate->IsInUse()) { |
972 // We require a fully initialized and entered isolate. | 971 // We require a fully initialized and entered isolate. |
973 return; | 972 return; |
974 } | 973 } |
975 if (v8::Locker::IsActive() && | 974 if (v8::Locker::IsActive() && |
976 !isolate->thread_manager()->IsLockedByCurrentThread()) { | 975 !isolate->thread_manager()->IsLockedByCurrentThread()) { |
977 return; | 976 return; |
(...skipping 22 matching lines...) Expand all Loading... | |
1000 // An undefined macro evaluates to 0, so this applies to Android's Bionic also. | 999 // An undefined macro evaluates to 0, so this applies to Android's Bionic also. |
1001 #if (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 3)) | 1000 #if (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 3)) |
1002 sample->pc = reinterpret_cast<Address>(mcontext.gregs[R15]); | 1001 sample->pc = reinterpret_cast<Address>(mcontext.gregs[R15]); |
1003 sample->sp = reinterpret_cast<Address>(mcontext.gregs[R13]); | 1002 sample->sp = reinterpret_cast<Address>(mcontext.gregs[R13]); |
1004 sample->fp = reinterpret_cast<Address>(mcontext.gregs[R11]); | 1003 sample->fp = reinterpret_cast<Address>(mcontext.gregs[R11]); |
1005 #else | 1004 #else |
1006 sample->pc = reinterpret_cast<Address>(mcontext.arm_pc); | 1005 sample->pc = reinterpret_cast<Address>(mcontext.arm_pc); |
1007 sample->sp = reinterpret_cast<Address>(mcontext.arm_sp); | 1006 sample->sp = reinterpret_cast<Address>(mcontext.arm_sp); |
1008 sample->fp = reinterpret_cast<Address>(mcontext.arm_fp); | 1007 sample->fp = reinterpret_cast<Address>(mcontext.arm_fp); |
1009 #endif | 1008 #endif |
1010 #elif V8_HOST_ARCH_MIPS | 1009 #elif V8_HOST_ARCH_MIPS |
mnaganov (inactive)
2011/11/09 11:26:22
Does it compile at all? Looks simply incorrect as
Yang
2011/11/09 11:36:05
I think this #elif refers to the #if V8_HOST_ARCH_
mnaganov (inactive)
2011/11/09 11:49:42
Ah, that's right. I'd recommend adding a comment l
| |
1011 sample.pc = reinterpret_cast<Address>(mcontext.pc); | 1010 sample->pc = reinterpret_cast<Address>(mcontext.pc); |
1012 sample.sp = reinterpret_cast<Address>(mcontext.gregs[29]); | 1011 sample->sp = reinterpret_cast<Address>(mcontext.gregs[29]); |
1013 sample.fp = reinterpret_cast<Address>(mcontext.gregs[30]); | 1012 sample->fp = reinterpret_cast<Address>(mcontext.gregs[30]); |
1014 #endif | 1013 #endif |
1015 sampler->SampleStack(sample); | 1014 sampler->SampleStack(sample); |
1016 sampler->Tick(sample); | 1015 sampler->Tick(sample); |
1017 #endif | |
1018 } | 1016 } |
1019 | 1017 |
1020 | 1018 |
1021 class Sampler::PlatformData : public Malloced { | 1019 class Sampler::PlatformData : public Malloced { |
1022 public: | 1020 public: |
1023 PlatformData() : vm_tid_(GetThreadID()) {} | 1021 PlatformData() : vm_tid_(GetThreadID()) {} |
1024 | 1022 |
1025 int vm_tid() const { return vm_tid_; } | 1023 int vm_tid() const { return vm_tid_; } |
1026 | 1024 |
1027 private: | 1025 private: |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1209 | 1207 |
1210 | 1208 |
1211 void Sampler::Stop() { | 1209 void Sampler::Stop() { |
1212 ASSERT(IsActive()); | 1210 ASSERT(IsActive()); |
1213 SignalSender::RemoveActiveSampler(this); | 1211 SignalSender::RemoveActiveSampler(this); |
1214 SetActive(false); | 1212 SetActive(false); |
1215 } | 1213 } |
1216 | 1214 |
1217 | 1215 |
1218 } } // namespace v8::internal | 1216 } } // namespace v8::internal |
OLD | NEW |