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

Side by Side Diff: src/ic/x64/handler-compiler-x64.cc

Issue 1993913002: [cleanup] Drop FLAG_eliminate_prototype_chain_checks (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebased Created 4 years, 7 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/ic/ppc/handler-compiler-ppc.cc ('k') | src/ic/x87/handler-compiler-x87.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #if V8_TARGET_ARCH_X64 5 #if V8_TARGET_ARCH_X64
6 6
7 #include "src/ic/handler-compiler.h" 7 #include "src/ic/handler-compiler.h"
8 8
9 #include "src/api-arguments.h" 9 #include "src/api-arguments.h"
10 #include "src/field-type.h" 10 #include "src/field-type.h"
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 Register object_reg, Register holder_reg, Register scratch1, 433 Register object_reg, Register holder_reg, Register scratch1,
434 Register scratch2, Handle<Name> name, Label* miss, PrototypeCheckType check, 434 Register scratch2, Handle<Name> name, Label* miss, PrototypeCheckType check,
435 ReturnHolder return_what) { 435 ReturnHolder return_what) {
436 Handle<Map> receiver_map = map(); 436 Handle<Map> receiver_map = map();
437 437
438 // Make sure there's no overlap between holder and object registers. 438 // Make sure there's no overlap between holder and object registers.
439 DCHECK(!scratch1.is(object_reg) && !scratch1.is(holder_reg)); 439 DCHECK(!scratch1.is(object_reg) && !scratch1.is(holder_reg));
440 DCHECK(!scratch2.is(object_reg) && !scratch2.is(holder_reg) && 440 DCHECK(!scratch2.is(object_reg) && !scratch2.is(holder_reg) &&
441 !scratch2.is(scratch1)); 441 !scratch2.is(scratch1));
442 442
443 if (FLAG_eliminate_prototype_chain_checks) { 443 Handle<Cell> validity_cell =
444 Handle<Cell> validity_cell = 444 Map::GetOrCreatePrototypeChainValidityCell(receiver_map, isolate());
445 Map::GetOrCreatePrototypeChainValidityCell(receiver_map, isolate()); 445 if (!validity_cell.is_null()) {
446 if (!validity_cell.is_null()) { 446 DCHECK_EQ(Smi::FromInt(Map::kPrototypeChainValid), validity_cell->value());
447 DCHECK_EQ(Smi::FromInt(Map::kPrototypeChainValid), 447 __ Move(scratch1, validity_cell, RelocInfo::CELL);
448 validity_cell->value()); 448 // Move(..., CELL) loads the payload's address!
449 __ Move(scratch1, validity_cell, RelocInfo::CELL); 449 __ SmiCompare(Operand(scratch1, 0),
450 // Move(..., CELL) loads the payload's address! 450 Smi::FromInt(Map::kPrototypeChainValid));
451 __ SmiCompare(Operand(scratch1, 0), 451 __ j(not_equal, miss);
452 Smi::FromInt(Map::kPrototypeChainValid)); 452 }
453 __ j(not_equal, miss);
454 }
455 453
456 // The prototype chain of primitives (and their JSValue wrappers) depends 454 // The prototype chain of primitives (and their JSValue wrappers) depends
457 // on the native context, which can't be guarded by validity cells. 455 // on the native context, which can't be guarded by validity cells.
458 // |object_reg| holds the native context specific prototype in this case; 456 // |object_reg| holds the native context specific prototype in this case;
459 // we need to check its map. 457 // we need to check its map.
460 if (check == CHECK_ALL_MAPS) { 458 if (check == CHECK_ALL_MAPS) {
461 __ movp(scratch1, FieldOperand(object_reg, HeapObject::kMapOffset)); 459 __ movp(scratch1, FieldOperand(object_reg, HeapObject::kMapOffset));
462 Handle<WeakCell> cell = Map::WeakCellForMap(receiver_map); 460 Handle<WeakCell> cell = Map::WeakCellForMap(receiver_map);
463 __ CmpWeakValue(scratch1, cell, scratch2); 461 __ CmpWeakValue(scratch1, cell, scratch2);
464 __ j(not_equal, miss); 462 __ j(not_equal, miss);
465 }
466 } 463 }
467 464
468 // Keep track of the current object in register reg. On the first 465 // Keep track of the current object in register reg. On the first
469 // iteration, reg is an alias for object_reg, on later iterations, 466 // iteration, reg is an alias for object_reg, on later iterations,
470 // it is an alias for holder_reg. 467 // it is an alias for holder_reg.
471 Register reg = object_reg; 468 Register reg = object_reg;
472 int depth = 0; 469 int depth = 0;
473 470
474 Handle<JSObject> current = Handle<JSObject>::null(); 471 Handle<JSObject> current = Handle<JSObject>::null();
475 if (receiver_map->IsJSGlobalObjectMap()) { 472 if (receiver_map->IsJSGlobalObjectMap()) {
(...skipping 17 matching lines...) Expand all
493 // fast and global objects or do negative lookup for normal objects. 490 // fast and global objects or do negative lookup for normal objects.
494 while (!current_map.is_identical_to(holder_map)) { 491 while (!current_map.is_identical_to(holder_map)) {
495 ++depth; 492 ++depth;
496 493
497 // Only global objects and objects that do not require access 494 // Only global objects and objects that do not require access
498 // checks are allowed in stubs. 495 // checks are allowed in stubs.
499 DCHECK(current_map->IsJSGlobalProxyMap() || 496 DCHECK(current_map->IsJSGlobalProxyMap() ||
500 !current_map->is_access_check_needed()); 497 !current_map->is_access_check_needed());
501 498
502 prototype = handle(JSObject::cast(current_map->prototype())); 499 prototype = handle(JSObject::cast(current_map->prototype()));
503 if (current_map->is_dictionary_map() && 500 if (current_map->IsJSGlobalObjectMap()) {
504 !current_map->IsJSGlobalObjectMap()) { 501 GenerateCheckPropertyCell(masm(), Handle<JSGlobalObject>::cast(current),
502 name, scratch2, miss);
503 } else if (current_map->is_dictionary_map()) {
505 DCHECK(!current_map->IsJSGlobalProxyMap()); // Proxy maps are fast. 504 DCHECK(!current_map->IsJSGlobalProxyMap()); // Proxy maps are fast.
506 if (!name->IsUniqueName()) { 505 if (!name->IsUniqueName()) {
507 DCHECK(name->IsString()); 506 DCHECK(name->IsString());
508 name = factory()->InternalizeString(Handle<String>::cast(name)); 507 name = factory()->InternalizeString(Handle<String>::cast(name));
509 } 508 }
510 DCHECK(current.is_null() || 509 DCHECK(current.is_null() ||
511 current->property_dictionary()->FindEntry(name) == 510 current->property_dictionary()->FindEntry(name) ==
512 NameDictionary::kNotFound); 511 NameDictionary::kNotFound);
513 512
514 if (FLAG_eliminate_prototype_chain_checks && depth > 1) { 513 if (depth > 1) {
515 // TODO(jkummerow): Cache and re-use weak cell. 514 // TODO(jkummerow): Cache and re-use weak cell.
516 __ LoadWeakValue(reg, isolate()->factory()->NewWeakCell(current), miss); 515 __ LoadWeakValue(reg, isolate()->factory()->NewWeakCell(current), miss);
517 } 516 }
518 GenerateDictionaryNegativeLookup(masm(), miss, reg, name, scratch1, 517 GenerateDictionaryNegativeLookup(masm(), miss, reg, name, scratch1,
519 scratch2); 518 scratch2);
520
521 if (!FLAG_eliminate_prototype_chain_checks) {
522 __ movp(scratch1, FieldOperand(reg, HeapObject::kMapOffset));
523 __ movp(holder_reg, FieldOperand(scratch1, Map::kPrototypeOffset));
524 }
525 } else {
526 Register map_reg = scratch1;
527 if (!FLAG_eliminate_prototype_chain_checks) {
528 __ movp(map_reg, FieldOperand(reg, HeapObject::kMapOffset));
529 }
530 if (current_map->IsJSGlobalObjectMap()) {
531 GenerateCheckPropertyCell(masm(), Handle<JSGlobalObject>::cast(current),
532 name, scratch2, miss);
533 } else if (!FLAG_eliminate_prototype_chain_checks &&
534 (depth != 1 || check == CHECK_ALL_MAPS)) {
535 Handle<WeakCell> cell = Map::WeakCellForMap(current_map);
536 __ CmpWeakValue(map_reg, cell, scratch2);
537 __ j(not_equal, miss);
538 }
539 if (!FLAG_eliminate_prototype_chain_checks) {
540 __ movp(holder_reg, FieldOperand(map_reg, Map::kPrototypeOffset));
541 }
542 } 519 }
543 520
544 reg = holder_reg; // From now on the object will be in holder_reg. 521 reg = holder_reg; // From now on the object will be in holder_reg.
545 // Go to the next object in the prototype chain. 522 // Go to the next object in the prototype chain.
546 current = prototype; 523 current = prototype;
547 current_map = handle(current->map()); 524 current_map = handle(current->map());
548 } 525 }
549 526
550 DCHECK(!current_map->IsJSGlobalProxyMap()); 527 DCHECK(!current_map->IsJSGlobalProxyMap());
551 528
552 // Log the check depth. 529 // Log the check depth.
553 LOG(isolate(), IntEvent("check-maps-depth", depth + 1)); 530 LOG(isolate(), IntEvent("check-maps-depth", depth + 1));
554 531
555 if (!FLAG_eliminate_prototype_chain_checks &&
556 (depth != 0 || check == CHECK_ALL_MAPS)) {
557 // Check the holder map.
558 __ movp(scratch1, FieldOperand(reg, HeapObject::kMapOffset));
559 Handle<WeakCell> cell = Map::WeakCellForMap(current_map);
560 __ CmpWeakValue(scratch1, cell, scratch2);
561 __ j(not_equal, miss);
562 }
563
564 bool return_holder = return_what == RETURN_HOLDER; 532 bool return_holder = return_what == RETURN_HOLDER;
565 if (FLAG_eliminate_prototype_chain_checks && return_holder && depth != 0) { 533 if (return_holder && depth != 0) {
566 __ LoadWeakValue(reg, isolate()->factory()->NewWeakCell(current), miss); 534 __ LoadWeakValue(reg, isolate()->factory()->NewWeakCell(current), miss);
567 } 535 }
568 536
569 // Return the register containing the holder. 537 // Return the register containing the holder.
570 return return_holder ? reg : no_reg; 538 return return_holder ? reg : no_reg;
571 } 539 }
572 540
573 541
574 void NamedLoadHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) { 542 void NamedLoadHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) {
575 if (!miss->is_unused()) { 543 if (!miss->is_unused()) {
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 // Return the generated code. 716 // Return the generated code.
749 return GetCode(kind(), name); 717 return GetCode(kind(), name);
750 } 718 }
751 719
752 720
753 #undef __ 721 #undef __
754 } // namespace internal 722 } // namespace internal
755 } // namespace v8 723 } // namespace v8
756 724
757 #endif // V8_TARGET_ARCH_X64 725 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/ic/ppc/handler-compiler-ppc.cc ('k') | src/ic/x87/handler-compiler-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698