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

Unified Diff: src/compiler/node.cc

Issue 756073004: De-generify the GenericNode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix compilation on Windows. Created 6 years, 1 month 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') | src/compiler/node-matchers.h » ('j') | 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 673ef3290e9127e8c2859a0b264485f59ebdd281..be635177871363901f5a147c7673adcb6df531ed 100644
--- a/src/compiler/node.cc
+++ b/src/compiler/node.cc
@@ -3,13 +3,56 @@
// found in the LICENSE file.
#include "src/compiler/node.h"
-
-#include "src/compiler/generic-node-inl.h"
+#include "src/compiler/graph.h"
+#include "src/zone.h"
namespace v8 {
namespace internal {
namespace compiler {
+Node::Node(Graph* graph, int input_count, int reserve_input_count)
+ : NodeData(graph->zone()),
+ input_count_(input_count),
+ reserve_input_count_(reserve_input_count),
+ has_appendable_inputs_(false),
+ use_count_(0),
+ first_use_(NULL),
+ last_use_(NULL) {
+ DCHECK(reserve_input_count <= kMaxReservedInputs);
+ inputs_.static_ = reinterpret_cast<Input*>(this + 1);
+ id_ = graph->NextNodeID();
+}
+
+
+Node* Node::New(Graph* graph, int input_count, Node** inputs,
+ bool has_extensible_inputs) {
+ size_t node_size = sizeof(Node);
+ int reserve_input_count = has_extensible_inputs ? kDefaultReservedInputs : 0;
+ 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);
+ Zone* zone = graph->zone();
+ void* buffer = zone->New(size);
+ Node* result = new (buffer) Node(graph, input_count, reserve_input_count);
+ Input* input =
+ reinterpret_cast<Input*>(reinterpret_cast<char*>(buffer) + node_size);
+ Use* use =
+ reinterpret_cast<Use*>(reinterpret_cast<char*>(input) + inputs_size);
+
+ for (int current = 0; current < input_count; ++current) {
+ Node* to = *inputs++;
+ input->to = to;
+ input->use = use;
+ use->input_index = current;
+ use->from = result;
+ to->AppendUse(use);
+ ++use;
+ ++input;
+ }
+ return result;
+}
+
+
void Node::Kill() {
DCHECK_NOT_NULL(op());
RemoveAllInputs();
« no previous file with comments | « src/compiler/node.h ('k') | src/compiler/node-matchers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698