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

Unified Diff: src/marking-thread.cc

Issue 12047044: Added parallel marking threads. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 11 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
Index: src/marking-thread.cc
diff --git a/src/isolate-inl.h b/src/marking-thread.cc
similarity index 58%
copy from src/isolate-inl.h
copy to src/marking-thread.cc
index 9fb16fbe96d90066a8b9fee8f7af334ec760b7c9..ac6438126891ff0d26e7e021d12bdb43cf9bd817 100644
--- a/src/isolate-inl.h
+++ b/src/marking-thread.cc
@@ -1,4 +1,4 @@
-// Copyright 2011 the V8 project authors. All rights reserved.
+// Copyright 2013 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@@ -25,49 +25,61 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#ifndef V8_ISOLATE_INL_H_
-#define V8_ISOLATE_INL_H_
+#include "marking-thread.h"
-#include "isolate.h"
+#include "v8.h"
-#include "debug.h"
+#include "isolate.h"
+#include "v8threads.h"
namespace v8 {
namespace internal {
+MarkingThread::MarkingThread(Isolate* isolate)
+ : Thread("MarkingThread"),
+ isolate_(isolate),
+ heap_(isolate->heap()),
+ start_marking_semaphore_(OS::CreateSemaphore(0)),
+ end_marking_semaphore_(OS::CreateSemaphore(0)),
+ stop_semaphore_(OS::CreateSemaphore(0)) {
+ NoBarrier_Store(&stop_thread_, static_cast<AtomicWord>(false));
+ id_ = NoBarrier_AtomicIncrement(&id_counter_, 1);
+}
-SaveContext::SaveContext(Isolate* isolate) : prev_(isolate->save_context()) {
- if (isolate->context() != NULL) {
- context_ = Handle<Context>(isolate->context());
-#if __GNUC_VERSION__ >= 40100 && __GNUC_VERSION__ < 40300
- dummy_ = Handle<Context>(isolate->context());
-#endif
- }
- isolate->set_save_context(this);
- c_entry_fp_ = isolate->c_entry_fp(isolate->thread_local_top());
+Atomic32 MarkingThread::id_counter_ = -1;
+
+
+void MarkingThread::Run() {
+ Isolate::SetIsolateThreadLocals(isolate_, NULL);
+
+ while (true) {
+ start_marking_semaphore_->Wait();
+
+ if (Acquire_Load(&stop_thread_)) {
+ stop_semaphore_->Signal();
+ return;
+ }
+
+ end_marking_semaphore_->Signal();
+ }
}
-bool Isolate::IsDebuggerActive() {
-#ifdef ENABLE_DEBUGGER_SUPPORT
- if (!NoBarrier_Load(&debugger_initialized_)) return false;
- return debugger()->IsDebuggerActive();
-#else
- return false;
-#endif
+void MarkingThread::Stop() {
+ Release_Store(&stop_thread_, static_cast<AtomicWord>(true));
+ start_marking_semaphore_->Signal();
+ stop_semaphore_->Wait();
}
-bool Isolate::DebuggerHasBreakPoints() {
-#ifdef ENABLE_DEBUGGER_SUPPORT
- return debug()->has_break_points();
-#else
- return false;
-#endif
+void MarkingThread::StartMarking() {
+ start_marking_semaphore_->Signal();
}
-} } // namespace v8::internal
+void MarkingThread::WaitForMarkingThread() {
+ end_marking_semaphore_->Wait();
+}
-#endif // V8_ISOLATE_INL_H_
+} } // namespace v8::internal
« src/marking-thread.h ('K') | « src/marking-thread.h ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698