| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 "src/heap/identity-map.h" | 7 #include "src/heap/identity-map.h" |
| 8 #include "src/zone.h" | 8 #include "src/zone.h" |
| 9 | 9 |
| 10 #include "test/cctest/cctest.h" | 10 #include "test/cctest/cctest.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 | 116 |
| 117 | 117 |
| 118 TEST(Find_smi_not_found) { | 118 TEST(Find_smi_not_found) { |
| 119 IdentityMapTester t; | 119 IdentityMapTester t; |
| 120 for (int i = 0; i < 100; i++) { | 120 for (int i = 0; i < 100; i++) { |
| 121 CHECK_NULL(t.map.Find(t.smi(i))); | 121 CHECK_NULL(t.map.Find(t.smi(i))); |
| 122 } | 122 } |
| 123 } | 123 } |
| 124 | 124 |
| 125 | 125 |
| 126 TEST(Find_smi_not_found2) { |
| 127 IdentityMapTester t; |
| 128 for (int i = 1; i < 100; i++) { |
| 129 CHECK_NULL(t.map.Find(t.smi(i))); |
| 130 } |
| 131 t.map.Set(t.smi(1001), &t); |
| 132 for (int i = 1; i < 100; i++) { |
| 133 CHECK_NULL(t.map.Find(t.smi(i))); |
| 134 } |
| 135 } |
| 136 |
| 137 |
| 126 TEST(Find_num_not_found) { | 138 TEST(Find_num_not_found) { |
| 127 IdentityMapTester t; | 139 IdentityMapTester t; |
| 128 for (int i = 0; i < 100; i++) { | 140 for (int i = 0; i < 100; i++) { |
| 129 CHECK_NULL(t.map.Find(t.num(i + 0.2))); | 141 CHECK_NULL(t.map.Find(t.num(i + 0.2))); |
| 130 } | 142 } |
| 131 } | 143 } |
| 132 | 144 |
| 133 | 145 |
| 134 TEST(GetFind_smi_13) { | 146 TEST(GetFind_smi_13) { |
| 135 IdentityMapTester t; | 147 IdentityMapTester t; |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 t.heap()->CollectGarbage(i::NEW_SPACE); | 342 t.heap()->CollectGarbage(i::NEW_SPACE); |
| 331 | 343 |
| 332 // Check that searching for the numbers finds the same values. | 344 // Check that searching for the numbers finds the same values. |
| 333 for (size_t i = 0; i < arraysize(num_keys); i++) { | 345 for (size_t i = 0; i < arraysize(num_keys); i++) { |
| 334 t.CheckFind(num_keys[i], &num_keys[i]); | 346 t.CheckFind(num_keys[i], &num_keys[i]); |
| 335 t.CheckGet(num_keys[i], &num_keys[i]); | 347 t.CheckGet(num_keys[i], &num_keys[i]); |
| 336 } | 348 } |
| 337 } | 349 } |
| 338 } | 350 } |
| 339 } | 351 } |
| OLD | NEW |