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

Unified Diff: src/libplatform/worker-thread.cc

Issue 104583003: [platform] Implement a worker pool (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: updates Created 7 years 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/libplatform/worker-thread.h ('k') | src/v8.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/libplatform/worker-thread.cc
diff --git a/src/hydrogen-bch.h b/src/libplatform/worker-thread.cc
similarity index 79%
copy from src/hydrogen-bch.h
copy to src/libplatform/worker-thread.cc
index a22dacdd4229748e2735b3c0d8519c927b2f617d..cca8a9719a88d953a9d05d770e5aa6478a563e6a 100644
--- a/src/hydrogen-bch.h
+++ b/src/libplatform/worker-thread.cc
@@ -25,31 +25,32 @@
// (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_HYDROGEN_BCH_H_
-#define V8_HYDROGEN_BCH_H_
+#include "worker-thread.h"
-#include "hydrogen.h"
+// TODO(jochen): We should have our own version of checks.h.
+#include "../checks.h"
+#include "../../include/v8-platform.h"
+#include "task-queue.h"
namespace v8 {
namespace internal {
+WorkerThread::WorkerThread(TaskQueue* queue)
+ : Thread("V8 WorkerThread"), queue_(queue) {
+ Start();
+}
-class HBoundsCheckHoistingPhase : public HPhase {
- public:
- explicit HBoundsCheckHoistingPhase(HGraph* graph)
- : HPhase("H_Bounds checks hoisting", graph) { }
- void Run() {
- HoistRedundantBoundsChecks();
- }
-
- private:
- void HoistRedundantBoundsChecks();
+WorkerThread::~WorkerThread() {
+ Join();
+}
- DISALLOW_COPY_AND_ASSIGN(HBoundsCheckHoistingPhase);
-};
+void WorkerThread::Run() {
+ while (Task* task = queue_->GetNext()) {
+ task->Run();
+ delete task;
+ }
+}
} } // namespace v8::internal
-
-#endif // V8_HYDROGEN_BCE_H_
« no previous file with comments | « src/libplatform/worker-thread.h ('k') | src/v8.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698