Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(708)

Side by Side Diff: test/unittests/compiler/zone-pool-unittest.cc

Issue 924453002: Fix invalid use of int in Zone. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Windows again... Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« src/zone.cc ('K') | « src/zone.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "src/base/utils/random-number-generator.h" 5 #include "src/base/utils/random-number-generator.h"
6 #include "src/compiler/zone-pool.h" 6 #include "src/compiler/zone-pool.h"
7 #include "test/unittests/test-utils.h" 7 #include "test/unittests/test-utils.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
(...skipping 14 matching lines...) Expand all
25 25
26 void Expect(ZonePool::StatsScope* stats, size_t current, size_t max, 26 void Expect(ZonePool::StatsScope* stats, size_t current, size_t max,
27 size_t total) { 27 size_t total) {
28 ASSERT_EQ(current, stats->GetCurrentAllocatedBytes()); 28 ASSERT_EQ(current, stats->GetCurrentAllocatedBytes());
29 ASSERT_EQ(max, stats->GetMaxAllocatedBytes()); 29 ASSERT_EQ(max, stats->GetMaxAllocatedBytes());
30 ASSERT_EQ(total, stats->GetTotalAllocatedBytes()); 30 ASSERT_EQ(total, stats->GetTotalAllocatedBytes());
31 } 31 }
32 32
33 size_t Allocate(Zone* zone) { 33 size_t Allocate(Zone* zone) {
34 size_t bytes = rng.NextInt(25) + 7; 34 size_t bytes = rng.NextInt(25) + 7;
35 int size_before = zone->allocation_size(); 35 size_t size_before = zone->allocation_size();
36 zone->New(static_cast<int>(bytes)); 36 zone->New(bytes);
37 return static_cast<size_t>(zone->allocation_size() - size_before); 37 return zone->allocation_size() - size_before;
38 } 38 }
39 39
40 private: 40 private:
41 ZonePool zone_pool_; 41 ZonePool zone_pool_;
42 base::RandomNumberGenerator rng; 42 base::RandomNumberGenerator rng;
43 }; 43 };
44 44
45 45
46 TEST_F(ZonePoolTest, Empty) { 46 TEST_F(ZonePoolTest, Empty) {
47 ExpectForPool(0, 0, 0); 47 ExpectForPool(0, 0, 0);
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 ExpectForPool(outer_allocated, max_loop_allocation, total_allocated); 153 ExpectForPool(outer_allocated, max_loop_allocation, total_allocated);
154 } 154 }
155 } 155 }
156 Expect(&outer_stats, 0, max_loop_allocation, total_allocated); 156 Expect(&outer_stats, 0, max_loop_allocation, total_allocated);
157 ExpectForPool(0, max_loop_allocation, total_allocated); 157 ExpectForPool(0, max_loop_allocation, total_allocated);
158 } 158 }
159 159
160 } // namespace compiler 160 } // namespace compiler
161 } // namespace internal 161 } // namespace internal
162 } // namespace v8 162 } // namespace v8
OLDNEW
« src/zone.cc ('K') | « src/zone.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698