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

Unified Diff: src/compiler/node.cc

Issue 855723002: Revert of 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/node.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/node.cc
diff --git a/src/compiler/node.cc b/src/compiler/node.cc
index 1486d8a34d2655b3a6367810139d77bac6cbf67a..a4680e4636f1630219fcfc4041e3aef1f260edbf 100644
--- a/src/compiler/node.cc
+++ b/src/compiler/node.cc
@@ -12,15 +12,15 @@
Node* Node::New(Zone* zone, NodeId id, const Operator* op, int input_count,
Node** inputs, bool has_extensible_inputs) {
- size_t node_size = sizeof(Node);
+ size_t node_size = sizeof(Node) - sizeof(Input);
int reserve_input_count = has_extensible_inputs ? kDefaultReservedInputs : 0;
- size_t inputs_size = (input_count + reserve_input_count) * sizeof(Input);
+ size_t inputs_size = std::max<size_t>(
+ (input_count + reserve_input_count) * sizeof(Input), sizeof(InputDeque*));
size_t uses_size = input_count * sizeof(Use);
int size = static_cast<int>(node_size + inputs_size + uses_size);
void* buffer = zone->New(size);
Node* result = new (buffer) Node(id, op, input_count, reserve_input_count);
- Input* input =
- reinterpret_cast<Input*>(reinterpret_cast<char*>(buffer) + node_size);
+ Input* input = result->inputs_.static_;
Use* use =
reinterpret_cast<Use*>(reinterpret_cast<char*>(input) + inputs_size);
@@ -175,9 +175,7 @@
ReservedInputCountField::encode(reserved_input_count) |
HasAppendableInputsField::encode(false)),
first_use_(nullptr),
- last_use_(nullptr) {
- inputs_.static_ = reinterpret_cast<Input*>(this + 1);
-}
+ last_use_(nullptr) {}
void Node::EnsureAppendableInputs(Zone* zone) {
« no previous file with comments | « src/compiler/node.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698