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

Side by Side Diff: src/compiler/node.h

Issue 856813003: Revert of [turbofan] Improve memory layout of Node class. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 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 | src/compiler/node.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 #ifndef V8_COMPILER_NODE_H_ 5 #ifndef V8_COMPILER_NODE_H_
6 #define V8_COMPILER_NODE_H_ 6 #define V8_COMPILER_NODE_H_
7 7
8 #include "src/compiler/opcodes.h" 8 #include "src/compiler/opcodes.h"
9 #include "src/compiler/operator.h" 9 #include "src/compiler/operator.h"
10 #include "src/types-inl.h" 10 #include "src/types-inl.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 Use* use; 161 Use* use;
162 162
163 void Update(Node* new_to); 163 void Update(Node* new_to);
164 }; 164 };
165 165
166 inline Node(NodeId id, const Operator* op, int input_count, 166 inline Node(NodeId id, const Operator* op, int input_count,
167 int reserve_input_count); 167 int reserve_input_count);
168 168
169 inline void EnsureAppendableInputs(Zone* zone); 169 inline void EnsureAppendableInputs(Zone* zone);
170 170
171 Input* GetInputRecordPtr(int index) { 171 Input* GetInputRecordPtr(int index) const {
172 return has_appendable_inputs() ? &((*inputs_.appendable_)[index]) 172 if (has_appendable_inputs()) {
173 : &inputs_.static_[index]; 173 return &((*inputs_.appendable_)[index]);
174 } 174 } else {
175 const Input* GetInputRecordPtr(int index) const { 175 return &inputs_.static_[index];
176 return has_appendable_inputs() ? &((*inputs_.appendable_)[index]) 176 }
177 : &inputs_.static_[index];
178 } 177 }
179 178
180 inline void AppendUse(Use* const use); 179 inline void AppendUse(Use* const use);
181 inline void RemoveUse(Use* const use); 180 inline void RemoveUse(Use* const use);
182 181
183 void* operator new(size_t, void* location) { return location; } 182 void* operator new(size_t, void* location) { return location; }
184 183
185 typedef ZoneDeque<Input> InputDeque; 184 typedef ZoneDeque<Input> InputDeque;
186 185
187 // Only NodeProperties should manipulate the bounds. 186 // Only NodeProperties should manipulate the bounds.
(...skipping 30 matching lines...) Expand all
218 typedef BitField<unsigned, 0, 29> InputCountField; 217 typedef BitField<unsigned, 0, 29> InputCountField;
219 typedef BitField<unsigned, 29, 2> ReservedInputCountField; 218 typedef BitField<unsigned, 29, 2> ReservedInputCountField;
220 typedef BitField<unsigned, 31, 1> HasAppendableInputsField; 219 typedef BitField<unsigned, 31, 1> HasAppendableInputsField;
221 static const int kDefaultReservedInputs = ReservedInputCountField::kMax; 220 static const int kDefaultReservedInputs = ReservedInputCountField::kMax;
222 221
223 const Operator* op_; 222 const Operator* op_;
224 Bounds bounds_; 223 Bounds bounds_;
225 Mark mark_; 224 Mark mark_;
226 NodeId const id_; 225 NodeId const id_;
227 unsigned bit_field_; 226 unsigned bit_field_;
228 Use* first_use_;
229 Use* last_use_;
230 union { 227 union {
231 // When a node is initially allocated, it uses a static buffer to hold its 228 // When a node is initially allocated, it uses a static buffer to hold its
232 // inputs under the assumption that the number of outputs will not increase. 229 // inputs under the assumption that the number of outputs will not increase.
233 // When the first input is appended, the static buffer is converted into a 230 // When the first input is appended, the static buffer is converted into a
234 // deque to allow for space-efficient growing. 231 // deque to allow for space-efficient growing.
235 Input static_[1]; 232 Input* static_;
236 InputDeque* appendable_; 233 InputDeque* appendable_;
237 } inputs_; 234 } inputs_;
235 Use* first_use_;
236 Use* last_use_;
238 237
239 friend class Edge; 238 friend class Edge;
240 friend class NodeMarkerBase; 239 friend class NodeMarkerBase;
241 friend class NodeProperties; 240 friend class NodeProperties;
242 241
243 DISALLOW_COPY_AND_ASSIGN(Node); 242 DISALLOW_COPY_AND_ASSIGN(Node);
244 }; 243 };
245 244
246 245
247 std::ostream& operator<<(std::ostream& os, const Node& n); 246 std::ostream& operator<<(std::ostream& os, const Node& n);
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 476
478 void Node::ReplaceInput(int index, Node* new_to) { 477 void Node::ReplaceInput(int index, Node* new_to) {
479 GetInputRecordPtr(index)->Update(new_to); 478 GetInputRecordPtr(index)->Update(new_to);
480 } 479 }
481 480
482 } // namespace compiler 481 } // namespace compiler
483 } // namespace internal 482 } // namespace internal
484 } // namespace v8 483 } // namespace v8
485 484
486 #endif // V8_COMPILER_NODE_H_ 485 #endif // V8_COMPILER_NODE_H_
OLDNEW
« no previous file with comments | « no previous file | src/compiler/node.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698