OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 return false; | 144 return false; |
145 } | 145 } |
146 #endif // def __arm__ | 146 #endif // def __arm__ |
147 | 147 |
148 | 148 |
149 int OS::ActivationFrameAlignment() { | 149 int OS::ActivationFrameAlignment() { |
150 #ifdef V8_TARGET_ARCH_ARM | 150 #ifdef V8_TARGET_ARCH_ARM |
151 // On EABI ARM targets this is required for fp correctness in the | 151 // On EABI ARM targets this is required for fp correctness in the |
152 // runtime system. | 152 // runtime system. |
153 return 8; | 153 return 8; |
154 #else | 154 #elif V8_TARGET_ARCH_MIPS |
| 155 return 8; |
| 156 #endif |
155 // With gcc 4.4 the tree vectorization optimiser can generate code | 157 // With gcc 4.4 the tree vectorization optimiser can generate code |
156 // that requires 16 byte alignment such as movdqa on x86. | 158 // that requires 16 byte alignment such as movdqa on x86. |
157 return 16; | 159 return 16; |
158 #endif | |
159 } | 160 } |
160 | 161 |
161 | 162 |
162 const char* OS::LocalTimezone(double time) { | 163 const char* OS::LocalTimezone(double time) { |
163 if (isnan(time)) return ""; | 164 if (isnan(time)) return ""; |
164 time_t tv = static_cast<time_t>(floor(time/msPerSecond)); | 165 time_t tv = static_cast<time_t>(floor(time/msPerSecond)); |
165 struct tm* t = localtime(&tv); | 166 struct tm* t = localtime(&tv); |
166 if (NULL == t) return ""; | 167 if (NULL == t) return ""; |
167 return t->tm_zone; | 168 return t->tm_zone; |
168 } | 169 } |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 // Redirect to std abort to signal abnormal program termination. | 256 // Redirect to std abort to signal abnormal program termination. |
256 abort(); | 257 abort(); |
257 } | 258 } |
258 | 259 |
259 | 260 |
260 void OS::DebugBreak() { | 261 void OS::DebugBreak() { |
261 // TODO(lrn): Introduce processor define for runtime system (!= V8_ARCH_x, | 262 // TODO(lrn): Introduce processor define for runtime system (!= V8_ARCH_x, |
262 // which is the architecture of generated code). | 263 // which is the architecture of generated code). |
263 #if defined(__arm__) || defined(__thumb__) | 264 #if defined(__arm__) || defined(__thumb__) |
264 asm("bkpt 0"); | 265 asm("bkpt 0"); |
| 266 #elif defined(__mips__) |
| 267 asm("break"); |
265 #else | 268 #else |
266 asm("int $3"); | 269 asm("int $3"); |
267 #endif | 270 #endif |
268 } | 271 } |
269 | 272 |
270 | 273 |
271 class PosixMemoryMappedFile : public OS::MemoryMappedFile { | 274 class PosixMemoryMappedFile : public OS::MemoryMappedFile { |
272 public: | 275 public: |
273 PosixMemoryMappedFile(FILE* file, void* memory, int size) | 276 PosixMemoryMappedFile(FILE* file, void* memory, int size) |
274 : file_(file), memory_(memory), size_(size) { } | 277 : file_(file), memory_(memory), size_(size) { } |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 // reading Top::thread_id() should not be affected by races. | 709 // reading Top::thread_id() should not be affected by races. |
707 if (ThreadManager::HasId() && !ThreadManager::IsArchived() && | 710 if (ThreadManager::HasId() && !ThreadManager::IsArchived() && |
708 ThreadManager::CurrentId() == Top::thread_id()) { | 711 ThreadManager::CurrentId() == Top::thread_id()) { |
709 return true; | 712 return true; |
710 } | 713 } |
711 return false; | 714 return false; |
712 } | 715 } |
713 | 716 |
714 | 717 |
715 static void ProfilerSignalHandler(int signal, siginfo_t* info, void* context) { | 718 static void ProfilerSignalHandler(int signal, siginfo_t* info, void* context) { |
| 719 #ifndef V8_HOST_ARCH_MIPS |
716 USE(info); | 720 USE(info); |
717 if (signal != SIGPROF) return; | 721 if (signal != SIGPROF) return; |
718 if (active_sampler_ == NULL) return; | 722 if (active_sampler_ == NULL) return; |
719 | 723 |
720 TickSample sample; | 724 TickSample sample; |
721 | 725 |
722 // If profiling, we extract the current pc and sp. | 726 // If profiling, we extract the current pc and sp. |
723 if (active_sampler_->IsProfiling()) { | 727 if (active_sampler_->IsProfiling()) { |
724 // Extracting the sample from the context is extremely machine dependent. | 728 // Extracting the sample from the context is extremely machine dependent. |
725 ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context); | 729 ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context); |
(...skipping 10 matching lines...) Expand all Loading... |
736 // An undefined macro evaluates to 0, so this applies to Android's Bionic also. | 740 // An undefined macro evaluates to 0, so this applies to Android's Bionic also. |
737 #if (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 3)) | 741 #if (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 3)) |
738 sample.pc = reinterpret_cast<Address>(mcontext.gregs[R15]); | 742 sample.pc = reinterpret_cast<Address>(mcontext.gregs[R15]); |
739 sample.sp = reinterpret_cast<Address>(mcontext.gregs[R13]); | 743 sample.sp = reinterpret_cast<Address>(mcontext.gregs[R13]); |
740 sample.fp = reinterpret_cast<Address>(mcontext.gregs[R11]); | 744 sample.fp = reinterpret_cast<Address>(mcontext.gregs[R11]); |
741 #else | 745 #else |
742 sample.pc = reinterpret_cast<Address>(mcontext.arm_pc); | 746 sample.pc = reinterpret_cast<Address>(mcontext.arm_pc); |
743 sample.sp = reinterpret_cast<Address>(mcontext.arm_sp); | 747 sample.sp = reinterpret_cast<Address>(mcontext.arm_sp); |
744 sample.fp = reinterpret_cast<Address>(mcontext.arm_fp); | 748 sample.fp = reinterpret_cast<Address>(mcontext.arm_fp); |
745 #endif | 749 #endif |
| 750 #elif V8_HOST_ARCH_MIPS |
| 751 // Implement this on MIPS. |
| 752 UNIMPLEMENTED(); |
746 #endif | 753 #endif |
747 if (IsVmThread()) | 754 if (IsVmThread()) |
748 active_sampler_->SampleStack(&sample); | 755 active_sampler_->SampleStack(&sample); |
749 } | 756 } |
750 | 757 |
751 // We always sample the VM state. | 758 // We always sample the VM state. |
752 sample.state = Logger::state(); | 759 sample.state = Logger::state(); |
753 | 760 |
754 active_sampler_->Tick(&sample); | 761 active_sampler_->Tick(&sample); |
| 762 #endif |
755 } | 763 } |
756 | 764 |
757 | 765 |
758 class Sampler::PlatformData : public Malloced { | 766 class Sampler::PlatformData : public Malloced { |
759 public: | 767 public: |
760 PlatformData() { | 768 PlatformData() { |
761 signal_handler_installed_ = false; | 769 signal_handler_installed_ = false; |
762 } | 770 } |
763 | 771 |
764 bool signal_handler_installed_; | 772 bool signal_handler_installed_; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
817 | 825 |
818 // This sampler is no longer the active sampler. | 826 // This sampler is no longer the active sampler. |
819 active_sampler_ = NULL; | 827 active_sampler_ = NULL; |
820 active_ = false; | 828 active_ = false; |
821 } | 829 } |
822 | 830 |
823 | 831 |
824 #endif // ENABLE_LOGGING_AND_PROFILING | 832 #endif // ENABLE_LOGGING_AND_PROFILING |
825 | 833 |
826 } } // namespace v8::internal | 834 } } // namespace v8::internal |
OLD | NEW |