| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 // The main processing of instructions. | 69 // The main processing of instructions. |
| 70 HLoadEliminationTable* Process(HInstruction* instr, Zone* zone) { | 70 HLoadEliminationTable* Process(HInstruction* instr, Zone* zone) { |
| 71 switch (instr->opcode()) { | 71 switch (instr->opcode()) { |
| 72 case HValue::kLoadNamedField: { | 72 case HValue::kLoadNamedField: { |
| 73 HLoadNamedField* l = HLoadNamedField::cast(instr); | 73 HLoadNamedField* l = HLoadNamedField::cast(instr); |
| 74 TRACE((" process L%d field %d (o%d)\n", | 74 TRACE((" process L%d field %d (o%d)\n", |
| 75 instr->id(), | 75 instr->id(), |
| 76 FieldOf(l->access()), | 76 FieldOf(l->access()), |
| 77 l->object()->ActualValue()->id())); | 77 l->object()->ActualValue()->id())); |
| 78 HValue* result = load(l); | 78 HValue* result = load(l); |
| 79 if (result != instr) { | 79 if (result != instr && |
| 80 result->type().Equals(instr->type()) && |
| 81 result->representation().Equals(instr->representation())) { |
| 80 // The load can be replaced with a previous load or a value. | 82 // The load can be replaced with a previous load or a value. |
| 81 TRACE((" replace L%d -> v%d\n", instr->id(), result->id())); | 83 TRACE((" replace L%d -> v%d\n", instr->id(), result->id())); |
| 82 instr->DeleteAndReplaceWith(result); | 84 instr->DeleteAndReplaceWith(result); |
| 83 } | 85 } |
| 84 break; | 86 break; |
| 85 } | 87 } |
| 86 case HValue::kStoreNamedField: { | 88 case HValue::kStoreNamedField: { |
| 87 HStoreNamedField* s = HStoreNamedField::cast(instr); | 89 HStoreNamedField* s = HStoreNamedField::cast(instr); |
| 88 TRACE((" process S%d field %d (o%d) = v%d\n", | 90 TRACE((" process S%d field %d (o%d) = v%d\n", |
| 89 instr->id(), | 91 instr->id(), |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 } else { | 518 } else { |
| 517 // Perform only local analysis. | 519 // Perform only local analysis. |
| 518 for (int i = 0; i < graph()->blocks()->length(); i++) { | 520 for (int i = 0; i < graph()->blocks()->length(); i++) { |
| 519 table->Kill(); | 521 table->Kill(); |
| 520 engine.AnalyzeOneBlock(graph()->blocks()->at(i), table); | 522 engine.AnalyzeOneBlock(graph()->blocks()->at(i), table); |
| 521 } | 523 } |
| 522 } | 524 } |
| 523 } | 525 } |
| 524 | 526 |
| 525 } } // namespace v8::internal | 527 } } // namespace v8::internal |
| OLD | NEW |