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

Side by Side Diff: test/cctest/test-code-stub-assembler.cc

Issue 2412043003: [ic] Support non-code handlers in megamorphic stub cache. (Closed)
Patch Set: Addressing comments Created 4 years, 2 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/type-feedback-vector.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/code-factory.h" 6 #include "src/code-factory.h"
7 #include "src/code-stub-assembler.h" 7 #include "src/code-stub-assembler.h"
8 #include "src/compiler/node.h" 8 #include "src/compiler/node.h"
9 #include "src/ic/stub-cache.h" 9 #include "src/ic/stub-cache.h"
10 #include "src/isolate.h" 10 #include "src/isolate.h"
(...skipping 1328 matching lines...) Expand 10 before | Expand all | Expand 10 after
1339 stub_cache.Set(*name, receiver->map(), *handler); 1339 stub_cache.Set(*name, receiver->map(), *handler);
1340 } 1340 }
1341 1341
1342 // Perform some queries. 1342 // Perform some queries.
1343 bool queried_existing = false; 1343 bool queried_existing = false;
1344 bool queried_non_existing = false; 1344 bool queried_non_existing = false;
1345 for (int i = 0; i < N; i++) { 1345 for (int i = 0; i < N; i++) {
1346 int index = rand_gen.NextInt(); 1346 int index = rand_gen.NextInt();
1347 Handle<Name> name = names[index % names.size()]; 1347 Handle<Name> name = names[index % names.size()];
1348 Handle<JSObject> receiver = receivers[index % receivers.size()]; 1348 Handle<JSObject> receiver = receivers[index % receivers.size()];
1349 Code* handler = stub_cache.Get(*name, receiver->map()); 1349 Object* handler = stub_cache.Get(*name, receiver->map());
1350 if (handler == nullptr) { 1350 if (handler == nullptr) {
1351 queried_non_existing = true; 1351 queried_non_existing = true;
1352 } else { 1352 } else {
1353 queried_existing = true; 1353 queried_existing = true;
1354 } 1354 }
1355 1355
1356 Handle<Code> expected_handler(handler, isolate); 1356 Handle<Object> expected_handler(handler, isolate);
1357 ft.CheckTrue(receiver, name, expected_handler); 1357 ft.CheckTrue(receiver, name, expected_handler);
1358 } 1358 }
1359 1359
1360 for (int i = 0; i < N; i++) { 1360 for (int i = 0; i < N; i++) {
1361 int index1 = rand_gen.NextInt(); 1361 int index1 = rand_gen.NextInt();
1362 int index2 = rand_gen.NextInt(); 1362 int index2 = rand_gen.NextInt();
1363 Handle<Name> name = names[index1 % names.size()]; 1363 Handle<Name> name = names[index1 % names.size()];
1364 Handle<JSObject> receiver = receivers[index2 % receivers.size()]; 1364 Handle<JSObject> receiver = receivers[index2 % receivers.size()];
1365 Code* handler = stub_cache.Get(*name, receiver->map()); 1365 Object* handler = stub_cache.Get(*name, receiver->map());
1366 if (handler == nullptr) { 1366 if (handler == nullptr) {
1367 queried_non_existing = true; 1367 queried_non_existing = true;
1368 } else { 1368 } else {
1369 queried_existing = true; 1369 queried_existing = true;
1370 } 1370 }
1371 1371
1372 Handle<Code> expected_handler(handler, isolate); 1372 Handle<Object> expected_handler(handler, isolate);
1373 ft.CheckTrue(receiver, name, expected_handler); 1373 ft.CheckTrue(receiver, name, expected_handler);
1374 } 1374 }
1375 // Ensure we performed both kind of queries. 1375 // Ensure we performed both kind of queries.
1376 CHECK(queried_existing && queried_non_existing); 1376 CHECK(queried_existing && queried_non_existing);
1377 } 1377 }
1378 1378
1379 TEST(GotoIfException) { 1379 TEST(GotoIfException) {
1380 typedef CodeStubAssembler::Label Label; 1380 typedef CodeStubAssembler::Label Label;
1381 typedef CodeStubAssembler::Variable Variable; 1381 typedef CodeStubAssembler::Variable Variable;
1382 Isolate* isolate(CcTest::InitIsolateOnce()); 1382 Isolate* isolate(CcTest::InitIsolateOnce());
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
1504 1504
1505 Handle<Object> constructor = 1505 Handle<Object> constructor =
1506 Object::GetPropertyOrElement(result, 1506 Object::GetPropertyOrElement(result,
1507 isolate->factory()->constructor_string()) 1507 isolate->factory()->constructor_string())
1508 .ToHandleChecked(); 1508 .ToHandleChecked();
1509 CHECK(constructor->SameValue(*isolate->type_error_function())); 1509 CHECK(constructor->SameValue(*isolate->type_error_function()));
1510 } 1510 }
1511 1511
1512 } // namespace internal 1512 } // namespace internal
1513 } // namespace v8 1513 } // namespace v8
OLDNEW
« no previous file with comments | « src/type-feedback-vector.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698