Revert of [turbofan] Improve memory layout of Node class. (patchset #1 id:1 of https://codereview.chromium.org/828803004/)

Reason for revert:
Speculative revert to see if win XP recovers. Will reland if not.

Original issue's description:
> [turbofan] Improve memory layout of Node class.
>
> Also gets rid of the reinterpret_cast on this.
>
> R=svenpanne@chromium.org
>
> Committed: https://crrev.com/f91e8046fad99365c74ccbb39d42de58398dab57
> Cr-Commit-Position: refs/heads/master@{#26103}

TBR=svenpanne@chromium.org,dcarney@chromium.org,bmeurer@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review URL: https://codereview.chromium.org/856813003

Cr-Commit-Position: refs/heads/master@{#26106}
This commit is contained in:
machenbach 2015-01-16 08:49:58 -08:00 committed by Commit bot
parent b3b9d20ad7
commit dc6f34d836
2 changed files with 16 additions and 15 deletions

View File

@ -12,15 +12,15 @@ namespace compiler {
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) - sizeof(Input);
size_t node_size = sizeof(Node);
int reserve_input_count = has_extensible_inputs ? kDefaultReservedInputs : 0;
size_t inputs_size = std::max<size_t>(
(input_count + reserve_input_count) * sizeof(Input), sizeof(InputDeque*));
size_t inputs_size = (input_count + reserve_input_count) * sizeof(Input);
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 = result->inputs_.static_;
Input* input =
reinterpret_cast<Input*>(reinterpret_cast<char*>(buffer) + node_size);
Use* use =
reinterpret_cast<Use*>(reinterpret_cast<char*>(input) + inputs_size);
@ -175,7 +175,9 @@ Node::Node(NodeId id, const Operator* op, int input_count,
ReservedInputCountField::encode(reserved_input_count) |
HasAppendableInputsField::encode(false)),
first_use_(nullptr),
last_use_(nullptr) {}
last_use_(nullptr) {
inputs_.static_ = reinterpret_cast<Input*>(this + 1);
}
void Node::EnsureAppendableInputs(Zone* zone) {

View File

@ -168,13 +168,12 @@ class Node FINAL {
inline void EnsureAppendableInputs(Zone* zone);
Input* GetInputRecordPtr(int index) {
return has_appendable_inputs() ? &((*inputs_.appendable_)[index])
: &inputs_.static_[index];
}
const Input* GetInputRecordPtr(int index) const {
return has_appendable_inputs() ? &((*inputs_.appendable_)[index])
: &inputs_.static_[index];
Input* GetInputRecordPtr(int index) const {
if (has_appendable_inputs()) {
return &((*inputs_.appendable_)[index]);
} else {
return &inputs_.static_[index];
}
}
inline void AppendUse(Use* const use);
@ -225,16 +224,16 @@ class Node FINAL {
Mark mark_;
NodeId const id_;
unsigned bit_field_;
Use* first_use_;
Use* last_use_;
union {
// When a node is initially allocated, it uses a static buffer to hold its
// inputs under the assumption that the number of outputs will not increase.
// When the first input is appended, the static buffer is converted into a
// deque to allow for space-efficient growing.
Input static_[1];
Input* static_;
InputDeque* appendable_;
} inputs_;
Use* first_use_;
Use* last_use_;
friend class Edge;
friend class NodeMarkerBase;