| Index: src/libplatform/task-queue.h
|
| diff --git a/src/hydrogen-minus-zero.h b/src/libplatform/task-queue.h
|
| similarity index 68%
|
| copy from src/hydrogen-minus-zero.h
|
| copy to src/libplatform/task-queue.h
|
| index d23ec1196b3419cdc06e20aa3e12688979306009..a3182d35311febb984922a8c38ad0730441806d8 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. The queue takes ownership of |task|.
|
| + 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_
|
|
|