| 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/base/utils/random-number-generator.h" | 5 #include "src/base/utils/random-number-generator.h" |
| 6 #include "src/ic/stub-cache.h" | 6 #include "src/ic/stub-cache.h" |
| 7 #include "src/interface-descriptors.h" | 7 #include "src/interface-descriptors.h" |
| 8 #include "src/isolate.h" | 8 #include "src/isolate.h" |
| 9 #include "test/cctest/compiler/function-tester.h" | 9 #include "test/cctest/compiler/function-tester.h" |
| 10 | 10 |
| (...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 uint32_t keys[kKeysCount]; | 689 uint32_t keys[kKeysCount]; |
| 690 | 690 |
| 691 Handle<Object> fake_value(Smi::FromInt(42), isolate); | 691 Handle<Object> fake_value(Smi::FromInt(42), isolate); |
| 692 PropertyDetails fake_details = PropertyDetails::Empty(); | 692 PropertyDetails fake_details = PropertyDetails::Empty(); |
| 693 | 693 |
| 694 base::RandomNumberGenerator rand_gen(FLAG_random_seed); | 694 base::RandomNumberGenerator rand_gen(FLAG_random_seed); |
| 695 | 695 |
| 696 for (int i = 0; i < kKeysCount; i++) { | 696 for (int i = 0; i < kKeysCount; i++) { |
| 697 int random_key = rand_gen.NextInt(Smi::kMaxValue); | 697 int random_key = rand_gen.NextInt(Smi::kMaxValue); |
| 698 keys[i] = static_cast<uint32_t>(random_key); | 698 keys[i] = static_cast<uint32_t>(random_key); |
| 699 if (dictionary->FindEntry(keys[i]) != Dictionary::kNotFound) continue; |
| 699 | 700 |
| 700 dictionary = Dictionary::Add(dictionary, keys[i], fake_value, fake_details); | 701 dictionary = Dictionary::Add(dictionary, keys[i], fake_value, fake_details); |
| 701 } | 702 } |
| 702 | 703 |
| 703 // Now try querying existing keys. | 704 // Now try querying existing keys. |
| 704 for (int i = 0; i < kKeysCount; i++) { | 705 for (int i = 0; i < kKeysCount; i++) { |
| 705 int entry = dictionary->FindEntry(keys[i]); | 706 int entry = dictionary->FindEntry(keys[i]); |
| 706 CHECK_NE(Dictionary::kNotFound, entry); | 707 CHECK_NE(Dictionary::kNotFound, entry); |
| 707 | 708 |
| 708 Handle<Object> key(Smi::FromInt(keys[i]), isolate); | 709 Handle<Object> key(Smi::FromInt(keys[i]), isolate); |
| (...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1396 | 1397 |
| 1397 Handle<Code> expected_handler(handler, isolate); | 1398 Handle<Code> expected_handler(handler, isolate); |
| 1398 ft.CheckTrue(receiver, name, expected_handler); | 1399 ft.CheckTrue(receiver, name, expected_handler); |
| 1399 } | 1400 } |
| 1400 // Ensure we performed both kind of queries. | 1401 // Ensure we performed both kind of queries. |
| 1401 CHECK(queried_existing && queried_non_existing); | 1402 CHECK(queried_existing && queried_non_existing); |
| 1402 } | 1403 } |
| 1403 | 1404 |
| 1404 } // namespace internal | 1405 } // namespace internal |
| 1405 } // namespace v8 | 1406 } // namespace v8 |
| OLD | NEW |