OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/compiler-dispatcher.h" | 5 #include "src/compiler-dispatcher/compiler-dispatcher.h" |
6 | 6 |
7 #include "include/v8-platform.h" | 7 #include "include/v8-platform.h" |
8 #include "src/base/platform/semaphore.h" | 8 #include "src/base/platform/semaphore.h" |
9 #include "src/compiler-dispatcher/compiler-dispatcher-job.h" | 9 #include "src/compiler-dispatcher/compiler-dispatcher-job.h" |
10 #include "src/compiler-dispatcher/compiler-dispatcher-tracer.h" | 10 #include "src/compiler-dispatcher/compiler-dispatcher-tracer.h" |
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
790 | 790 |
791 // Since the AbortAll() call is made from a task, AbortAll thinks that there | 791 // Since the AbortAll() call is made from a task, AbortAll thinks that there |
792 // is at least one task running, and fires of an AbortTask to be safe. | 792 // is at least one task running, and fires of an AbortTask to be safe. |
793 ASSERT_TRUE(platform.ForegroundTasksPending()); | 793 ASSERT_TRUE(platform.ForegroundTasksPending()); |
794 platform.RunForegroundTasks(); | 794 platform.RunForegroundTasks(); |
795 ASSERT_FALSE(platform.ForegroundTasksPending()); | 795 ASSERT_FALSE(platform.ForegroundTasksPending()); |
796 | 796 |
797 platform.ClearIdleTask(); | 797 platform.ClearIdleTask(); |
798 } | 798 } |
799 | 799 |
| 800 TEST_F(CompilerDispatcherTest, EnqueueAndStep) { |
| 801 MockPlatform platform; |
| 802 CompilerDispatcher dispatcher(i_isolate(), &platform, FLAG_stack_size); |
| 803 |
| 804 const char script[] = |
| 805 "function g() { var y = 1; function f16(x) { return x * y }; return f16; " |
| 806 "} g();"; |
| 807 Handle<JSFunction> f = Handle<JSFunction>::cast(RunJS(isolate(), script)); |
| 808 Handle<SharedFunctionInfo> shared(f->shared(), i_isolate()); |
| 809 |
| 810 ASSERT_FALSE(dispatcher.IsEnqueued(shared)); |
| 811 ASSERT_TRUE(dispatcher.EnqueueAndStep(shared)); |
| 812 ASSERT_TRUE(dispatcher.IsEnqueued(shared)); |
| 813 |
| 814 ASSERT_TRUE(dispatcher.jobs_.begin()->second->status() == |
| 815 CompileJobStatus::kReadyToParse); |
| 816 |
| 817 ASSERT_TRUE(platform.IdleTaskPending()); |
| 818 platform.ClearIdleTask(); |
| 819 ASSERT_FALSE(platform.BackgroundTasksPending()); |
| 820 } |
| 821 |
800 } // namespace internal | 822 } // namespace internal |
801 } // namespace v8 | 823 } // namespace v8 |
OLD | NEW |