Chromium Code Reviews| Index: src/compiler-dispatcher/compiler-dispatcher.h |
| diff --git a/src/compiler-dispatcher/compiler-dispatcher.h b/src/compiler-dispatcher/compiler-dispatcher.h |
| index e6737a002945175bcaaefd3bcf6d25bec2232edc..ef8e70067cec6fa24f36a4fc4f6cf4508eb05bfd 100644 |
| --- a/src/compiler-dispatcher/compiler-dispatcher.h |
| +++ b/src/compiler-dispatcher/compiler-dispatcher.h |
| @@ -5,14 +5,21 @@ |
| #ifndef V8_COMPILER_DISPATCHER_COMPILER_DISPATCHER_H_ |
| #define V8_COMPILER_DISPATCHER_COMPILER_DISPATCHER_H_ |
| +#include <functional> |
| #include <map> |
| #include <memory> |
| +#include <unordered_set> |
| #include <utility> |
| +#include "src/base/functional.h" |
| #include "src/base/macros.h" |
| #include "src/globals.h" |
| +#include "testing/gtest/include/gtest/gtest_prod.h" |
| namespace v8 { |
| + |
| +class Platform; |
| + |
| namespace internal { |
| class CompilerDispatcherJob; |
| @@ -27,7 +34,8 @@ class V8_EXPORT_PRIVATE CompilerDispatcher { |
| public: |
| enum class BlockingBehavior { kBlock, kDontBlock }; |
| - CompilerDispatcher(Isolate* isolate, size_t max_stack_size); |
| + CompilerDispatcher(Isolate* isolate, Platform* platform, |
| + size_t max_stack_size); |
| ~CompilerDispatcher(); |
| // Returns true if a job was enqueued. |
| @@ -47,19 +55,45 @@ class V8_EXPORT_PRIVATE CompilerDispatcher { |
| void AbortAll(BlockingBehavior blocking); |
| private: |
| + FRIEND_TEST(CompilerDispatcherTest, IdleTaskSmallIdleTime); |
| + |
| typedef std::multimap<std::pair<int, int>, |
| std::unique_ptr<CompilerDispatcherJob>> |
|
vogelheim
2016/12/15 15:24:12
nitpick: Maybe typedef std::unordered_set<JobMap::
jochen (gone - plz use gerrit)
2016/12/15 15:37:59
done
|
| JobMap; |
| + class IdleTask; |
| + struct JobIteratorHash { |
| + public: |
| + size_t operator()(const JobMap::const_iterator& it) const { |
| + std::hash<int> hasher; |
|
vogelheim
2016/12/15 15:24:12
Why std::hash<int>, and not v8::base::hash<int>?
jochen (gone - plz use gerrit)
2016/12/15 15:37:59
no reason, fixed
|
| + return base::hash_combine(hasher(it->first.first), |
| + hasher(it->first.second)); |
| + } |
| + }; |
| + |
| JobMap::const_iterator GetJobFor(Handle<SharedFunctionInfo> shared) const; |
| + void ScheduleIdleTaskIfNeeded(); |
| + void DoIdleWork(double deadline_in_seconds); |
| + void DoIdleWorkForJobSet( |
| + double deadline_in_seconds, |
| + std::unordered_set<JobMap::const_iterator, JobIteratorHash>* job_set); |
| + void ClassifyJob(JobMap::const_iterator it); |
| Isolate* isolate_; |
| + Platform* platform_; |
| size_t max_stack_size_; |
| std::unique_ptr<CompilerDispatcherTracer> tracer_; |
| + bool idle_task_scheduled_; |
| + |
| // Mapping from (script id, function literal id) to job. We use a multimap, |
| // as script id is not necessarily unique. |
| JobMap jobs_; |
| + std::unordered_set<JobMap::const_iterator, JobIteratorHash> |
| + jobs_for_main_thread_; |
| + std::unordered_set<JobMap::const_iterator, JobIteratorHash> |
| + jobs_for_background_thread_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(CompilerDispatcher); |
| }; |