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-store-elimination.h" | 5 #include "hydrogen-store-elimination.h" |
6 #include "hydrogen-instructions.h" | 6 #include "hydrogen-instructions.h" |
7 | 7 |
8 namespace v8 { | 8 namespace v8 { |
9 namespace internal { | 9 namespace internal { |
10 | 10 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 } | 51 } |
52 } | 52 } |
53 | 53 |
54 | 54 |
55 void HStoreEliminationPhase::ProcessStore(HStoreNamedField* store) { | 55 void HStoreEliminationPhase::ProcessStore(HStoreNamedField* store) { |
56 HValue* object = store->object()->ActualValue(); | 56 HValue* object = store->object()->ActualValue(); |
57 int i = 0; | 57 int i = 0; |
58 while (i < unobserved_.length()) { | 58 while (i < unobserved_.length()) { |
59 HStoreNamedField* prev = unobserved_.at(i); | 59 HStoreNamedField* prev = unobserved_.at(i); |
60 if (aliasing_->MustAlias(object, prev->object()->ActualValue()) && | 60 if (aliasing_->MustAlias(object, prev->object()->ActualValue()) && |
61 store->access().Equals(prev->access())) { | 61 prev->CanBeReplacedWith(store)) { |
62 // This store is guaranteed to overwrite the previous store. | 62 // This store is guaranteed to overwrite the previous store. |
63 prev->DeleteAndReplaceWith(NULL); | 63 prev->DeleteAndReplaceWith(NULL); |
64 TRACE(("++ Unobserved store S%d overwritten by S%d\n", | 64 TRACE(("++ Unobserved store S%d overwritten by S%d\n", |
65 prev->id(), store->id())); | 65 prev->id(), store->id())); |
66 unobserved_.Remove(i); | 66 unobserved_.Remove(i); |
67 } else { | 67 } else { |
68 // TODO(titzer): remove map word clearing from folded allocations. | 68 // TODO(titzer): remove map word clearing from folded allocations. |
69 i++; | 69 i++; |
70 } | 70 } |
71 } | 71 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 return; | 107 return; |
108 } | 108 } |
109 if (instr->DependsOnFlags().ContainsAnyOf(flags)) { | 109 if (instr->DependsOnFlags().ContainsAnyOf(flags)) { |
110 TRACE(("-- Observed stores at I%d (GVN flags)\n", instr->id())); | 110 TRACE(("-- Observed stores at I%d (GVN flags)\n", instr->id())); |
111 unobserved_.Rewind(0); | 111 unobserved_.Rewind(0); |
112 return; | 112 return; |
113 } | 113 } |
114 } | 114 } |
115 | 115 |
116 } } // namespace v8::internal | 116 } } // namespace v8::internal |
OLD | NEW |