OLD | NEW |
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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "graph-tester.h" | 7 #include "graph-tester.h" |
8 #include "src/compiler/common-operator.h" | 8 #include "src/compiler/common-operator.h" |
9 #include "src/compiler/node-cache.h" | 9 #include "src/compiler/node-cache.h" |
10 | 10 |
11 using namespace v8::internal; | 11 using namespace v8::internal; |
12 using namespace v8::internal::compiler; | 12 using namespace v8::internal::compiler; |
13 | 13 |
14 TEST(Int32Constant_back_to_back) { | 14 TEST(Int32Constant_back_to_back) { |
15 GraphTester graph; | 15 GraphTester graph; |
16 Int32NodeCache cache; | 16 Int32NodeCache cache; |
17 | 17 |
18 for (int i = -2000000000; i < 2000000000; i += 3315177) { | 18 for (int i = -2000000000; i < 2000000000; i += 3315177) { |
19 Node** pos = cache.Find(graph.zone(), i); | 19 Node** pos = cache.Find(graph.zone(), i); |
20 CHECK_NE(NULL, pos); | 20 CHECK(pos); |
21 for (int j = 0; j < 3; j++) { | 21 for (int j = 0; j < 3; j++) { |
22 Node** npos = cache.Find(graph.zone(), i); | 22 Node** npos = cache.Find(graph.zone(), i); |
23 CHECK_EQ(pos, npos); | 23 CHECK_EQ(pos, npos); |
24 } | 24 } |
25 } | 25 } |
26 } | 26 } |
27 | 27 |
28 | 28 |
29 TEST(Int32Constant_five) { | 29 TEST(Int32Constant_five) { |
30 GraphTester graph; | 30 GraphTester graph; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 CHECK_LT(4, hits); | 73 CHECK_LT(4, hits); |
74 } | 74 } |
75 | 75 |
76 | 76 |
77 TEST(Int64Constant_back_to_back) { | 77 TEST(Int64Constant_back_to_back) { |
78 GraphTester graph; | 78 GraphTester graph; |
79 Int64NodeCache cache; | 79 Int64NodeCache cache; |
80 | 80 |
81 for (int64_t i = -2000000000; i < 2000000000; i += 3315177) { | 81 for (int64_t i = -2000000000; i < 2000000000; i += 3315177) { |
82 Node** pos = cache.Find(graph.zone(), i); | 82 Node** pos = cache.Find(graph.zone(), i); |
83 CHECK_NE(NULL, pos); | 83 CHECK(pos); |
84 for (int j = 0; j < 3; j++) { | 84 for (int j = 0; j < 3; j++) { |
85 Node** npos = cache.Find(graph.zone(), i); | 85 Node** npos = cache.Find(graph.zone(), i); |
86 CHECK_EQ(pos, npos); | 86 CHECK_EQ(pos, npos); |
87 } | 87 } |
88 } | 88 } |
89 } | 89 } |
90 | 90 |
91 | 91 |
92 TEST(Int64Constant_hits) { | 92 TEST(Int64Constant_hits) { |
93 GraphTester graph; | 93 GraphTester graph; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 CHECK(Contains(&nodes, *pos)); | 166 CHECK(Contains(&nodes, *pos)); |
167 } else { | 167 } else { |
168 ZoneVector<Node*> nodes(graph.zone()); | 168 ZoneVector<Node*> nodes(graph.zone()); |
169 Node* n = graph.NewNode(common.Int64Constant(k)); | 169 Node* n = graph.NewNode(common.Int64Constant(k)); |
170 *pos = n; | 170 *pos = n; |
171 cache.GetCachedNodes(&nodes); | 171 cache.GetCachedNodes(&nodes); |
172 CHECK(Contains(&nodes, n)); | 172 CHECK(Contains(&nodes, n)); |
173 } | 173 } |
174 } | 174 } |
175 } | 175 } |
OLD | NEW |