| OLD | NEW |
| 1 // Copyright 2017 the V8 project authors. All rights reserved. | 1 // Copyright 2017 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/compiler-dispatcher/optimizing-compile-dispatcher.h" | 5 #include "src/compiler-dispatcher/optimizing-compile-dispatcher.h" |
| 6 | 6 |
| 7 #include "src/base/atomic-utils.h" | 7 #include "src/base/atomic-utils.h" |
| 8 #include "src/base/platform/semaphore.h" | 8 #include "src/base/platform/semaphore.h" |
| 9 #include "src/compilation-info.h" | 9 #include "src/compilation-info.h" |
| 10 #include "src/compiler.h" | 10 #include "src/compiler.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 typedef TestWithContext OptimizingCompileDispatcherTest; | 22 typedef TestWithContext OptimizingCompileDispatcherTest; |
| 23 | 23 |
| 24 namespace { | 24 namespace { |
| 25 | 25 |
| 26 class BlockingCompilationJob : public CompilationJob { | 26 class BlockingCompilationJob : public CompilationJob { |
| 27 public: | 27 public: |
| 28 BlockingCompilationJob(Isolate* isolate, Handle<JSFunction> function) | 28 BlockingCompilationJob(Isolate* isolate, Handle<JSFunction> function) |
| 29 : CompilationJob(isolate, &info_, "BlockingCompilationJob", | 29 : CompilationJob(isolate, &info_, "BlockingCompilationJob", |
| 30 State::kReadyToExecute), | 30 State::kReadyToExecute), |
| 31 parse_info_(handle(function->shared())), | 31 parse_info_(handle(function->shared())), |
| 32 info_(&parse_info_, function), | 32 info_(parse_info_.zone(), &parse_info_, function), |
| 33 blocking_(false), | 33 blocking_(false), |
| 34 semaphore_(0) {} | 34 semaphore_(0) {} |
| 35 ~BlockingCompilationJob() override = default; | 35 ~BlockingCompilationJob() override = default; |
| 36 | 36 |
| 37 bool IsBlocking() const { return blocking_.Value(); } | 37 bool IsBlocking() const { return blocking_.Value(); } |
| 38 void Signal() { semaphore_.Signal(); } | 38 void Signal() { semaphore_.Signal(); } |
| 39 | 39 |
| 40 // CompilationJob implementation. | 40 // CompilationJob implementation. |
| 41 Status PrepareJobImpl() override { | 41 Status PrepareJobImpl() override { |
| 42 UNREACHABLE(); | 42 UNREACHABLE(); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 // Should not block. | 86 // Should not block. |
| 87 dispatcher.Flush(OptimizingCompileDispatcher::BlockingBehavior::kDontBlock); | 87 dispatcher.Flush(OptimizingCompileDispatcher::BlockingBehavior::kDontBlock); |
| 88 | 88 |
| 89 // Unblock the job & finish. | 89 // Unblock the job & finish. |
| 90 job->Signal(); | 90 job->Signal(); |
| 91 dispatcher.Stop(); | 91 dispatcher.Stop(); |
| 92 } | 92 } |
| 93 | 93 |
| 94 } // namespace internal | 94 } // namespace internal |
| 95 } // namespace v8 | 95 } // namespace v8 |
| OLD | NEW |