2014-08-08 07:04:07 +00:00
|
|
|
// Copyright 2014 the V8 project authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
#ifndef V8_COMPILER_UNITTESTS_COMPILER_UNITTESTS_H_
|
|
|
|
#define V8_COMPILER_UNITTESTS_COMPILER_UNITTESTS_H_
|
|
|
|
|
|
|
|
#include "include/v8.h"
|
|
|
|
#include "src/zone.h"
|
2014-08-14 06:33:50 +00:00
|
|
|
#include "testing/gtest-support.h"
|
2014-08-08 07:04:07 +00:00
|
|
|
|
|
|
|
namespace v8 {
|
|
|
|
namespace internal {
|
|
|
|
namespace compiler {
|
|
|
|
|
2014-08-12 09:48:52 +00:00
|
|
|
// The TARGET_TEST(Case, Name) macro works just like
|
2014-08-08 07:04:07 +00:00
|
|
|
// TEST(Case, Name), except that the test is disabled
|
|
|
|
// if the platform is not a supported TurboFan target.
|
|
|
|
#if V8_TURBOFAN_TARGET
|
2014-08-12 09:48:52 +00:00
|
|
|
#define TARGET_TEST(Case, Name) TEST(Case, Name)
|
2014-08-08 07:04:07 +00:00
|
|
|
#else
|
2014-08-12 09:48:52 +00:00
|
|
|
#define TARGET_TEST(Case, Name) TEST(Case, DISABLED_##Name)
|
2014-08-08 07:04:07 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2014-08-12 09:48:52 +00:00
|
|
|
// The TARGET_TEST_F(Case, Name) macro works just like
|
2014-08-08 07:04:07 +00:00
|
|
|
// TEST_F(Case, Name), except that the test is disabled
|
|
|
|
// if the platform is not a supported TurboFan target.
|
|
|
|
#if V8_TURBOFAN_TARGET
|
2014-08-12 09:48:52 +00:00
|
|
|
#define TARGET_TEST_F(Case, Name) TEST_F(Case, Name)
|
2014-08-08 07:04:07 +00:00
|
|
|
#else
|
2014-08-12 09:48:52 +00:00
|
|
|
#define TARGET_TEST_F(Case, Name) TEST_F(Case, DISABLED_##Name)
|
2014-08-08 07:04:07 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2014-08-19 04:54:06 +00:00
|
|
|
// The TARGET_TEST_P(Case, Name) macro works just like
|
|
|
|
// TEST_P(Case, Name), except that the test is disabled
|
|
|
|
// if the platform is not a supported TurboFan target.
|
|
|
|
#if V8_TURBOFAN_TARGET
|
|
|
|
#define TARGET_TEST_P(Case, Name) TEST_P(Case, Name)
|
|
|
|
#else
|
|
|
|
#define TARGET_TEST_P(Case, Name) TEST_P(Case, DISABLED_##Name)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2014-08-12 09:52:39 +00:00
|
|
|
// The TARGET_TYPED_TEST(Case, Name) macro works just like
|
|
|
|
// TYPED_TEST(Case, Name), except that the test is disabled
|
|
|
|
// if the platform is not a supported TurboFan target.
|
|
|
|
#if V8_TURBOFAN_TARGET
|
|
|
|
#define TARGET_TYPED_TEST(Case, Name) TYPED_TEST(Case, Name)
|
|
|
|
#else
|
|
|
|
#define TARGET_TYPED_TEST(Case, Name) TYPED_TEST(Case, DISABLED_##Name)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2014-08-08 07:04:07 +00:00
|
|
|
class CompilerTest : public ::testing::Test {
|
|
|
|
public:
|
|
|
|
CompilerTest();
|
|
|
|
virtual ~CompilerTest();
|
|
|
|
|
2014-08-18 06:54:07 +00:00
|
|
|
Factory* factory() const;
|
2014-08-08 07:04:07 +00:00
|
|
|
Isolate* isolate() const { return reinterpret_cast<Isolate*>(isolate_); }
|
|
|
|
Zone* zone() { return &zone_; }
|
|
|
|
|
|
|
|
static void SetUpTestCase();
|
|
|
|
static void TearDownTestCase();
|
|
|
|
|
|
|
|
private:
|
|
|
|
static v8::Isolate* isolate_;
|
|
|
|
v8::Isolate::Scope isolate_scope_;
|
|
|
|
v8::HandleScope handle_scope_;
|
|
|
|
v8::Context::Scope context_scope_;
|
|
|
|
Zone zone_;
|
|
|
|
};
|
|
|
|
|
2014-08-19 08:48:41 +00:00
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
class CompilerTestWithParam : public CompilerTest,
|
|
|
|
public ::testing::WithParamInterface<T> {};
|
|
|
|
|
2014-08-08 07:04:07 +00:00
|
|
|
} // namespace compiler
|
|
|
|
} // namespace internal
|
|
|
|
} // namespace v8
|
|
|
|
|
|
|
|
#endif // V8_COMPILER_UNITTESTS_COMPILER_UNITTESTS_H_
|