Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(383)

Side by Side Diff: test/unittests/compiler-dispatcher/compiler-dispatcher-unittest.cc

Issue 2610173004: Add ability to enqueue SharedFunctionInfos so they can run on bg threads (Closed)
Patch Set: updates Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler-dispatcher/compiler-dispatcher.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « src/compiler-dispatcher/compiler-dispatcher.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698