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 1309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1320 names.push_back(name); | 1320 names.push_back(name); |
1321 } | 1321 } |
1322 | 1322 |
1323 // Generate some number of receiver maps and receivers. | 1323 // Generate some number of receiver maps and receivers. |
1324 for (int i = 0; i < StubCache::kSecondaryTableSize / 2; i++) { | 1324 for (int i = 0; i < StubCache::kSecondaryTableSize / 2; i++) { |
1325 Handle<Map> map = Map::Create(isolate, 0); | 1325 Handle<Map> map = Map::Create(isolate, 0); |
1326 receivers.push_back(factory->NewJSObjectFromMap(map)); | 1326 receivers.push_back(factory->NewJSObjectFromMap(map)); |
1327 } | 1327 } |
1328 | 1328 |
1329 // Generate some number of handlers. | 1329 // Generate some number of handlers. |
1330 for (int i = 0; i < StubCache::kSecondaryTableSize; i++) { | 1330 for (int i = 0; i < 30; i++) { |
1331 Code::Kind code_kind; | 1331 Code::Kind code_kind; |
1332 switch (rand_gen.NextInt(4)) { | 1332 switch (rand_gen.NextInt(4)) { |
1333 case 0: | 1333 case 0: |
1334 code_kind = Code::LOAD_IC; | 1334 code_kind = Code::LOAD_IC; |
1335 break; | 1335 break; |
1336 case 1: | 1336 case 1: |
1337 code_kind = Code::KEYED_LOAD_IC; | 1337 code_kind = Code::KEYED_LOAD_IC; |
1338 break; | 1338 break; |
1339 case 2: | 1339 case 2: |
1340 code_kind = Code::STORE_IC; | 1340 code_kind = Code::STORE_IC; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1396 | 1396 |
1397 Handle<Code> expected_handler(handler, isolate); | 1397 Handle<Code> expected_handler(handler, isolate); |
1398 ft.CheckTrue(receiver, name, expected_handler); | 1398 ft.CheckTrue(receiver, name, expected_handler); |
1399 } | 1399 } |
1400 // Ensure we performed both kind of queries. | 1400 // Ensure we performed both kind of queries. |
1401 CHECK(queried_existing && queried_non_existing); | 1401 CHECK(queried_existing && queried_non_existing); |
1402 } | 1402 } |
1403 | 1403 |
1404 } // namespace internal | 1404 } // namespace internal |
1405 } // namespace v8 | 1405 } // namespace v8 |
OLD | NEW |