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

Unified Diff: src/platform.h

Issue 6685088: Merge isolates to bleeding_edge. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/parser.cc ('k') | src/platform-cygwin.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/platform.h
===================================================================
--- src/platform.h (revision 7267)
+++ src/platform.h (working copy)
@@ -177,7 +177,7 @@
static bool Remove(const char* path);
// Log file open mode is platform-dependent due to line ends issues.
- static const char* LogFileOpenMode;
+ static const char* const LogFileOpenMode;
// Print output to console. This is mostly used for debugging output.
// On platforms that has standard terminal output, the output
@@ -388,9 +388,9 @@
LOCAL_STORAGE_KEY_MAX_VALUE = kMaxInt
};
- // Create new thread.
- Thread();
- explicit Thread(const char* name);
+ // Create new thread (with a value for storing in the TLS isolate field).
+ explicit Thread(Isolate* isolate);
+ Thread(Isolate* isolate, const char* name);
virtual ~Thread();
// Start new thread by calling the Run() method in the new thread.
@@ -424,6 +424,8 @@
// A hint to the scheduler to let another thread run.
static void YieldCPU();
+ Isolate* isolate() const { return isolate_; }
+
// The thread name length is limited to 16 based on Linux's implementation of
// prctl().
static const int kMaxThreadNameLength = 16;
@@ -432,7 +434,7 @@
class PlatformData;
PlatformData* data_;
-
+ Isolate* isolate_;
char name_[kMaxThreadNameLength];
DISALLOW_COPY_AND_ASSIGN(Thread);
@@ -466,13 +468,14 @@
// ----------------------------------------------------------------------------
-// ScopedLock
+// ScopedLock/ScopedUnlock
//
-// Stack-allocated ScopedLocks provide block-scoped locking and unlocking
-// of a mutex.
+// Stack-allocated ScopedLocks/ScopedUnlocks provide block-scoped
+// locking and unlocking of a mutex.
class ScopedLock {
public:
explicit ScopedLock(Mutex* mutex): mutex_(mutex) {
+ ASSERT(mutex_ != NULL);
mutex_->Lock();
}
~ScopedLock() {
@@ -583,9 +586,11 @@
class Sampler {
public:
// Initialize sampler.
- explicit Sampler(int interval);
+ Sampler(Isolate* isolate, int interval);
virtual ~Sampler();
+ int interval() const { return interval_; }
+
// Performs stack sampling.
void SampleStack(TickSample* sample) {
DoSampleStack(sample);
@@ -608,6 +613,8 @@
// Whether the sampler is running (that is, consumes resources).
bool IsActive() const { return NoBarrier_Load(&active_); }
+ Isolate* isolate() { return isolate_; }
+
// Used in tests to make sure that stack sampling is performed.
int samples_taken() const { return samples_taken_; }
void ResetSamplesTaken() { samples_taken_ = 0; }
@@ -615,6 +622,8 @@
class PlatformData;
PlatformData* data() { return data_; }
+ PlatformData* platform_data() { return data_; }
+
protected:
virtual void DoSampleStack(TickSample* sample) = 0;
@@ -622,6 +631,7 @@
void SetActive(bool value) { NoBarrier_Store(&active_, value); }
void IncSamplesTaken() { if (++samples_taken_ < 0) samples_taken_ = 0; }
+ Isolate* isolate_;
const int interval_;
Atomic32 profiling_;
Atomic32 active_;
@@ -630,6 +640,7 @@
DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler);
};
+
#endif // ENABLE_LOGGING_AND_PROFILING
} } // namespace v8::internal
« no previous file with comments | « src/parser.cc ('k') | src/platform-cygwin.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698