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/compiler-dispatcher/compiler-dispatcher-job.h" | 8 #include "src/compiler-dispatcher/compiler-dispatcher-job.h" |
9 #include "src/flags.h" | 9 #include "src/flags.h" |
10 #include "src/handles.h" | 10 #include "src/handles.h" |
11 #include "src/objects-inl.h" | 11 #include "src/objects-inl.h" |
12 #include "test/unittests/compiler-dispatcher/compiler-dispatcher-helper.h" | 12 #include "test/unittests/compiler-dispatcher/compiler-dispatcher-helper.h" |
13 #include "test/unittests/test-utils.h" | 13 #include "test/unittests/test-utils.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
15 | 15 |
16 namespace v8 { | 16 namespace v8 { |
17 namespace internal { | 17 namespace internal { |
18 | 18 |
19 typedef TestWithContext CompilerDispatcherTest; | 19 class CompilerDispatcherTest : public TestWithContext { |
| 20 public: |
| 21 CompilerDispatcherTest() = default; |
| 22 ~CompilerDispatcherTest() override = default; |
| 23 |
| 24 static void SetUpTestCase() { |
| 25 old_flag_ = i::FLAG_ignition; |
| 26 i::FLAG_ignition = true; |
| 27 i::FLAG_compiler_dispatcher = true; |
| 28 TestWithContext::SetUpTestCase(); |
| 29 } |
| 30 |
| 31 static void TearDownTestCase() { |
| 32 TestWithContext::TearDownTestCase(); |
| 33 i::FLAG_ignition = old_flag_; |
| 34 } |
| 35 |
| 36 private: |
| 37 static bool old_flag_; |
| 38 |
| 39 DISALLOW_COPY_AND_ASSIGN(CompilerDispatcherTest); |
| 40 }; |
| 41 |
| 42 bool CompilerDispatcherTest::old_flag_; |
20 | 43 |
21 namespace { | 44 namespace { |
22 | 45 |
23 class MockPlatform : public v8::Platform { | 46 class MockPlatform : public v8::Platform { |
24 public: | 47 public: |
25 MockPlatform() : task_(nullptr), time_(0.0), time_step_(0.0) {} | 48 MockPlatform() : task_(nullptr), time_(0.0), time_step_(0.0) {} |
26 ~MockPlatform() override = default; | 49 ~MockPlatform() override = default; |
27 | 50 |
28 void CallOnBackgroundThread(Task* task, | 51 void CallOnBackgroundThread(Task* task, |
29 ExpectedRuntime expected_runtime) override { | 52 ExpectedRuntime expected_runtime) override { |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 // to finish compiling the function. | 221 // to finish compiling the function. |
199 platform.RunIdleTask(1000.0, 0.0); | 222 platform.RunIdleTask(1000.0, 0.0); |
200 | 223 |
201 ASSERT_FALSE(dispatcher.IsEnqueued(shared)); | 224 ASSERT_FALSE(dispatcher.IsEnqueued(shared)); |
202 ASSERT_FALSE(shared->is_compiled()); | 225 ASSERT_FALSE(shared->is_compiled()); |
203 ASSERT_FALSE(try_catch.HasCaught()); | 226 ASSERT_FALSE(try_catch.HasCaught()); |
204 } | 227 } |
205 | 228 |
206 } // namespace internal | 229 } // namespace internal |
207 } // namespace v8 | 230 } // namespace v8 |
OLD | NEW |