Chromium Code Reviews| Index: test/unittests/compiler/zone-stats-unittest.cc |
| diff --git a/test/unittests/compiler/zone-pool-unittest.cc b/test/unittests/compiler/zone-stats-unittest.cc |
| similarity index 79% |
| rename from test/unittests/compiler/zone-pool-unittest.cc |
| rename to test/unittests/compiler/zone-stats-unittest.cc |
| index 5bbdbfd45dd21bbd6be96c21650f28e0a810da51..dbf87963faa722c6566b1cb06ab6725ba271c673 100644 |
| --- a/test/unittests/compiler/zone-pool-unittest.cc |
| +++ b/test/unittests/compiler/zone-stats-unittest.cc |
| @@ -2,28 +2,28 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| +#include <compiler/zone-stats.h> |
|
Michael Starzinger
2016/09/21 11:53:28
Please use the #include "src/compiler/zone-stats.h
|
| #include "src/base/utils/random-number-generator.h" |
| -#include "src/compiler/zone-pool.h" |
| #include "test/unittests/test-utils.h" |
| namespace v8 { |
| namespace internal { |
| namespace compiler { |
| -class ZonePoolTest : public TestWithIsolate { |
| +class ZoneStatsTest : public TestWithIsolate { |
| public: |
| - ZonePoolTest() : zone_pool_(&allocator_) {} |
| + ZoneStatsTest() : zone_stats_(&allocator_) {} |
| protected: |
| - ZonePool* zone_pool() { return &zone_pool_; } |
| + ZoneStats* zone_stats() { return &zone_stats_; } |
| void ExpectForPool(size_t current, size_t max, size_t total) { |
| - ASSERT_EQ(current, zone_pool()->GetCurrentAllocatedBytes()); |
| - ASSERT_EQ(max, zone_pool()->GetMaxAllocatedBytes()); |
| - ASSERT_EQ(total, zone_pool()->GetTotalAllocatedBytes()); |
| + ASSERT_EQ(current, zone_stats()->GetCurrentAllocatedBytes()); |
| + ASSERT_EQ(max, zone_stats()->GetMaxAllocatedBytes()); |
| + ASSERT_EQ(total, zone_stats()->GetTotalAllocatedBytes()); |
| } |
| - void Expect(ZonePool::StatsScope* stats, size_t current, size_t max, |
| + void Expect(ZoneStats::StatsScope* stats, size_t current, size_t max, |
| size_t total) { |
| ASSERT_EQ(current, stats->GetCurrentAllocatedBytes()); |
| ASSERT_EQ(max, stats->GetMaxAllocatedBytes()); |
| @@ -39,41 +39,39 @@ class ZonePoolTest : public TestWithIsolate { |
| private: |
| v8::internal::AccountingAllocator allocator_; |
| - ZonePool zone_pool_; |
| + ZoneStats zone_stats_; |
| base::RandomNumberGenerator rng; |
| }; |
| - |
| -TEST_F(ZonePoolTest, Empty) { |
| +TEST_F(ZoneStatsTest, Empty) { |
| ExpectForPool(0, 0, 0); |
| { |
| - ZonePool::StatsScope stats(zone_pool()); |
| + ZoneStats::StatsScope stats(zone_stats()); |
| Expect(&stats, 0, 0, 0); |
| } |
| ExpectForPool(0, 0, 0); |
| { |
| - ZonePool::Scope scope(zone_pool()); |
| + ZoneStats::Scope scope(zone_stats()); |
| scope.zone(); |
| } |
| ExpectForPool(0, 0, 0); |
| } |
| - |
| -TEST_F(ZonePoolTest, MultipleZonesWithDeletion) { |
| +TEST_F(ZoneStatsTest, MultipleZonesWithDeletion) { |
| static const size_t kArraySize = 10; |
| - ZonePool::Scope* scopes[kArraySize]; |
| + ZoneStats::Scope* scopes[kArraySize]; |
| // Initialize. |
| size_t before_stats = 0; |
| for (size_t i = 0; i < kArraySize; ++i) { |
| - scopes[i] = new ZonePool::Scope(zone_pool()); |
| + scopes[i] = new ZoneStats::Scope(zone_stats()); |
| before_stats += Allocate(scopes[i]->zone()); // Add some stuff. |
| } |
| ExpectForPool(before_stats, before_stats, before_stats); |
| - ZonePool::StatsScope stats(zone_pool()); |
| + ZoneStats::StatsScope stats(zone_stats()); |
| size_t before_deletion = 0; |
| for (size_t i = 0; i < kArraySize; ++i) { |
| @@ -87,7 +85,7 @@ TEST_F(ZonePoolTest, MultipleZonesWithDeletion) { |
| // Delete the scopes and create new ones. |
| for (size_t i = 0; i < kArraySize; ++i) { |
| delete scopes[i]; |
| - scopes[i] = new ZonePool::Scope(zone_pool()); |
| + scopes[i] = new ZoneStats::Scope(zone_stats()); |
| } |
| Expect(&stats, 0, before_deletion, before_deletion); |
| @@ -116,14 +114,13 @@ TEST_F(ZonePoolTest, MultipleZonesWithDeletion) { |
| before_stats + before_deletion + after_deletion); |
| } |
| - |
| -TEST_F(ZonePoolTest, SimpleAllocationLoop) { |
| +TEST_F(ZoneStatsTest, SimpleAllocationLoop) { |
| int runs = 20; |
| size_t total_allocated = 0; |
| size_t max_loop_allocation = 0; |
| - ZonePool::StatsScope outer_stats(zone_pool()); |
| + ZoneStats::StatsScope outer_stats(zone_stats()); |
| { |
| - ZonePool::Scope outer_scope(zone_pool()); |
| + ZoneStats::Scope outer_scope(zone_stats()); |
| size_t outer_allocated = 0; |
| for (int i = 0; i < runs; ++i) { |
| { |
| @@ -131,10 +128,10 @@ TEST_F(ZonePoolTest, SimpleAllocationLoop) { |
| outer_allocated += bytes; |
| total_allocated += bytes; |
| } |
| - ZonePool::StatsScope inner_stats(zone_pool()); |
| + ZoneStats::StatsScope inner_stats(zone_stats()); |
| size_t allocated = 0; |
| { |
| - ZonePool::Scope inner_scope(zone_pool()); |
| + ZoneStats::Scope inner_scope(zone_stats()); |
| for (int j = 0; j < 20; ++j) { |
| size_t bytes = Allocate(inner_scope.zone()); |
| allocated += bytes; |