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

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

Issue 13704002: Minor Native Client specific changes to files in src. (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Cleaner disabling of profiling. Created 7 years, 8 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
« no previous file with comments | « src/ia32/cpu-ia32.cc ('k') | src/platform-posix.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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 421
422 void OS::DebugBreak() { 422 void OS::DebugBreak() {
423 // TODO(lrn): Introduce processor define for runtime system (!= V8_ARCH_x, 423 // TODO(lrn): Introduce processor define for runtime system (!= V8_ARCH_x,
424 // which is the architecture of generated code). 424 // which is the architecture of generated code).
425 #if (defined(__arm__) || defined(__thumb__)) 425 #if (defined(__arm__) || defined(__thumb__))
426 # if defined(CAN_USE_ARMV5_INSTRUCTIONS) 426 # if defined(CAN_USE_ARMV5_INSTRUCTIONS)
427 asm("bkpt 0"); 427 asm("bkpt 0");
428 # endif 428 # endif
429 #elif defined(__mips__) 429 #elif defined(__mips__)
430 asm("break"); 430 asm("break");
431 #elif defined(__native_client__)
432 asm("hlt");
431 #else 433 #else
432 asm("int $3"); 434 asm("int $3");
433 #endif 435 #endif
434 } 436 }
435 437
436 438
437 void OS::DumpBacktrace() { 439 void OS::DumpBacktrace() {
438 #if defined(__GLIBC__) 440 #if defined(__GLIBC__)
439 void* trace[100]; 441 void* trace[100];
440 int size = backtrace(trace, ARRAY_SIZE(trace)); 442 int size = backtrace(trace, ARRAY_SIZE(trace));
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 817
816 818
817 void Thread::set_name(const char* name) { 819 void Thread::set_name(const char* name) {
818 strncpy(name_, name, sizeof(name_)); 820 strncpy(name_, name, sizeof(name_));
819 name_[sizeof(name_) - 1] = '\0'; 821 name_[sizeof(name_) - 1] = '\0';
820 } 822 }
821 823
822 824
823 void Thread::Start() { 825 void Thread::Start() {
824 pthread_attr_t* attr_ptr = NULL; 826 pthread_attr_t* attr_ptr = NULL;
827 #if defined(__native_client__)
828 // use default stack size.
829 #else
825 pthread_attr_t attr; 830 pthread_attr_t attr;
826 if (stack_size_ > 0) { 831 if (stack_size_ > 0) {
827 pthread_attr_init(&attr); 832 pthread_attr_init(&attr);
828 pthread_attr_setstacksize(&attr, static_cast<size_t>(stack_size_)); 833 pthread_attr_setstacksize(&attr, static_cast<size_t>(stack_size_));
829 attr_ptr = &attr; 834 attr_ptr = &attr;
830 } 835 }
836 #endif
831 int result = pthread_create(&data_->thread_, attr_ptr, ThreadEntry, this); 837 int result = pthread_create(&data_->thread_, attr_ptr, ThreadEntry, this);
832 CHECK_EQ(0, result); 838 CHECK_EQ(0, result);
833 ASSERT(data_->thread_ != kNoThread); 839 ASSERT(data_->thread_ != kNoThread);
834 } 840 }
835 841
836 842
837 void Thread::Join() { 843 void Thread::Join() {
838 pthread_join(data_->thread_, NULL); 844 pthread_join(data_->thread_, NULL);
839 } 845 }
840 846
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
1067 // Android's C library provides gettid(2). 1073 // Android's C library provides gettid(2).
1068 return gettid(); 1074 return gettid();
1069 #else 1075 #else
1070 // Glibc doesn't provide a wrapper for gettid(2). 1076 // Glibc doesn't provide a wrapper for gettid(2).
1071 return syscall(SYS_gettid); 1077 return syscall(SYS_gettid);
1072 #endif 1078 #endif
1073 } 1079 }
1074 1080
1075 1081
1076 static void ProfilerSignalHandler(int signal, siginfo_t* info, void* context) { 1082 static void ProfilerSignalHandler(int signal, siginfo_t* info, void* context) {
1083 #if defined(__native_client__)
1084 // As Native Client does not support signal handling, profiling
1085 // is disabled.
1086 return;
1087 #else
1077 USE(info); 1088 USE(info);
1078 if (signal != SIGPROF) return; 1089 if (signal != SIGPROF) return;
1079 Isolate* isolate = Isolate::UncheckedCurrent(); 1090 Isolate* isolate = Isolate::UncheckedCurrent();
1080 if (isolate == NULL || !isolate->IsInitialized() || !isolate->IsInUse()) { 1091 if (isolate == NULL || !isolate->IsInitialized() || !isolate->IsInUse()) {
1081 // We require a fully initialized and entered isolate. 1092 // We require a fully initialized and entered isolate.
1082 return; 1093 return;
1083 } 1094 }
1084 if (v8::Locker::IsActive() && 1095 if (v8::Locker::IsActive() &&
1085 !isolate->thread_manager()->IsLockedByCurrentThread()) { 1096 !isolate->thread_manager()->IsLockedByCurrentThread()) {
1086 return; 1097 return;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1119 sample->fp = reinterpret_cast<Address>(mcontext.arm_fp); 1130 sample->fp = reinterpret_cast<Address>(mcontext.arm_fp);
1120 #endif // defined(__GLIBC__) && !defined(__UCLIBC__) && 1131 #endif // defined(__GLIBC__) && !defined(__UCLIBC__) &&
1121 // (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 3)) 1132 // (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 3))
1122 #elif V8_HOST_ARCH_MIPS 1133 #elif V8_HOST_ARCH_MIPS
1123 sample->pc = reinterpret_cast<Address>(mcontext.pc); 1134 sample->pc = reinterpret_cast<Address>(mcontext.pc);
1124 sample->sp = reinterpret_cast<Address>(mcontext.gregs[29]); 1135 sample->sp = reinterpret_cast<Address>(mcontext.gregs[29]);
1125 sample->fp = reinterpret_cast<Address>(mcontext.gregs[30]); 1136 sample->fp = reinterpret_cast<Address>(mcontext.gregs[30]);
1126 #endif // V8_HOST_ARCH_* 1137 #endif // V8_HOST_ARCH_*
1127 sampler->SampleStack(sample); 1138 sampler->SampleStack(sample);
1128 sampler->Tick(sample); 1139 sampler->Tick(sample);
1140 #endif // __native_client__
1129 } 1141 }
1130 1142
1131 1143
1132 class Sampler::PlatformData : public Malloced { 1144 class Sampler::PlatformData : public Malloced {
1133 public: 1145 public:
1134 PlatformData() : vm_tid_(GetThreadID()) {} 1146 PlatformData() : vm_tid_(GetThreadID()) {}
1135 1147
1136 int vm_tid() const { return vm_tid_; } 1148 int vm_tid() const { return vm_tid_; }
1137 1149
1138 private: 1150 private:
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
1327 1339
1328 1340
1329 void Sampler::Stop() { 1341 void Sampler::Stop() {
1330 ASSERT(IsActive()); 1342 ASSERT(IsActive());
1331 SignalSender::RemoveActiveSampler(this); 1343 SignalSender::RemoveActiveSampler(this);
1332 SetActive(false); 1344 SetActive(false);
1333 } 1345 }
1334 1346
1335 1347
1336 } } // namespace v8::internal 1348 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ia32/cpu-ia32.cc ('k') | src/platform-posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698