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

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

Issue 2866008: [Isolates] Move contents of Top into Isolate.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: ensure we're synced Created 10 years, 6 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/parser.cc ('k') | src/profile-generator.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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 #endif // def __GLIBC__ 49 #endif // def __GLIBC__
50 #include <strings.h> // index 50 #include <strings.h> // index
51 #include <errno.h> 51 #include <errno.h>
52 #include <stdarg.h> 52 #include <stdarg.h>
53 53
54 #undef MAP_TYPE 54 #undef MAP_TYPE
55 55
56 #include "v8.h" 56 #include "v8.h"
57 57
58 #include "platform.h" 58 #include "platform.h"
59 #include "top.h"
60 #include "v8threads.h" 59 #include "v8threads.h"
61 60
62 61
63 namespace v8 { 62 namespace v8 {
64 namespace internal { 63 namespace internal {
65 64
66 // 0 is never a valid thread id on Linux since tids and pids share a 65 // 0 is never a valid thread id on Linux since tids and pids share a
67 // name space and pid 0 is reserved (see man 2 kill). 66 // name space and pid 0 is reserved (see man 2 kill).
68 static const pthread_t kNoThread = (pthread_t) 0; 67 static const pthread_t kNoThread = (pthread_t) 0;
69 68
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 // So, if the signal is being handled in the context of a non-VM thread, 724 // So, if the signal is being handled in the context of a non-VM thread,
726 // it means that the VM thread is running, and trying to sample its stack can 725 // it means that the VM thread is running, and trying to sample its stack can
727 // cause a crash. 726 // cause a crash.
728 static inline bool IsVmThread() { 727 static inline bool IsVmThread() {
729 // In the case of a single VM thread, this check is enough. 728 // In the case of a single VM thread, this check is enough.
730 if (pthread_equal(pthread_self(), vm_thread_)) return true; 729 if (pthread_equal(pthread_self(), vm_thread_)) return true;
731 // If there are multiple threads that use VM, they must have a thread id 730 // If there are multiple threads that use VM, they must have a thread id
732 // stored in TLS. To verify that the thread is really executing VM, 731 // stored in TLS. To verify that the thread is really executing VM,
733 // we check Top's data. Having that ThreadManager::RestoreThread first 732 // we check Top's data. Having that ThreadManager::RestoreThread first
734 // restores ThreadLocalTop from TLS, and only then erases the TLS value, 733 // restores ThreadLocalTop from TLS, and only then erases the TLS value,
735 // reading Top::thread_id() should not be affected by races. 734 // reading Isolate::thread_id() should not be affected by races.
736 if (ThreadManager::HasId() && !ThreadManager::IsArchived() && 735 if (ThreadManager::HasId() && !ThreadManager::IsArchived() &&
737 ThreadManager::CurrentId() == Top::thread_id()) { 736 ThreadManager::CurrentId() == Isolate::Current()->thread_id()) {
738 return true; 737 return true;
739 } 738 }
740 return false; 739 return false;
741 } 740 }
742 741
743 742
744 static void ProfilerSignalHandler(int signal, siginfo_t* info, void* context) { 743 static void ProfilerSignalHandler(int signal, siginfo_t* info, void* context) {
745 #ifndef V8_HOST_ARCH_MIPS 744 #ifndef V8_HOST_ARCH_MIPS
746 USE(info); 745 USE(info);
747 if (signal != SIGPROF) return; 746 if (signal != SIGPROF) return;
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 852
854 // This sampler is no longer the active sampler. 853 // This sampler is no longer the active sampler.
855 active_sampler_ = NULL; 854 active_sampler_ = NULL;
856 active_ = false; 855 active_ = false;
857 } 856 }
858 857
859 858
860 #endif // ENABLE_LOGGING_AND_PROFILING 859 #endif // ENABLE_LOGGING_AND_PROFILING
861 860
862 } } // namespace v8::internal 861 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/parser.cc ('k') | src/profile-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698