| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 s->value()->id())); | 92 s->value()->id())); |
| 93 HValue* result = store(s); | 93 HValue* result = store(s); |
| 94 if (result == NULL) { | 94 if (result == NULL) { |
| 95 // The store is redundant. Remove it. | 95 // The store is redundant. Remove it. |
| 96 TRACE((" remove S%d\n", instr->id())); | 96 TRACE((" remove S%d\n", instr->id())); |
| 97 instr->DeleteAndReplaceWith(NULL); | 97 instr->DeleteAndReplaceWith(NULL); |
| 98 } | 98 } |
| 99 break; | 99 break; |
| 100 } | 100 } |
| 101 default: { | 101 default: { |
| 102 if (instr->CheckChangesFlag(kInobjectFields)) { | 102 if (instr->CheckGVNFlag(kChangesInobjectFields)) { |
| 103 TRACE((" kill-all i%d\n", instr->id())); | 103 TRACE((" kill-all i%d\n", instr->id())); |
| 104 Kill(); | 104 Kill(); |
| 105 break; | 105 break; |
| 106 } | 106 } |
| 107 if (instr->CheckChangesFlag(kMaps)) { | 107 if (instr->CheckGVNFlag(kChangesMaps)) { |
| 108 TRACE((" kill-maps i%d\n", instr->id())); | 108 TRACE((" kill-maps i%d\n", instr->id())); |
| 109 KillOffset(JSObject::kMapOffset); | 109 KillOffset(JSObject::kMapOffset); |
| 110 } | 110 } |
| 111 if (instr->CheckChangesFlag(kElementsKind)) { | 111 if (instr->CheckGVNFlag(kChangesElementsKind)) { |
| 112 TRACE((" kill-elements-kind i%d\n", instr->id())); | 112 TRACE((" kill-elements-kind i%d\n", instr->id())); |
| 113 KillOffset(JSObject::kMapOffset); | 113 KillOffset(JSObject::kMapOffset); |
| 114 KillOffset(JSObject::kElementsOffset); | 114 KillOffset(JSObject::kElementsOffset); |
| 115 } | 115 } |
| 116 if (instr->CheckChangesFlag(kElementsPointer)) { | 116 if (instr->CheckGVNFlag(kChangesElementsPointer)) { |
| 117 TRACE((" kill-elements i%d\n", instr->id())); | 117 TRACE((" kill-elements i%d\n", instr->id())); |
| 118 KillOffset(JSObject::kElementsOffset); | 118 KillOffset(JSObject::kElementsOffset); |
| 119 } | 119 } |
| 120 if (instr->CheckChangesFlag(kOsrEntries)) { | 120 if (instr->CheckGVNFlag(kChangesOsrEntries)) { |
| 121 TRACE((" kill-osr i%d\n", instr->id())); | 121 TRACE((" kill-osr i%d\n", instr->id())); |
| 122 Kill(); | 122 Kill(); |
| 123 } | 123 } |
| 124 } | 124 } |
| 125 // Improvements possible: | 125 // Improvements possible: |
| 126 // - learn from HCheckMaps for field 0 | 126 // - learn from HCheckMaps for field 0 |
| 127 // - remove unobservable stores (write-after-write) | 127 // - remove unobservable stores (write-after-write) |
| 128 // - track cells | 128 // - track cells |
| 129 // - track globals | 129 // - track globals |
| 130 // - track roots | 130 // - track roots |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 stores_.Add(HStoreNamedField::cast(instr), zone_); | 447 stores_.Add(HStoreNamedField::cast(instr), zone_); |
| 448 break; | 448 break; |
| 449 } | 449 } |
| 450 case HValue::kOsrEntry: { | 450 case HValue::kOsrEntry: { |
| 451 // Kill everything. Loads must not be hoisted past the OSR entry. | 451 // Kill everything. Loads must not be hoisted past the OSR entry. |
| 452 maps_stored_ = true; | 452 maps_stored_ = true; |
| 453 fields_stored_ = true; | 453 fields_stored_ = true; |
| 454 elements_stored_ = true; | 454 elements_stored_ = true; |
| 455 } | 455 } |
| 456 default: { | 456 default: { |
| 457 fields_stored_ |= instr->CheckChangesFlag(kInobjectFields); | 457 fields_stored_ |= instr->CheckGVNFlag(kChangesInobjectFields); |
| 458 maps_stored_ |= instr->CheckChangesFlag(kMaps); | 458 maps_stored_ |= instr->CheckGVNFlag(kChangesMaps); |
| 459 maps_stored_ |= instr->CheckChangesFlag(kElementsKind); | 459 maps_stored_ |= instr->CheckGVNFlag(kChangesElementsKind); |
| 460 elements_stored_ |= instr->CheckChangesFlag(kElementsKind); | 460 elements_stored_ |= instr->CheckGVNFlag(kChangesElementsKind); |
| 461 elements_stored_ |= instr->CheckChangesFlag(kElementsPointer); | 461 elements_stored_ |= instr->CheckGVNFlag(kChangesElementsPointer); |
| 462 } | 462 } |
| 463 } | 463 } |
| 464 } | 464 } |
| 465 | 465 |
| 466 // Apply these effects to the given load elimination table. | 466 // Apply these effects to the given load elimination table. |
| 467 void Apply(HLoadEliminationTable* table) { | 467 void Apply(HLoadEliminationTable* table) { |
| 468 if (fields_stored_) { | 468 if (fields_stored_) { |
| 469 table->Kill(); | 469 table->Kill(); |
| 470 return; | 470 return; |
| 471 } | 471 } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 } else { | 516 } else { |
| 517 // Perform only local analysis. | 517 // Perform only local analysis. |
| 518 for (int i = 0; i < graph()->blocks()->length(); i++) { | 518 for (int i = 0; i < graph()->blocks()->length(); i++) { |
| 519 table->Kill(); | 519 table->Kill(); |
| 520 engine.AnalyzeOneBlock(graph()->blocks()->at(i), table); | 520 engine.AnalyzeOneBlock(graph()->blocks()->at(i), table); |
| 521 } | 521 } |
| 522 } | 522 } |
| 523 } | 523 } |
| 524 | 524 |
| 525 } } // namespace v8::internal | 525 } } // namespace v8::internal |
| OLD | NEW |