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

Side by Side Diff: test/unittests/heap/heap-unittest.cc

Issue 1163143009: Compute the heap growing factor based on mutator utilization and allocation throughput. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add missing file Created 5 years, 6 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
« no previous file with comments | « src/heap/heap.cc ('k') | test/unittests/unittests.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include <cmath>
6 #include <limits>
7
8 #include "src/objects.h"
9 #include "src/objects-inl.h"
10
11 #include "src/handles.h"
12 #include "src/handles-inl.h"
13
14 #include "src/heap/heap.h"
15 #include "testing/gtest/include/gtest/gtest.h"
16
17 namespace v8 {
18 namespace internal {
19
20 double Round(double x) {
21 // Round to three digits.
22 return floor(x * 1000 + 0.5) / 1000;
23 }
24
25
26 void CheckEqualRounded(double expected, double actual) {
27 expected = Round(expected);
28 actual = Round(actual);
29 EXPECT_DOUBLE_EQ(expected, actual);
30 }
31
32
33 TEST(Heap, HeapGrowingFactor) {
34 CheckEqualRounded(Heap::kMaxHeapGrowingFactor,
35 Heap::HeapGrowingFactor(34, 1));
36 CheckEqualRounded(3.553, Heap::HeapGrowingFactor(45, 1));
37 CheckEqualRounded(2.830, Heap::HeapGrowingFactor(50, 1));
38 CheckEqualRounded(1.478, Heap::HeapGrowingFactor(100, 1));
39 CheckEqualRounded(1.193, Heap::HeapGrowingFactor(200, 1));
40 CheckEqualRounded(1.121, Heap::HeapGrowingFactor(300, 1));
41 CheckEqualRounded(Heap::HeapGrowingFactor(300, 1),
42 Heap::HeapGrowingFactor(600, 2));
43 CheckEqualRounded(Heap::kMinHeapGrowingFactor,
44 Heap::HeapGrowingFactor(400, 1));
45 }
46
47 } // namespace internal
48 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/heap.cc ('k') | test/unittests/unittests.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698