Distinquish TestWithIsolateAndZone from TestWithZone
authordanno <danno@chromium.org>
Fri, 23 Jan 2015 16:29:50 +0000 (08:29 -0800)
committerCommit bot <commit-bot@chromium.org>
Fri, 23 Jan 2015 16:29:57 +0000 (16:29 +0000)
Allows unit tests that just need a zone and no isolate to avoid the overhead of
creating one.

R=mstarzinger@chromium.org
LOG=N

Review URL: https://codereview.chromium.org/871843004

Cr-Commit-Position: refs/heads/master@{#26256}

test/unittests/compiler/graph-unittest.h
test/unittests/compiler/instruction-selector-unittest.h
test/unittests/compiler/instruction-sequence-unittest.h
test/unittests/compiler/schedule-unittest.cc
test/unittests/test-utils.cc
test/unittests/test-utils.h

index 0ab81a7..217c44d 100644 (file)
@@ -26,7 +26,7 @@ namespace compiler {
 using ::testing::Matcher;
 
 
-class GraphTest : public TestWithContext, public TestWithZone {
+class GraphTest : public TestWithContext, public TestWithIsolateAndZone {
  public:
   explicit GraphTest(int num_parameters = 1);
   ~GraphTest() OVERRIDE;
index 408f326..983e5c0 100644 (file)
@@ -18,7 +18,8 @@ namespace v8 {
 namespace internal {
 namespace compiler {
 
-class InstructionSelectorTest : public TestWithContext, public TestWithZone {
+class InstructionSelectorTest : public TestWithContext,
+                                public TestWithIsolateAndZone {
  public:
   InstructionSelectorTest();
   ~InstructionSelectorTest() OVERRIDE;
index ce0a5b4..9ce1cc3 100644 (file)
@@ -13,7 +13,7 @@ namespace v8 {
 namespace internal {
 namespace compiler {
 
-class InstructionSequenceTest : public TestWithZone {
+class InstructionSequenceTest : public TestWithIsolateAndZone {
  public:
   static const int kDefaultNRegs = 4;
   static const int kNoValue = kMinInt;
index 22debd3..70fd4d5 100644 (file)
@@ -13,7 +13,7 @@ namespace v8 {
 namespace internal {
 namespace compiler {
 
-typedef TestWithZone BasicBlockTest;
+typedef TestWithIsolateAndZone BasicBlockTest;
 
 
 TEST_F(BasicBlockTest, Constructor) {
index 31d724a..5d1c1f1 100644 (file)
@@ -94,6 +94,7 @@ namespace internal {
 
 TestWithIsolate::~TestWithIsolate() {}
 
+TestWithIsolateAndZone::~TestWithIsolateAndZone() {}
 
 Factory* TestWithIsolate::factory() const { return isolate()->factory(); }
 
index 718fd5a..765b97d 100644 (file)
@@ -90,7 +90,7 @@ class TestWithIsolate : public virtual ::v8::TestWithIsolate {
 };
 
 
-class TestWithZone : public TestWithIsolate {
+class TestWithZone : public virtual ::testing::Test {
  public:
   TestWithZone() {}
   virtual ~TestWithZone();
@@ -103,6 +103,21 @@ class TestWithZone : public TestWithIsolate {
   DISALLOW_COPY_AND_ASSIGN(TestWithZone);
 };
 
+
+class TestWithIsolateAndZone : public virtual TestWithIsolate {
+ public:
+  TestWithIsolateAndZone() {}
+  virtual ~TestWithIsolateAndZone();
+
+  Zone* zone() { return &zone_; }
+
+ private:
+  Zone zone_;
+
+  DISALLOW_COPY_AND_ASSIGN(TestWithIsolateAndZone);
+};
+
+
 }  // namespace internal
 }  // namespace v8