OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 break; | 81 break; |
82 } | 82 } |
83 case HValue::kStoreNamedField: { | 83 case HValue::kStoreNamedField: { |
84 ReduceStoreNamedField(HStoreNamedField::cast(instr)); | 84 ReduceStoreNamedField(HStoreNamedField::cast(instr)); |
85 break; | 85 break; |
86 } | 86 } |
87 case HValue::kCompareMap: { | 87 case HValue::kCompareMap: { |
88 ReduceCompareMap(HCompareMap::cast(instr)); | 88 ReduceCompareMap(HCompareMap::cast(instr)); |
89 break; | 89 break; |
90 } | 90 } |
| 91 case HValue::kCompareObjectEqAndBranch: { |
| 92 ReduceCompareObjectEqAndBranch(HCompareObjectEqAndBranch::cast(instr)); |
| 93 break; |
| 94 } |
91 case HValue::kTransitionElementsKind: { | 95 case HValue::kTransitionElementsKind: { |
92 ReduceTransitionElementsKind( | 96 ReduceTransitionElementsKind( |
93 HTransitionElementsKind::cast(instr)); | 97 HTransitionElementsKind::cast(instr)); |
94 break; | 98 break; |
95 } | 99 } |
96 case HValue::kCheckMapValue: { | 100 case HValue::kCheckMapValue: { |
97 ReduceCheckMapValue(HCheckMapValue::cast(instr)); | 101 ReduceCheckMapValue(HCheckMapValue::cast(instr)); |
98 break; | 102 break; |
99 } | 103 } |
100 case HValue::kCheckHeapObject: { | 104 case HValue::kCheckHeapObject: { |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 | 476 |
473 TRACE(("Marking redundant CompareMap #%d for #%d at B%d as %s\n", | 477 TRACE(("Marking redundant CompareMap #%d for #%d at B%d as %s\n", |
474 instr->id(), instr->value()->id(), instr->block()->block_id(), | 478 instr->id(), instr->value()->id(), instr->block()->block_id(), |
475 succ == 0 ? "true" : "false")); | 479 succ == 0 ? "true" : "false")); |
476 instr->set_known_successor_index(succ); | 480 instr->set_known_successor_index(succ); |
477 | 481 |
478 int unreachable_succ = 1 - succ; | 482 int unreachable_succ = 1 - succ; |
479 instr->block()->MarkSuccEdgeUnreachable(unreachable_succ); | 483 instr->block()->MarkSuccEdgeUnreachable(unreachable_succ); |
480 } | 484 } |
481 | 485 |
| 486 void ReduceCompareObjectEqAndBranch(HCompareObjectEqAndBranch* instr) { |
| 487 MapSet maps_left = FindMaps(instr->left()->ActualValue()); |
| 488 if (maps_left == NULL) return; |
| 489 MapSet maps_right = FindMaps(instr->right()->ActualValue()); |
| 490 if (maps_right == NULL) return; |
| 491 MapSet intersection = maps_left->Intersect(maps_right, phase_->zone()); |
| 492 if (intersection->size() > 0) return; |
| 493 |
| 494 TRACE(("Marking redundant CompareObjectEqAndBranch #%d at B%d as false\n", |
| 495 instr->id(), instr->block()->block_id())); |
| 496 int succ = 1; |
| 497 instr->set_known_successor_index(succ); |
| 498 |
| 499 int unreachable_succ = 1 - succ; |
| 500 instr->block()->MarkSuccEdgeUnreachable(unreachable_succ); |
| 501 } |
| 502 |
482 void ReduceTransitionElementsKind(HTransitionElementsKind* instr) { | 503 void ReduceTransitionElementsKind(HTransitionElementsKind* instr) { |
483 MapSet maps = FindMaps(instr->object()->ActualValue()); | 504 MapSet maps = FindMaps(instr->object()->ActualValue()); |
484 // Can only learn more about an object that already has a known set of maps. | 505 // Can only learn more about an object that already has a known set of maps. |
485 if (maps == NULL) return; | 506 if (maps == NULL) return; |
486 if (maps->Contains(instr->original_map())) { | 507 if (maps->Contains(instr->original_map())) { |
487 // If the object has the original map, it will be transitioned. | 508 // If the object has the original map, it will be transitioned. |
488 maps->Remove(instr->original_map()); | 509 maps->Remove(instr->original_map()); |
489 maps->Add(instr->transitioned_map(), phase_->zone()); | 510 maps->Add(instr->transitioned_map(), phase_->zone()); |
490 } else { | 511 } else { |
491 // Object does not have the given map, thus the transition is redundant. | 512 // Object does not have the given map, thus the transition is redundant. |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
715 PRINT_STAT(removed_cho); | 736 PRINT_STAT(removed_cho); |
716 PRINT_STAT(narrowed); | 737 PRINT_STAT(narrowed); |
717 PRINT_STAT(loads); | 738 PRINT_STAT(loads); |
718 PRINT_STAT(empty); | 739 PRINT_STAT(empty); |
719 PRINT_STAT(compares_true); | 740 PRINT_STAT(compares_true); |
720 PRINT_STAT(compares_false); | 741 PRINT_STAT(compares_false); |
721 PRINT_STAT(transitions); | 742 PRINT_STAT(transitions); |
722 } | 743 } |
723 | 744 |
724 } } // namespace v8::internal | 745 } } // namespace v8::internal |
OLD | NEW |