| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef V8_COMPILER_UNITTESTS_COMPILER_UNITTESTS_H_ | 5 #ifndef V8_COMPILER_COMPILER_TEST_UTILS_H_ |
| 6 #define V8_COMPILER_UNITTESTS_COMPILER_UNITTESTS_H_ | 6 #define V8_COMPILER_COMPILER_TEST_UTILS_H_ |
| 7 | 7 |
| 8 #include "include/v8.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 #include "src/zone.h" | |
| 10 #include "testing/gtest-support.h" | |
| 11 | 9 |
| 12 namespace v8 { | 10 namespace v8 { |
| 13 namespace internal { | 11 namespace internal { |
| 14 | |
| 15 // Forward declarations. | |
| 16 class Factory; | |
| 17 | |
| 18 | |
| 19 namespace compiler { | 12 namespace compiler { |
| 20 | 13 |
| 21 // The TARGET_TEST(Case, Name) macro works just like | 14 // The TARGET_TEST(Case, Name) macro works just like |
| 22 // TEST(Case, Name), except that the test is disabled | 15 // TEST(Case, Name), except that the test is disabled |
| 23 // if the platform is not a supported TurboFan target. | 16 // if the platform is not a supported TurboFan target. |
| 24 #if V8_TURBOFAN_TARGET | 17 #if V8_TURBOFAN_TARGET |
| 25 #define TARGET_TEST(Case, Name) TEST(Case, Name) | 18 #define TARGET_TEST(Case, Name) TEST(Case, Name) |
| 26 #else | 19 #else |
| 27 #define TARGET_TEST(Case, Name) TEST(Case, DISABLED_##Name) | 20 #define TARGET_TEST(Case, Name) TEST(Case, DISABLED_##Name) |
| 28 #endif | 21 #endif |
| (...skipping 21 matching lines...) Expand all Loading... |
| 50 | 43 |
| 51 // The TARGET_TYPED_TEST(Case, Name) macro works just like | 44 // The TARGET_TYPED_TEST(Case, Name) macro works just like |
| 52 // TYPED_TEST(Case, Name), except that the test is disabled | 45 // TYPED_TEST(Case, Name), except that the test is disabled |
| 53 // if the platform is not a supported TurboFan target. | 46 // if the platform is not a supported TurboFan target. |
| 54 #if V8_TURBOFAN_TARGET | 47 #if V8_TURBOFAN_TARGET |
| 55 #define TARGET_TYPED_TEST(Case, Name) TYPED_TEST(Case, Name) | 48 #define TARGET_TYPED_TEST(Case, Name) TYPED_TEST(Case, Name) |
| 56 #else | 49 #else |
| 57 #define TARGET_TYPED_TEST(Case, Name) TYPED_TEST(Case, DISABLED_##Name) | 50 #define TARGET_TYPED_TEST(Case, Name) TYPED_TEST(Case, DISABLED_##Name) |
| 58 #endif | 51 #endif |
| 59 | 52 |
| 60 | |
| 61 class CompilerTest : public ::testing::Test { | |
| 62 public: | |
| 63 CompilerTest(); | |
| 64 virtual ~CompilerTest(); | |
| 65 | |
| 66 Factory* factory() const; | |
| 67 Isolate* isolate() const { return reinterpret_cast<Isolate*>(isolate_); } | |
| 68 Zone* zone() { return &zone_; } | |
| 69 | |
| 70 static void SetUpTestCase(); | |
| 71 static void TearDownTestCase(); | |
| 72 | |
| 73 private: | |
| 74 static v8::Isolate* isolate_; | |
| 75 v8::Isolate::Scope isolate_scope_; | |
| 76 v8::HandleScope handle_scope_; | |
| 77 v8::Context::Scope context_scope_; | |
| 78 Zone zone_; | |
| 79 }; | |
| 80 | |
| 81 | |
| 82 template <typename T> | |
| 83 class CompilerTestWithParam : public CompilerTest, | |
| 84 public ::testing::WithParamInterface<T> {}; | |
| 85 | |
| 86 } // namespace compiler | 53 } // namespace compiler |
| 87 } // namespace internal | 54 } // namespace internal |
| 88 } // namespace v8 | 55 } // namespace v8 |
| 89 | 56 |
| 90 #endif // V8_COMPILER_UNITTESTS_COMPILER_UNITTESTS_H_ | 57 #endif // V8_COMPILER_COMPILER_TEST_UTILS_H_ |
| OLD | NEW |