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

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

Issue 844006: Merge changes up to V8 version 2.1.3 into the partial snapshots (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/partial_snapshots/
Patch Set: Created 10 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-freebsd.cc ('k') | src/platform-macos.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 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 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 325
326 // This loop will terminate once the scanning hits an EOF. 326 // This loop will terminate once the scanning hits an EOF.
327 while (true) { 327 while (true) {
328 uintptr_t start, end; 328 uintptr_t start, end;
329 char attr_r, attr_w, attr_x, attr_p; 329 char attr_r, attr_w, attr_x, attr_p;
330 // Parse the addresses and permission bits at the beginning of the line. 330 // Parse the addresses and permission bits at the beginning of the line.
331 if (fscanf(fp, "%" V8PRIxPTR "-%" V8PRIxPTR, &start, &end) != 2) break; 331 if (fscanf(fp, "%" V8PRIxPTR "-%" V8PRIxPTR, &start, &end) != 2) break;
332 if (fscanf(fp, " %c%c%c%c", &attr_r, &attr_w, &attr_x, &attr_p) != 4) break; 332 if (fscanf(fp, " %c%c%c%c", &attr_r, &attr_w, &attr_x, &attr_p) != 4) break;
333 333
334 int c; 334 int c;
335 if (attr_r == 'r' && attr_x == 'x') { 335 if (attr_r == 'r' && attr_w != 'w' && attr_x == 'x') {
336 // Found a readable and executable entry. Skip characters until we reach 336 // Found a read-only executable entry. Skip characters until we reach
337 // the beginning of the filename or the end of the line. 337 // the beginning of the filename or the end of the line.
338 do { 338 do {
339 c = getc(fp); 339 c = getc(fp);
340 } while ((c != EOF) && (c != '\n') && (c != '/')); 340 } while ((c != EOF) && (c != '\n') && (c != '/'));
341 if (c == EOF) break; // EOF: Was unexpected, just exit. 341 if (c == EOF) break; // EOF: Was unexpected, just exit.
342 342
343 // Process the filename if found. 343 // Process the filename if found.
344 if (c == '/') { 344 if (c == '/') {
345 ungetc(c, fp); // Push the '/' back into the stream to be read below. 345 ungetc(c, fp); // Push the '/' back into the stream to be read below.
346 346
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 722
723 723
724 static void ProfilerSignalHandler(int signal, siginfo_t* info, void* context) { 724 static void ProfilerSignalHandler(int signal, siginfo_t* info, void* context) {
725 #ifndef V8_HOST_ARCH_MIPS 725 #ifndef V8_HOST_ARCH_MIPS
726 USE(info); 726 USE(info);
727 if (signal != SIGPROF) return; 727 if (signal != SIGPROF) return;
728 if (active_sampler_ == NULL) return; 728 if (active_sampler_ == NULL) return;
729 729
730 TickSample sample; 730 TickSample sample;
731 731
732 // We always sample the VM state.
733 sample.state = Logger::state();
734
732 // If profiling, we extract the current pc and sp. 735 // If profiling, we extract the current pc and sp.
733 if (active_sampler_->IsProfiling()) { 736 if (active_sampler_->IsProfiling()) {
734 // Extracting the sample from the context is extremely machine dependent. 737 // Extracting the sample from the context is extremely machine dependent.
735 ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context); 738 ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context);
736 mcontext_t& mcontext = ucontext->uc_mcontext; 739 mcontext_t& mcontext = ucontext->uc_mcontext;
737 #if V8_HOST_ARCH_IA32 740 #if V8_HOST_ARCH_IA32
738 sample.pc = reinterpret_cast<Address>(mcontext.gregs[REG_EIP]); 741 sample.pc = reinterpret_cast<Address>(mcontext.gregs[REG_EIP]);
739 sample.sp = reinterpret_cast<Address>(mcontext.gregs[REG_ESP]); 742 sample.sp = reinterpret_cast<Address>(mcontext.gregs[REG_ESP]);
740 sample.fp = reinterpret_cast<Address>(mcontext.gregs[REG_EBP]); 743 sample.fp = reinterpret_cast<Address>(mcontext.gregs[REG_EBP]);
741 #elif V8_HOST_ARCH_X64 744 #elif V8_HOST_ARCH_X64
(...skipping 12 matching lines...) Expand all
754 sample.fp = reinterpret_cast<Address>(mcontext.arm_fp); 757 sample.fp = reinterpret_cast<Address>(mcontext.arm_fp);
755 #endif 758 #endif
756 #elif V8_HOST_ARCH_MIPS 759 #elif V8_HOST_ARCH_MIPS
757 // Implement this on MIPS. 760 // Implement this on MIPS.
758 UNIMPLEMENTED(); 761 UNIMPLEMENTED();
759 #endif 762 #endif
760 if (IsVmThread()) 763 if (IsVmThread())
761 active_sampler_->SampleStack(&sample); 764 active_sampler_->SampleStack(&sample);
762 } 765 }
763 766
764 // We always sample the VM state.
765 sample.state = Logger::state();
766
767 active_sampler_->Tick(&sample); 767 active_sampler_->Tick(&sample);
768 #endif 768 #endif
769 } 769 }
770 770
771 771
772 class Sampler::PlatformData : public Malloced { 772 class Sampler::PlatformData : public Malloced {
773 public: 773 public:
774 PlatformData() { 774 PlatformData() {
775 signal_handler_installed_ = false; 775 signal_handler_installed_ = false;
776 } 776 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 831
832 // This sampler is no longer the active sampler. 832 // This sampler is no longer the active sampler.
833 active_sampler_ = NULL; 833 active_sampler_ = NULL;
834 active_ = false; 834 active_ = false;
835 } 835 }
836 836
837 837
838 #endif // ENABLE_LOGGING_AND_PROFILING 838 #endif // ENABLE_LOGGING_AND_PROFILING
839 839
840 } } // namespace v8::internal 840 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/platform-freebsd.cc ('k') | src/platform-macos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698