| 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 class CompilerDispatcherTest : public TestWithContext { | 19 typedef TestWithContext CompilerDispatcherTest; |
| 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_; | |
| 43 | 20 |
| 44 namespace { | 21 namespace { |
| 45 | 22 |
| 46 class MockPlatform : public v8::Platform { | 23 class MockPlatform : public v8::Platform { |
| 47 public: | 24 public: |
| 48 MockPlatform() : task_(nullptr), time_(0.0), time_step_(0.0) {} | 25 MockPlatform() : task_(nullptr), time_(0.0), time_step_(0.0) {} |
| 49 ~MockPlatform() override = default; | 26 ~MockPlatform() override = default; |
| 50 | 27 |
| 51 void CallOnBackgroundThread(Task* task, | 28 void CallOnBackgroundThread(Task* task, |
| 52 ExpectedRuntime expected_runtime) override { | 29 ExpectedRuntime expected_runtime) override { |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 // to finish compiling the function. | 198 // to finish compiling the function. |
| 222 platform.RunIdleTask(1000.0, 0.0); | 199 platform.RunIdleTask(1000.0, 0.0); |
| 223 | 200 |
| 224 ASSERT_FALSE(dispatcher.IsEnqueued(shared)); | 201 ASSERT_FALSE(dispatcher.IsEnqueued(shared)); |
| 225 ASSERT_FALSE(shared->is_compiled()); | 202 ASSERT_FALSE(shared->is_compiled()); |
| 226 ASSERT_FALSE(try_catch.HasCaught()); | 203 ASSERT_FALSE(try_catch.HasCaught()); |
| 227 } | 204 } |
| 228 | 205 |
| 229 } // namespace internal | 206 } // namespace internal |
| 230 } // namespace v8 | 207 } // namespace v8 |
| OLD | NEW |