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 "src/hydrogen-check-elimination.h" | 5 #include "src/hydrogen-check-elimination.h" |
6 | 6 |
7 #include "src/hydrogen-alias-analysis.h" | 7 #include "src/hydrogen-alias-analysis.h" |
8 #include "src/hydrogen-flow-engine.h" | 8 #include "src/hydrogen-flow-engine.h" |
9 | 9 |
10 #define GLOBAL 1 | 10 #define GLOBAL 1 |
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 } | 621 } |
622 instr->set_known_successor_index(succ); | 622 instr->set_known_successor_index(succ); |
623 int unreachable_succ = 1 - succ; | 623 int unreachable_succ = 1 - succ; |
624 instr->block()->MarkSuccEdgeUnreachable(unreachable_succ); | 624 instr->block()->MarkSuccEdgeUnreachable(unreachable_succ); |
625 } | 625 } |
626 | 626 |
627 void ReduceTransitionElementsKind(HTransitionElementsKind* instr) { | 627 void ReduceTransitionElementsKind(HTransitionElementsKind* instr) { |
628 HValue* object = instr->object()->ActualValue(); | 628 HValue* object = instr->object()->ActualValue(); |
629 HCheckTableEntry* entry = Find(object); | 629 HCheckTableEntry* entry = Find(object); |
630 // Can only learn more about an object that already has a known set of maps. | 630 // Can only learn more about an object that already has a known set of maps. |
631 if (entry == NULL) return; | 631 if (entry == NULL) { |
| 632 Kill(object); |
| 633 return; |
| 634 } |
632 EnsureChecked(entry, object, instr); | 635 EnsureChecked(entry, object, instr); |
633 if (entry->maps_->Contains(instr->original_map())) { | 636 if (entry->maps_->Contains(instr->original_map())) { |
634 // If the object has the original map, it will be transitioned. | 637 // If the object has the original map, it will be transitioned. |
635 UniqueSet<Map>* maps = entry->maps_->Copy(zone()); | 638 UniqueSet<Map>* maps = entry->maps_->Copy(zone()); |
636 maps->Remove(instr->original_map()); | 639 maps->Remove(instr->original_map()); |
637 maps->Add(instr->transitioned_map(), zone()); | 640 maps->Add(instr->transitioned_map(), zone()); |
638 entry->maps_ = maps; | 641 HCheckTableEntry::State state = |
| 642 (entry->state_ == HCheckTableEntry::CHECKED_STABLE && |
| 643 instr->map_is_stable()) |
| 644 ? HCheckTableEntry::CHECKED_STABLE |
| 645 : HCheckTableEntry::CHECKED; |
| 646 Kill(object); |
| 647 Insert(object, NULL, maps, state); |
639 } else { | 648 } else { |
640 // Object does not have the given map, thus the transition is redundant. | 649 // Object does not have the given map, thus the transition is redundant. |
641 instr->DeleteAndReplaceWith(object); | 650 instr->DeleteAndReplaceWith(object); |
642 INC_STAT(transitions_); | 651 INC_STAT(transitions_); |
643 } | 652 } |
644 } | 653 } |
645 | 654 |
646 void EnsureChecked(HCheckTableEntry* entry, | 655 void EnsureChecked(HCheckTableEntry* entry, |
647 HValue* value, | 656 HValue* value, |
648 HInstruction* instr) { | 657 HInstruction* instr) { |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
894 PRINT_STAT(removed_cit); | 903 PRINT_STAT(removed_cit); |
895 PRINT_STAT(narrowed); | 904 PRINT_STAT(narrowed); |
896 PRINT_STAT(loads); | 905 PRINT_STAT(loads); |
897 PRINT_STAT(empty); | 906 PRINT_STAT(empty); |
898 PRINT_STAT(compares_true); | 907 PRINT_STAT(compares_true); |
899 PRINT_STAT(compares_false); | 908 PRINT_STAT(compares_false); |
900 PRINT_STAT(transitions); | 909 PRINT_STAT(transitions); |
901 } | 910 } |
902 | 911 |
903 } } // namespace v8::internal | 912 } } // namespace v8::internal |
OLD | NEW |