OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 "hydrogen-check-elimination.h" | 5 #include "hydrogen-check-elimination.h" |
6 | 6 |
7 #include "hydrogen-alias-analysis.h" | 7 #include "hydrogen-alias-analysis.h" |
8 #include "hydrogen-flow-engine.h" | 8 #include "hydrogen-flow-engine.h" |
9 | 9 |
10 #define GLOBAL 1 | 10 #define GLOBAL 1 |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 HValue* value = instr->value()->ActualValue(); | 444 HValue* value = instr->value()->ActualValue(); |
445 if (Find(value) != NULL) { | 445 if (Find(value) != NULL) { |
446 // If the object has known maps, it's definitely a heap object. | 446 // If the object has known maps, it's definitely a heap object. |
447 instr->DeleteAndReplaceWith(value); | 447 instr->DeleteAndReplaceWith(value); |
448 INC_STAT(removed_cho_); | 448 INC_STAT(removed_cho_); |
449 } | 449 } |
450 } | 450 } |
451 | 451 |
452 void ReduceStoreNamedField(HStoreNamedField* instr) { | 452 void ReduceStoreNamedField(HStoreNamedField* instr) { |
453 HValue* object = instr->object()->ActualValue(); | 453 HValue* object = instr->object()->ActualValue(); |
454 if (instr->access().IsMap()) { | 454 if (instr->has_transition()) { |
| 455 // This store transitions the object to a new map. |
| 456 Kill(object); |
| 457 HConstant* c_transition = HConstant::cast(instr->transition()); |
| 458 HCheckTableEntry::State state = c_transition->HasStableMapValue() |
| 459 ? HCheckTableEntry::CHECKED_STABLE |
| 460 : HCheckTableEntry::CHECKED; |
| 461 Insert(object, NULL, c_transition->MapValue(), state); |
| 462 } else if (instr->access().IsMap()) { |
455 // This is a store directly to the map field of the object. | 463 // This is a store directly to the map field of the object. |
456 Kill(object); | 464 Kill(object); |
457 if (!instr->value()->IsConstant()) return; | 465 if (!instr->value()->IsConstant()) return; |
458 HConstant* c_value = HConstant::cast(instr->value()); | 466 HConstant* c_value = HConstant::cast(instr->value()); |
459 HCheckTableEntry::State state = c_value->HasStableMapValue() | 467 HCheckTableEntry::State state = c_value->HasStableMapValue() |
460 ? HCheckTableEntry::CHECKED_STABLE | 468 ? HCheckTableEntry::CHECKED_STABLE |
461 : HCheckTableEntry::CHECKED; | 469 : HCheckTableEntry::CHECKED; |
462 Insert(object, NULL, c_value->MapValue(), state); | 470 Insert(object, NULL, c_value->MapValue(), state); |
463 } else { | 471 } else { |
464 // If the instruction changes maps, it should be handled above. | 472 // If the instruction changes maps, it should be handled above. |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 explicit HCheckMapsEffects(Zone* zone) : objects_(0, zone) { } | 707 explicit HCheckMapsEffects(Zone* zone) : objects_(0, zone) { } |
700 | 708 |
701 // Effects are _not_ disabled. | 709 // Effects are _not_ disabled. |
702 inline bool Disabled() const { return false; } | 710 inline bool Disabled() const { return false; } |
703 | 711 |
704 // Process a possibly side-effecting instruction. | 712 // Process a possibly side-effecting instruction. |
705 void Process(HInstruction* instr, Zone* zone) { | 713 void Process(HInstruction* instr, Zone* zone) { |
706 switch (instr->opcode()) { | 714 switch (instr->opcode()) { |
707 case HValue::kStoreNamedField: { | 715 case HValue::kStoreNamedField: { |
708 HStoreNamedField* store = HStoreNamedField::cast(instr); | 716 HStoreNamedField* store = HStoreNamedField::cast(instr); |
709 if (store->access().IsMap()) { | 717 if (store->access().IsMap() || store->has_transition()) { |
710 objects_.Add(store->object(), zone); | 718 objects_.Add(store->object(), zone); |
711 } | 719 } |
712 break; | 720 break; |
713 } | 721 } |
714 case HValue::kTransitionElementsKind: { | 722 case HValue::kTransitionElementsKind: { |
715 objects_.Add(HTransitionElementsKind::cast(instr)->object(), zone); | 723 objects_.Add(HTransitionElementsKind::cast(instr)->object(), zone); |
716 break; | 724 break; |
717 } | 725 } |
718 default: { | 726 default: { |
719 flags_.Add(instr->ChangesFlags()); | 727 flags_.Add(instr->ChangesFlags()); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
788 PRINT_STAT(removed_cho); | 796 PRINT_STAT(removed_cho); |
789 PRINT_STAT(narrowed); | 797 PRINT_STAT(narrowed); |
790 PRINT_STAT(loads); | 798 PRINT_STAT(loads); |
791 PRINT_STAT(empty); | 799 PRINT_STAT(empty); |
792 PRINT_STAT(compares_true); | 800 PRINT_STAT(compares_true); |
793 PRINT_STAT(compares_false); | 801 PRINT_STAT(compares_false); |
794 PRINT_STAT(transitions); | 802 PRINT_STAT(transitions); |
795 } | 803 } |
796 | 804 |
797 } } // namespace v8::internal | 805 } } // namespace v8::internal |
OLD | NEW |