Chromium Code Reviews| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 83 srandom(static_cast<unsigned int>(seed)); | 83 srandom(static_cast<unsigned int>(seed)); |
| 84 } | 84 } |
| 85 | 85 |
| 86 | 86 |
| 87 double OS::nan_value() { | 87 double OS::nan_value() { |
| 88 return NAN; | 88 return NAN; |
| 89 } | 89 } |
| 90 | 90 |
| 91 | 91 |
| 92 int OS::ActivationFrameAlignment() { | 92 int OS::ActivationFrameAlignment() { |
| 93 #ifdef V8_TARGET_ARCH_ARM | 93 #ifdef V8_TARGET_ARCH_ARM |
| 94 // On EABI ARM targets this is required for fp correctness in the | 94 // On EABI ARM targets this is required for fp correctness in the |
| 95 // runtime system. | 95 // runtime system. |
| 96 return 8; | 96 return 8; |
| 97 #else | 97 #else |
| 98 #ifdef V8_TARGET_ARCH_MIPS | |
|
Søren Thygesen Gjesse
2010/01/19 22:59:12
Combine with #else above to #elif.
Alexandre
2010/01/22 23:08:42
Fixed
On 2010/01/19 22:59:12, Søren Gjesse wrote:
| |
| 99 return 8; | |
| 100 #endif | |
| 98 // With gcc 4.4 the tree vectorization optimiser can generate code | 101 // With gcc 4.4 the tree vectorization optimiser can generate code |
| 99 // that requires 16 byte alignment such as movdqa on x86. | 102 // that requires 16 byte alignment such as movdqa on x86. |
| 100 return 16; | 103 return 16; |
| 101 #endif | 104 #endif |
| 102 } | 105 } |
| 103 | 106 |
| 104 | 107 |
| 105 // We keep the lowest and highest addresses mapped as a quick way of | 108 // We keep the lowest and highest addresses mapped as a quick way of |
| 106 // determining that pointers are outside the heap (used mostly in assertions | 109 // determining that pointers are outside the heap (used mostly in assertions |
| 107 // and verification). The estimate is conservative, ie, not all addresses in | 110 // and verification). The estimate is conservative, ie, not all addresses in |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 180 // Redirect to std abort to signal abnormal program termination. | 183 // Redirect to std abort to signal abnormal program termination. |
| 181 abort(); | 184 abort(); |
| 182 } | 185 } |
| 183 | 186 |
| 184 | 187 |
| 185 void OS::DebugBreak() { | 188 void OS::DebugBreak() { |
| 186 // TODO(lrn): Introduce processor define for runtime system (!= V8_ARCH_x, | 189 // TODO(lrn): Introduce processor define for runtime system (!= V8_ARCH_x, |
| 187 // which is the architecture of generated code). | 190 // which is the architecture of generated code). |
| 188 #if defined(__arm__) || defined(__thumb__) | 191 #if defined(__arm__) || defined(__thumb__) |
| 189 asm("bkpt 0"); | 192 asm("bkpt 0"); |
| 193 #elif defined(__mips__) | |
| 194 // The code field of the break instruction is available for use as software pa rameters. | |
| 195 asm("break"); | |
| 190 #else | 196 #else |
| 191 asm("int $3"); | 197 asm("int $3"); |
| 192 #endif | 198 #endif |
| 193 } | 199 } |
| 194 | 200 |
| 195 | 201 |
| 196 class PosixMemoryMappedFile : public OS::MemoryMappedFile { | 202 class PosixMemoryMappedFile : public OS::MemoryMappedFile { |
| 197 public: | 203 public: |
| 198 PosixMemoryMappedFile(FILE* file, void* memory, int size) | 204 PosixMemoryMappedFile(FILE* file, void* memory, int size) |
| 199 : file_(file), memory_(memory), size_(size) { } | 205 : file_(file), memory_(memory), size_(size) { } |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 629 // we check Top's data. Having that ThreadManager::RestoreThread first | 635 // we check Top's data. Having that ThreadManager::RestoreThread first |
| 630 // restores ThreadLocalTop from TLS, and only then erases the TLS value, | 636 // restores ThreadLocalTop from TLS, and only then erases the TLS value, |
| 631 // reading Top::thread_id() should not be affected by races. | 637 // reading Top::thread_id() should not be affected by races. |
| 632 if (ThreadManager::HasId() && !ThreadManager::IsArchived() && | 638 if (ThreadManager::HasId() && !ThreadManager::IsArchived() && |
| 633 ThreadManager::CurrentId() == Top::thread_id()) { | 639 ThreadManager::CurrentId() == Top::thread_id()) { |
| 634 return true; | 640 return true; |
| 635 } | 641 } |
| 636 return false; | 642 return false; |
| 637 } | 643 } |
| 638 | 644 |
| 639 | |
| 640 static void ProfilerSignalHandler(int signal, siginfo_t* info, void* context) { | 645 static void ProfilerSignalHandler(int signal, siginfo_t* info, void* context) { |
| 646 #ifndef V8_HOST_ARCH_MIPS | |
| 641 USE(info); | 647 USE(info); |
| 642 if (signal != SIGPROF) return; | 648 if (signal != SIGPROF) return; |
| 643 if (active_sampler_ == NULL) return; | 649 if (active_sampler_ == NULL) return; |
| 644 | 650 |
| 645 TickSample sample; | 651 TickSample sample; |
| 646 | 652 |
| 647 // If profiling, we extract the current pc and sp. | 653 // If profiling, we extract the current pc and sp. |
| 648 if (active_sampler_->IsProfiling()) { | 654 if (active_sampler_->IsProfiling()) { |
| 649 // Extracting the sample from the context is extremely machine dependent. | 655 // Extracting the sample from the context is extremely machine dependent. |
| 650 ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context); | 656 ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 661 // An undefined macro evaluates to 0, so this applies to Android's Bionic also. | 667 // An undefined macro evaluates to 0, so this applies to Android's Bionic also. |
| 662 #if (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 3)) | 668 #if (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 3)) |
| 663 sample.pc = mcontext.gregs[R15]; | 669 sample.pc = mcontext.gregs[R15]; |
| 664 sample.sp = mcontext.gregs[R13]; | 670 sample.sp = mcontext.gregs[R13]; |
| 665 sample.fp = mcontext.gregs[R11]; | 671 sample.fp = mcontext.gregs[R11]; |
| 666 #else | 672 #else |
| 667 sample.pc = mcontext.arm_pc; | 673 sample.pc = mcontext.arm_pc; |
| 668 sample.sp = mcontext.arm_sp; | 674 sample.sp = mcontext.arm_sp; |
| 669 sample.fp = mcontext.arm_fp; | 675 sample.fp = mcontext.arm_fp; |
| 670 #endif | 676 #endif |
| 677 #elif V8_HOST_ARCH_MIPS | |
| 678 // TODO Implement this on MIPS. | |
| 671 #endif | 679 #endif |
| 672 if (IsVmThread()) | 680 if (IsVmThread()) |
| 673 active_sampler_->SampleStack(&sample); | 681 active_sampler_->SampleStack(&sample); |
| 674 } | 682 } |
| 675 | 683 |
| 676 // We always sample the VM state. | 684 // We always sample the VM state. |
| 677 sample.state = Logger::state(); | 685 sample.state = Logger::state(); |
| 678 | 686 |
| 679 active_sampler_->Tick(&sample); | 687 active_sampler_->Tick(&sample); |
| 688 #endif | |
| 680 } | 689 } |
| 681 | 690 |
| 682 | 691 |
| 683 class Sampler::PlatformData : public Malloced { | 692 class Sampler::PlatformData : public Malloced { |
| 684 public: | 693 public: |
| 685 PlatformData() { | 694 PlatformData() { |
| 686 signal_handler_installed_ = false; | 695 signal_handler_installed_ = false; |
| 687 } | 696 } |
| 688 | 697 |
| 689 bool signal_handler_installed_; | 698 bool signal_handler_installed_; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 742 | 751 |
| 743 // This sampler is no longer the active sampler. | 752 // This sampler is no longer the active sampler. |
| 744 active_sampler_ = NULL; | 753 active_sampler_ = NULL; |
| 745 active_ = false; | 754 active_ = false; |
| 746 } | 755 } |
| 747 | 756 |
| 748 | 757 |
| 749 #endif // ENABLE_LOGGING_AND_PROFILING | 758 #endif // ENABLE_LOGGING_AND_PROFILING |
| 750 | 759 |
| 751 } } // namespace v8::internal | 760 } } // namespace v8::internal |
| OLD | NEW |