| 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_compiler_dispatcher = true; |
| 27 TestWithContext::SetUpTestCase(); |
| 28 } |
| 29 |
| 30 static void TearDownTestCase() { |
| 31 TestWithContext::TearDownTestCase(); |
| 32 i::FLAG_compiler_dispatcher = old_flag_; |
| 33 } |
| 34 |
| 35 private: |
| 36 static bool old_flag_; |
| 37 |
| 38 DISALLOW_COPY_AND_ASSIGN(CompilerDispatcherTest); |
| 39 }; |
| 40 |
| 41 bool CompilerDispatcherTest::old_flag_; |
| 20 | 42 |
| 21 namespace { | 43 namespace { |
| 22 | 44 |
| 23 class MockPlatform : public v8::Platform { | 45 class MockPlatform : public v8::Platform { |
| 24 public: | 46 public: |
| 25 MockPlatform() : task_(nullptr), time_(0.0), time_step_(0.0) {} | 47 MockPlatform() : task_(nullptr), time_(0.0), time_step_(0.0) {} |
| 26 ~MockPlatform() override = default; | 48 ~MockPlatform() override = default; |
| 27 | 49 |
| 28 void CallOnBackgroundThread(Task* task, | 50 void CallOnBackgroundThread(Task* task, |
| 29 ExpectedRuntime expected_runtime) override { | 51 ExpectedRuntime expected_runtime) override { |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 // to finish compiling the function. | 220 // to finish compiling the function. |
| 199 platform.RunIdleTask(1000.0, 0.0); | 221 platform.RunIdleTask(1000.0, 0.0); |
| 200 | 222 |
| 201 ASSERT_FALSE(dispatcher.IsEnqueued(shared)); | 223 ASSERT_FALSE(dispatcher.IsEnqueued(shared)); |
| 202 ASSERT_FALSE(shared->is_compiled()); | 224 ASSERT_FALSE(shared->is_compiled()); |
| 203 ASSERT_FALSE(try_catch.HasCaught()); | 225 ASSERT_FALSE(try_catch.HasCaught()); |
| 204 } | 226 } |
| 205 | 227 |
| 206 } // namespace internal | 228 } // namespace internal |
| 207 } // namespace v8 | 229 } // namespace v8 |
| OLD | NEW |