| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 case HValue::kCheckMapValue: { | 96 case HValue::kCheckMapValue: { |
| 97 ReduceCheckMapValue(HCheckMapValue::cast(instr)); | 97 ReduceCheckMapValue(HCheckMapValue::cast(instr)); |
| 98 break; | 98 break; |
| 99 } | 99 } |
| 100 case HValue::kCheckHeapObject: { | 100 case HValue::kCheckHeapObject: { |
| 101 ReduceCheckHeapObject(HCheckHeapObject::cast(instr)); | 101 ReduceCheckHeapObject(HCheckHeapObject::cast(instr)); |
| 102 break; | 102 break; |
| 103 } | 103 } |
| 104 default: { | 104 default: { |
| 105 // If the instruction changes maps uncontrollably, drop everything. | 105 // If the instruction changes maps uncontrollably, drop everything. |
| 106 if (instr->CheckGVNFlag(kChangesMaps) || | 106 if (instr->CheckChangesFlag(kMaps) || |
| 107 instr->CheckGVNFlag(kChangesOsrEntries)) { | 107 instr->CheckChangesFlag(kOsrEntries)) { |
| 108 Kill(); | 108 Kill(); |
| 109 } | 109 } |
| 110 } | 110 } |
| 111 // Improvements possible: | 111 // Improvements possible: |
| 112 // - eliminate redundant HCheckSmi, HCheckInstanceType instructions | 112 // - eliminate redundant HCheckSmi, HCheckInstanceType instructions |
| 113 // - track which values have been HCheckHeapObject'd | 113 // - track which values have been HCheckHeapObject'd |
| 114 } | 114 } |
| 115 | 115 |
| 116 return this; | 116 return this; |
| 117 } | 117 } |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 // This store transitions the object to a new map. | 380 // This store transitions the object to a new map. |
| 381 Kill(object); | 381 Kill(object); |
| 382 Insert(object, MapConstant(instr->transition())); | 382 Insert(object, MapConstant(instr->transition())); |
| 383 } else if (IsMapAccess(instr->access())) { | 383 } else if (IsMapAccess(instr->access())) { |
| 384 // This is a store directly to the map field of the object. | 384 // This is a store directly to the map field of the object. |
| 385 Kill(object); | 385 Kill(object); |
| 386 if (!instr->value()->IsConstant()) return; | 386 if (!instr->value()->IsConstant()) return; |
| 387 Insert(object, MapConstant(instr->value())); | 387 Insert(object, MapConstant(instr->value())); |
| 388 } else { | 388 } else { |
| 389 // If the instruction changes maps, it should be handled above. | 389 // If the instruction changes maps, it should be handled above. |
| 390 CHECK(!instr->CheckGVNFlag(kChangesMaps)); | 390 CHECK(!instr->CheckChangesFlag(kMaps)); |
| 391 } | 391 } |
| 392 } | 392 } |
| 393 | 393 |
| 394 void ReduceCompareMap(HCompareMap* instr) { | 394 void ReduceCompareMap(HCompareMap* instr) { |
| 395 MapSet maps = FindMaps(instr->value()->ActualValue()); | 395 MapSet maps = FindMaps(instr->value()->ActualValue()); |
| 396 if (maps == NULL) return; | 396 if (maps == NULL) return; |
| 397 if (maps->Contains(instr->map())) { | 397 if (maps->Contains(instr->map())) { |
| 398 if (maps->size() == 1) { | 398 if (maps->size() == 1) { |
| 399 TRACE(("Marking redundant CompareMap #%d at B%d as true\n", | 399 TRACE(("Marking redundant CompareMap #%d at B%d as true\n", |
| 400 instr->id(), instr->block()->block_id())); | 400 instr->id(), instr->block()->block_id())); |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 switch (instr->opcode()) { | 564 switch (instr->opcode()) { |
| 565 case HValue::kStoreNamedField: { | 565 case HValue::kStoreNamedField: { |
| 566 stores_.Add(HStoreNamedField::cast(instr), zone); | 566 stores_.Add(HStoreNamedField::cast(instr), zone); |
| 567 break; | 567 break; |
| 568 } | 568 } |
| 569 case HValue::kOsrEntry: { | 569 case HValue::kOsrEntry: { |
| 570 // Kill everything. Loads must not be hoisted past the OSR entry. | 570 // Kill everything. Loads must not be hoisted past the OSR entry. |
| 571 maps_stored_ = true; | 571 maps_stored_ = true; |
| 572 } | 572 } |
| 573 default: { | 573 default: { |
| 574 maps_stored_ |= (instr->CheckGVNFlag(kChangesMaps) | | 574 maps_stored_ |= (instr->CheckChangesFlag(kMaps) | |
| 575 instr->CheckGVNFlag(kChangesElementsKind)); | 575 instr->CheckChangesFlag(kElementsKind)); |
| 576 } | 576 } |
| 577 } | 577 } |
| 578 } | 578 } |
| 579 | 579 |
| 580 // Apply these effects to the given check elimination table. | 580 // Apply these effects to the given check elimination table. |
| 581 void Apply(HCheckTable* table) { | 581 void Apply(HCheckTable* table) { |
| 582 if (maps_stored_) { | 582 if (maps_stored_) { |
| 583 // Uncontrollable map modifications; kill everything. | 583 // Uncontrollable map modifications; kill everything. |
| 584 table->Kill(); | 584 table->Kill(); |
| 585 return; | 585 return; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 PRINT_STAT(removed_cho); | 641 PRINT_STAT(removed_cho); |
| 642 PRINT_STAT(narrowed); | 642 PRINT_STAT(narrowed); |
| 643 PRINT_STAT(loads); | 643 PRINT_STAT(loads); |
| 644 PRINT_STAT(empty); | 644 PRINT_STAT(empty); |
| 645 PRINT_STAT(compares_true); | 645 PRINT_STAT(compares_true); |
| 646 PRINT_STAT(compares_false); | 646 PRINT_STAT(compares_false); |
| 647 PRINT_STAT(transitions); | 647 PRINT_STAT(transitions); |
| 648 } | 648 } |
| 649 | 649 |
| 650 } } // namespace v8::internal | 650 } } // namespace v8::internal |
| OLD | NEW |