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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 // This store transitions the object to a new map. | 325 // This store transitions the object to a new map. |
326 Kill(object); | 326 Kill(object); |
327 Insert(object, MapConstant(instr->transition())); | 327 Insert(object, MapConstant(instr->transition())); |
328 } else if (IsMapAccess(instr->access())) { | 328 } else if (IsMapAccess(instr->access())) { |
329 // This is a store directly to the map field of the object. | 329 // This is a store directly to the map field of the object. |
330 Kill(object); | 330 Kill(object); |
331 if (!instr->value()->IsConstant()) return; | 331 if (!instr->value()->IsConstant()) return; |
332 Insert(object, MapConstant(instr->value())); | 332 Insert(object, MapConstant(instr->value())); |
333 } else { | 333 } else { |
334 // If the instruction changes maps, it should be handled above. | 334 // If the instruction changes maps, it should be handled above. |
335 CHECK(!instr->CheckGVNFlag(kChangesMaps)); | 335 CHECK(!instr->CheckChangesFlag(kMaps)); |
336 } | 336 } |
337 } | 337 } |
338 | 338 |
339 void ReduceCompareMap(HCompareMap* instr) { | 339 void ReduceCompareMap(HCompareMap* instr) { |
340 MapSet maps = FindMaps(instr->value()->ActualValue()); | 340 MapSet maps = FindMaps(instr->value()->ActualValue()); |
341 if (maps == NULL) return; | 341 if (maps == NULL) return; |
342 if (maps->Contains(instr->map())) { | 342 if (maps->Contains(instr->map())) { |
343 if (maps->size() == 1) { | 343 if (maps->size() == 1) { |
344 TRACE(("Marking redundant CompareMap #%d at B%d as true\n", | 344 TRACE(("Marking redundant CompareMap #%d at B%d as true\n", |
345 instr->id(), instr->block()->block_id())); | 345 instr->id(), instr->block()->block_id())); |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 switch (instr->opcode()) { | 507 switch (instr->opcode()) { |
508 case HValue::kStoreNamedField: { | 508 case HValue::kStoreNamedField: { |
509 stores_.Add(HStoreNamedField::cast(instr), zone); | 509 stores_.Add(HStoreNamedField::cast(instr), zone); |
510 break; | 510 break; |
511 } | 511 } |
512 case HValue::kOsrEntry: { | 512 case HValue::kOsrEntry: { |
513 // Kill everything. Loads must not be hoisted past the OSR entry. | 513 // Kill everything. Loads must not be hoisted past the OSR entry. |
514 maps_stored_ = true; | 514 maps_stored_ = true; |
515 } | 515 } |
516 default: { | 516 default: { |
517 maps_stored_ |= (instr->CheckGVNFlag(kChangesMaps) | | 517 maps_stored_ |= (instr->CheckChangesFlag(kMaps) | |
518 instr->CheckGVNFlag(kChangesElementsKind)); | 518 instr->CheckChangesFlag(kElementsKind)); |
519 } | 519 } |
520 } | 520 } |
521 } | 521 } |
522 | 522 |
523 // Apply these effects to the given check elimination table. | 523 // Apply these effects to the given check elimination table. |
524 void Apply(HCheckTable* table) { | 524 void Apply(HCheckTable* table) { |
525 if (maps_stored_) { | 525 if (maps_stored_) { |
526 // Uncontrollable map modifications; kill everything. | 526 // Uncontrollable map modifications; kill everything. |
527 table->Kill(); | 527 table->Kill(); |
528 return; | 528 return; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 PRINT_STAT(removed_cho); | 584 PRINT_STAT(removed_cho); |
585 PRINT_STAT(narrowed); | 585 PRINT_STAT(narrowed); |
586 PRINT_STAT(loads); | 586 PRINT_STAT(loads); |
587 PRINT_STAT(empty); | 587 PRINT_STAT(empty); |
588 PRINT_STAT(compares_true); | 588 PRINT_STAT(compares_true); |
589 PRINT_STAT(compares_false); | 589 PRINT_STAT(compares_false); |
590 PRINT_STAT(transitions); | 590 PRINT_STAT(transitions); |
591 } | 591 } |
592 | 592 |
593 } } // namespace v8::internal | 593 } } // namespace v8::internal |
OLD | NEW |