Index: src/libplatform/task-queue.h |
diff --git a/src/hydrogen-minus-zero.h b/src/libplatform/task-queue.h |
similarity index 69% |
copy from src/hydrogen-minus-zero.h |
copy to src/libplatform/task-queue.h |
index d23ec1196b3419cdc06e20aa3e12688979306009..b32ccc97eba56194a529a5b47045c693bb2485fd 100644 |
--- a/src/hydrogen-minus-zero.h |
+++ b/src/libplatform/task-queue.h |
@@ -25,32 +25,47 @@ |
// (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_MINUS_ZERO_H_ |
-#define V8_HYDROGEN_MINUS_ZERO_H_ |
+#ifndef V8_LIBPLATFORM_TASK_QUEUE_H_ |
+#define V8_LIBPLATFORM_TASK_QUEUE_H_ |
-#include "hydrogen.h" |
+#include <queue> |
+ |
+// TODO(jochen): We should have our own version of globals.h. |
+#include "../globals.h" |
+#include "../platform/mutex.h" |
+#include "../platform/semaphore.h" |
namespace v8 { |
-namespace internal { |
+class Task; |
-class HComputeMinusZeroChecksPhase : public HPhase { |
+namespace internal { |
+ |
+class TaskQueue { |
public: |
- explicit HComputeMinusZeroChecksPhase(HGraph* graph) |
- : HPhase("H_Compute minus zero checks", graph), |
- visited_(graph->GetMaximumValueID(), zone()) { } |
+ TaskQueue(); |
+ ~TaskQueue(); |
- void Run(); |
+ // Appends a task to the queue. Takes ownership. |
Hannes Payer (out of office)
2013/12/11 12:07:27
You mean the queue takes ownership, right. Can we
|
+ void Append(Task* task); |
- private: |
- void PropagateMinusZeroChecks(HValue* value); |
+ // Returns the next task to process. Blocks if no task is available. Returns |
+ // NULL if the queue is terminated. |
+ Task* GetNext(); |
- BitVector visited_; |
+ // Terminate the queue. |
+ void Terminate(); |
- DISALLOW_COPY_AND_ASSIGN(HComputeMinusZeroChecksPhase); |
-}; |
+ private: |
+ Mutex lock_; |
+ Semaphore process_queue_semaphore_; |
+ std::queue<Task*> task_queue_; |
+ bool terminated_; |
+ DISALLOW_COPY_AND_ASSIGN(TaskQueue); |
+}; |
} } // namespace v8::internal |
-#endif // V8_HYDROGEN_MINUS_ZERO_H_ |
+ |
+#endif // V8_LIBPLATFORM_TASK_QUEUE_H_ |