OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "hydrogen-alias-analysis.h" | 5 #include "hydrogen-alias-analysis.h" |
6 #include "hydrogen-load-elimination.h" | 6 #include "hydrogen-load-elimination.h" |
7 #include "hydrogen-instructions.h" | 7 #include "hydrogen-instructions.h" |
8 #include "hydrogen-flow-engine.h" | 8 #include "hydrogen-flow-engine.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 // The main processing of instructions. | 46 // The main processing of instructions. |
47 HLoadEliminationTable* Process(HInstruction* instr, Zone* zone) { | 47 HLoadEliminationTable* Process(HInstruction* instr, Zone* zone) { |
48 switch (instr->opcode()) { | 48 switch (instr->opcode()) { |
49 case HValue::kLoadNamedField: { | 49 case HValue::kLoadNamedField: { |
50 HLoadNamedField* l = HLoadNamedField::cast(instr); | 50 HLoadNamedField* l = HLoadNamedField::cast(instr); |
51 TRACE((" process L%d field %d (o%d)\n", | 51 TRACE((" process L%d field %d (o%d)\n", |
52 instr->id(), | 52 instr->id(), |
53 FieldOf(l->access()), | 53 FieldOf(l->access()), |
54 l->object()->ActualValue()->id())); | 54 l->object()->ActualValue()->id())); |
55 HValue* result = load(l); | 55 HValue* result = load(l); |
56 if (result != instr && | 56 if (result != instr && l->CanBeReplacedWith(result)) { |
57 result->type().Equals(instr->type()) && | |
58 result->representation().Equals(instr->representation()) && | |
59 (!result->IsLoadNamedField() || | |
60 HLoadNamedField::cast(instr)->maps()->IsSubset( | |
61 HLoadNamedField::cast(result)->maps()))) { | |
62 // The load can be replaced with a previous load or a value. | 57 // The load can be replaced with a previous load or a value. |
63 TRACE((" replace L%d -> v%d\n", instr->id(), result->id())); | 58 TRACE((" replace L%d -> v%d\n", instr->id(), result->id())); |
64 instr->DeleteAndReplaceWith(result); | 59 instr->DeleteAndReplaceWith(result); |
65 } | 60 } |
66 break; | 61 break; |
67 } | 62 } |
68 case HValue::kStoreNamedField: { | 63 case HValue::kStoreNamedField: { |
69 HStoreNamedField* s = HStoreNamedField::cast(instr); | 64 HStoreNamedField* s = HStoreNamedField::cast(instr); |
70 TRACE((" process S%d field %d (o%d) = v%d\n", | 65 TRACE((" process S%d field %d (o%d) = v%d\n", |
71 instr->id(), | 66 instr->id(), |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 } else { | 503 } else { |
509 // Perform only local analysis. | 504 // Perform only local analysis. |
510 for (int i = 0; i < graph()->blocks()->length(); i++) { | 505 for (int i = 0; i < graph()->blocks()->length(); i++) { |
511 table->Kill(); | 506 table->Kill(); |
512 engine.AnalyzeOneBlock(graph()->blocks()->at(i), table); | 507 engine.AnalyzeOneBlock(graph()->blocks()->at(i), table); |
513 } | 508 } |
514 } | 509 } |
515 } | 510 } |
516 | 511 |
517 } } // namespace v8::internal | 512 } } // namespace v8::internal |
OLD | NEW |