Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(596)

Side by Side Diff: src/hydrogen-store-elimination.cc

Issue 295743002: Refactor transitioning stores. (Closed) Base URL: git@github.com:v8/v8.git@master
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/hydrogen-load-elimination.cc ('k') | src/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 store->access().Equals(prev->access()) &&
62 (!SmiValuesAre32Bits() ||
63 !store->field_representation().IsSmi() ||
64 store->store_mode() == STORE_TO_INITIALIZED_ENTRY ||
65 prev->store_mode() == INITIALIZING_STORE)) {
62 // This store is guaranteed to overwrite the previous store. 66 // This store is guaranteed to overwrite the previous store.
63 prev->DeleteAndReplaceWith(NULL); 67 prev->DeleteAndReplaceWith(NULL);
64 TRACE(("++ Unobserved store S%d overwritten by S%d\n", 68 TRACE(("++ Unobserved store S%d overwritten by S%d\n",
65 prev->id(), store->id())); 69 prev->id(), store->id()));
66 unobserved_.Remove(i); 70 unobserved_.Remove(i);
67 } else { 71 } else {
68 // TODO(titzer): remove map word clearing from folded allocations. 72 // TODO(titzer): remove map word clearing from folded allocations.
69 i++; 73 i++;
70 } 74 }
71 } 75 }
72 // Only non-transitioning stores are removable. 76 TRACE(("-- Might remove store S%d\n", store->id()));
73 if (!store->has_transition()) { 77 unobserved_.Add(store, zone());
74 TRACE(("-- Might remove store S%d\n", store->id()));
75 unobserved_.Add(store, zone());
76 }
77 } 78 }
78 79
79 80
80 void HStoreEliminationPhase::ProcessLoad(HLoadNamedField* load) { 81 void HStoreEliminationPhase::ProcessLoad(HLoadNamedField* load) {
81 HValue* object = load->object()->ActualValue(); 82 HValue* object = load->object()->ActualValue();
82 int i = 0; 83 int i = 0;
83 while (i < unobserved_.length()) { 84 while (i < unobserved_.length()) {
84 HStoreNamedField* prev = unobserved_.at(i); 85 HStoreNamedField* prev = unobserved_.at(i);
85 if (aliasing_->MayAlias(object, prev->object()->ActualValue()) && 86 if (aliasing_->MayAlias(object, prev->object()->ActualValue()) &&
86 load->access().Equals(prev->access())) { 87 load->access().Equals(prev->access())) {
(...skipping 20 matching lines...) Expand all
107 return; 108 return;
108 } 109 }
109 if (instr->DependsOnFlags().ContainsAnyOf(flags)) { 110 if (instr->DependsOnFlags().ContainsAnyOf(flags)) {
110 TRACE(("-- Observed stores at I%d (GVN flags)\n", instr->id())); 111 TRACE(("-- Observed stores at I%d (GVN flags)\n", instr->id()));
111 unobserved_.Rewind(0); 112 unobserved_.Rewind(0);
112 return; 113 return;
113 } 114 }
114 } 115 }
115 116
116 } } // namespace v8::internal 117 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen-load-elimination.cc ('k') | src/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698