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

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

Issue 2252283004: [turbofan] Allow for 32-bit field offsets in store elimination. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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 <iterator> 5 #include <iterator>
6 6
7 #include "src/compiler/store-store-elimination.h" 7 #include "src/compiler/store-store-elimination.h"
8 8
9 #include "src/compiler/all-nodes.h" 9 #include "src/compiler/all-nodes.h"
10 #include "src/compiler/js-graph.h" 10 #include "src/compiler/js-graph.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 // Assumption: every byte of a JS object is only ever accessed through one 65 // Assumption: every byte of a JS object is only ever accessed through one
66 // offset. For instance, byte 15 of a given object may be accessed using a 66 // offset. For instance, byte 15 of a given object may be accessed using a
67 // two-byte read at offset 14, or a four-byte read at offset 12, but never 67 // two-byte read at offset 14, or a four-byte read at offset 12, but never
68 // both in the same program. 68 // both in the same program.
69 // 69 //
70 // This implementation needs all dead nodes removed from the graph, and the 70 // This implementation needs all dead nodes removed from the graph, and the
71 // graph should be trimmed. 71 // graph should be trimmed.
72 72
73 namespace { 73 namespace {
74 74
75 // 16 bits was chosen fairly arbitrarily; it seems enough now. 8 bits is too 75 // 4GiB ought to be enough for anybody.
Jarin 2016/08/19 09:30:35 Just remove the comment.
bgeron 2016/08/19 10:42:10 Done.
76 // few. 76 typedef uint32_t StoreOffset;
77 typedef uint16_t StoreOffset;
78 77
79 struct UnobservableStore { 78 struct UnobservableStore {
80 NodeId id_; 79 NodeId id_;
81 StoreOffset offset_; 80 StoreOffset offset_;
82 81
83 bool operator==(const UnobservableStore) const; 82 bool operator==(const UnobservableStore) const;
84 bool operator!=(const UnobservableStore) const; 83 bool operator!=(const UnobservableStore) const;
85 bool operator<(const UnobservableStore) const; 84 bool operator<(const UnobservableStore) const;
86 }; 85 };
87 86
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 Zone* const temp_zone_; 163 Zone* const temp_zone_;
165 164
166 ZoneStack<Node*> revisit_; 165 ZoneStack<Node*> revisit_;
167 ZoneVector<bool> in_revisit_; 166 ZoneVector<bool> in_revisit_;
168 // Maps node IDs to UnobservableNodeSets. 167 // Maps node IDs to UnobservableNodeSets.
169 ZoneVector<UnobservablesSet> unobservable_; 168 ZoneVector<UnobservablesSet> unobservable_;
170 ZoneSet<Node*> to_remove_; 169 ZoneSet<Node*> to_remove_;
171 const UnobservablesSet unobservables_visited_empty_; 170 const UnobservablesSet unobservables_visited_empty_;
172 }; 171 };
173 172
174 // To safely cast an offset from a FieldAccess, which has a wider range 173 // To safely cast an offset from a FieldAccess, which has a potentially wider
175 // (namely int). 174 // range (namely int).
176 StoreOffset ToOffset(int offset) { 175 StoreOffset ToOffset(int offset) {
177 CHECK(0 <= offset && offset < (1 << 8 * sizeof(StoreOffset))); 176 CHECK(0 <= offset && (int64_t)offset < (1ll << 8 * sizeof(StoreOffset)));
Jarin 2016/08/19 09:30:35 At this point, the upper bound check is useless, j
bgeron 2016/08/19 10:42:10 Done.
178 return (StoreOffset)offset; 177 return (StoreOffset)offset;
Jarin 2016/08/19 09:30:35 static_cast, please.
bgeron 2016/08/19 10:42:10 Done.
179 } 178 }
180 179
181 StoreOffset ToOffset(const FieldAccess& access) { 180 StoreOffset ToOffset(const FieldAccess& access) {
182 return ToOffset(access.offset); 181 return ToOffset(access.offset);
183 } 182 }
184 183
185 unsigned int RepSizeOf(MachineRepresentation rep) { 184 unsigned int RepSizeOf(MachineRepresentation rep) {
186 return 1u << ElementSizeLog2Of(rep); 185 return 1u << ElementSizeLog2Of(rep);
187 } 186 }
188 unsigned int RepSizeOf(FieldAccess access) { 187 unsigned int RepSizeOf(FieldAccess access) {
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 return !(*this == other); 560 return !(*this == other);
562 } 561 }
563 562
564 bool UnobservableStore::operator<(const UnobservableStore other) const { 563 bool UnobservableStore::operator<(const UnobservableStore other) const {
565 return (id_ < other.id_) || (id_ == other.id_ && offset_ < other.offset_); 564 return (id_ < other.id_) || (id_ == other.id_ && offset_ < other.offset_);
566 } 565 }
567 566
568 } // namespace compiler 567 } // namespace compiler
569 } // namespace internal 568 } // namespace internal
570 } // namespace v8 569 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698